USB descriptor for Joystick + Serial causing issue when uploading code

Status
Not open for further replies.

edemers

Active member
Hello Guys,

I tried to read posts online to create a USB descriptor for Joystick + Serial USB but I must admit I am missing some information.

Basically, I want windows to recognize my device as a joystick and also be able to talk to it via serial when I put it in "Setup mode". "Setup mode" is launched when user presses a combination of buttons and used to configure the joystick buttons etc via a windows based software I made. When not in "Setup Mode" it is put back in "Joystick Mode".

After trial and error I got to a point where everything seems to be working except when I try to upload new code I get these errors:
error sending reboot command (HID)
Teensy did not respond to a USB-based request to enter program mode.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.


Not a big issue because I just press the program button and it uploads the code but being that I don't like things half working, I thought I would ask if the following code is adequate.

I suspect the culprit is: #define BCD_DEVICE 0x0211 and teensy loader is looking for the HID which is not defined instead of trying to upload via com port. Am I on the right track?

This is what put in usb_desc.h

Code:
  #elif defined(USB_JOY_SERIAL)
  #define VENDOR_ID		0x16C0
  #define PRODUCT_ID		0x0488
  #define BCD_DEVICE		0x0211
  #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN	11
  #define PRODUCT_NAME		{'J','o','y',' ','S','e','r','i','a','l'}
  #define PRODUCT_NAME_LEN	10
  #define EP0_SIZE		64
  #define NUM_ENDPOINTS		4
  #define NUM_USB_BUFFERS	30
  #define NUM_INTERFACE		3
  #define JOYSTICK_INTERFACE    2	// Joystick
  #define JOYSTICK_ENDPOINT     4
  #define JOYSTICK_SIZE         12	//  12 = normal, 64 = extreme joystick
  #define JOYSTICK_INTERVAL     1
  #define CDC_IAD_DESCRIPTOR	1
  #define CDC_STATUS_INTERFACE	0
  #define CDC_DATA_INTERFACE	1	// Serial
  #define CDC_ACM_ENDPOINT	1
  #define CDC_RX_ENDPOINT       2
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE           64
  #define CDC_TX_SIZE           64
  #define ENDPOINT1_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
  #define ENDPOINT3_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT4_CONFIG	ENDPOINT_TRANSMIT_ONLY

Many thanks,
E.
 
Actually

CPU_REBOOT ;

doesn't seem to work if I use this descriptor so I would really need to find a solution.

Any help will be appreciated.

Cheers,
e.
 
Status
Not open for further replies.
Back
Top