This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C5509A/CSL : multiple endpoints for USB HID

Hi,

I've successfully set up code for transferring HID reports on one interrupt IN endpoint. But when I try to transfer additional data on an additional endpoint I don't see any bytes being transferred on the additional endpoint. Is this a problem with USB_postTransaction from CSL, or with my setup or even with the CSL for USB? Could anyone help me please?

I analyse USB using USBlyzer. Enumeration is successful and the USB status I see in USBlyzer is resumed here:

Connection Status Device connected
Current Configuration 1
Speed Full
Device Address 2
Number Of Open Pipes 4

Offset Field Size Value Description
0 bLength 1 12h
1 bDescriptorType 1 01h Device
2 bcdUSB 2 0200h USB Spec 2.0
4 bDeviceClass 1 00h Class info in Ifc Descriptors
5 bDeviceSubClass 1 00h
6 bDeviceProtocol 1 00h
7 bMaxPacketSize0 1 40h 64 bytes
8 idVendor 2 0451h Texas Instruments, Inc.
10 idProduct 2 9000h
12 bcdDevice 2 0110h 1.10
14 iManufacturer 1 01h ""
15 iProduct 1 02h ""
16 iSerialNumber 1 00h
17 bNumConfigurations 1 01h
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 02h Configuration
2 wTotalLength 2 0037h
4 bNumInterfaces 1 01h
5 bConfigurationValue 1 01h
6 iConfiguration 1 03h ""
7 bmAttributes 1 E0h Self Powered, Remote Wakeup

4..0: Reserved
...00000 

5: Remote Wakeup
..1.....  Yes

6: Self Powered
.1......  Yes

7: Reserved (set to one)
(bus-powered for 1.0)

1....... 
8 bMaxPower 1 00h 0 mA
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 04h Interface
2 bInterfaceNumber 1 00h
3 bAlternateSetting 1 00h
4 bNumEndpoints 1 04h
5 bInterfaceClass 1 03h HID
6 bInterfaceSubClass 1 00h
7 bInterfaceProtocol 1 00h
8 iInterface 1 04h ""
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 21h HID
2 bcdHID 2 0110h 1.10
4 bCountryCode 1 00h
5 bNumDescriptors 1 01h
6 bDescriptorType 1 22h Report
7 wDescriptorLength 2 0065h 101 bytes
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 01h 1 Out
3 bmAttributes 1 03h Interrupt

1..0: Transfer Type
......11  Interrupt

7..2: Reserved
000000.. 
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 01h 1 ms
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 81h 1 In
3 bmAttributes 1 03h Interrupt

1..0: Transfer Type
......11  Interrupt

7..2: Reserved
000000.. 
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 01h 1 ms
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 02h 2 Out
3 bmAttributes 1 03h Interrupt

1..0: Transfer Type
......11  Interrupt

7..2: Reserved
000000.. 
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 01h 1 ms
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 82h 2 In
3 bmAttributes 1 03h Interrupt

1..0: Transfer Type
......11  Interrupt

7..2: Reserved
000000.. 
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 01h 1 ms

 

I put some code snippets here :

// EP objects
extern USB_EpObj   usbEpObjOut0, usbEpObjIn0;   // Control Endpoint Objects
USB_EpObj          usbEpObjOut1, usbEpObjIn1;   // Interrupt EP1_IN,EP1_OUT
USB_EpObj          usbEpObjOut2, usbEpObjIn2;   // Interrupt EP2_IN,EP2_OUT

// USB configuration
USB_EpHandle  myUsbConfig[] = {    &usbEpObjOut0, &usbEpObjIn0,
                                &usbEpObjOut1, &usbEpObjIn1,
                                &usbEpObjOut2, &usbEpObjIn2,
                                NULL};

// init endpoint 2 objects - interrupt mode, endpoint size 64 byte
  // dispatch end of transfer and USB reset event to endpoint object
  usb_status = USB_initEndptObj(USB0, &usbEpObjOut1, USB_OUT_EP1, USB_INTR,
                                0x40, USB_EVENT_EOT|USB_EVENT_RESET,USB_ep1_intrOutEvHandler);
  // dispatch end of transfer and USB reset events to endpoint object                             
  usb_status = USB_initEndptObj(USB0, &usbEpObjIn1, USB_IN_EP1, USB_INTR,
                                  0x40, USB_EVENT_EOT,USB_ep1_intrInEvHandler);
  // init endpoint 2 objects - interrupt mode, endpoint size 64 byte
  // dispatch end of transfer and USB reset event to endpoint object
  usb_status = USB_initEndptObj(USB0, &usbEpObjOut2, USB_OUT_EP2, USB_INTR,
                                0x40, USB_EVENT_EOT|USB_EVENT_RESET,USB_ep2_intrOutEvHandler);
  // dispatch end of transfer and USB reset events to endpoint object                             
  usb_status = USB_initEndptObj(USB0, &usbEpObjIn2, USB_IN_EP2, USB_INTR,
                                  0x40, USB_EVENT_EOT,USB_ep2_intrInEvHandler);

// report buffers
Uint16 report3[] = { 0x0000,0x0000, 0x0000, 0x0000 };
Uint16 report2[] = { 0x0000,0x0000, 0x0000, 0x0000 };
Uint16 report1[] = { 0x0000,0x0000, 0x0000, 0x0000 };
Uint16 report0[] = { 0x0000,0x0000, 0x0000, 0x0000 };

// report structs
USB_DataStruct report3_link = { 6,(Uint16 *)&report3[0],NULL };
USB_DataStruct report2_link = { 6,(Uint16 *)&report2[0],&report3_link };
USB_DataStruct report1_link = { 6,(Uint16 *)&report1[0],NULL };
USB_DataStruct report0_link = { 6,(Uint16 *)&report0[0],&report1_link };

// send reports on EP1
USB_postTransaction(&usbEpObjIn1, 12, &report0_link, USB_IOFLAG_LNK);
// send reports on EP2
USB_postTransaction(&usbEpObjIn2, 12, &report2_link, USB_IOFLAG_LNK);

 

The strange thing is that I have successful communication on usbEpObjIn1 but nothing on usbEpObjIn2. When I remove usbEpObjIn1 from my program (including descriptors etc.) I have successful communication on usbEpObjIn2. I don't get it.

I appreciate any help.

Thank you,

Andreas

 

  • I can only provide a partial answer: I am using the VC5506 and DSK5509A with CSL, and I have been able to get 3 endpoints working at the same time.  EP0 is control IN and OUT, EP1 is isochronous IN and EP2 is isochronous IN.

    Granted, I am not developing an HID Class USB Device, but I imagine that dual 386-byte isochronous transfers in every 1 ms Full Speed frame should be much more taxing on the system than HID.

    I assume that either your Descriptors are wrong in some minor aspect (sorry, I did not have time to review your data), your setup of the USB CSL is incorrect, or your runtime implementation of the USB callbacks is incorrect.  It's also possible that there is no driver on the USB Host that is prepared to read interrupt IN data from your second endpoint.  Basically, a lot of your situation may be highly specific to your application, so it's hard to know whether your problems have anything at all to do with the C5509A, your USB design, or something on the USB Host.

    It's not clear from your code snippets whether you're trying to call USB_postTransaction() in linear sequence, or if the calls are within your USB_epX_intrInEvHandler() functions.  I believe that you have to prime the interrupt and then keep it fed asynchronously.

    For starters, I would suggest that you obtain a good USB Descriptor parsing utility, such as Apple's superior Mac OS X "USB Prober.app" or the Windows USBView.exe utility (which is less comprehensive).  I find such tools will tell whether the basic Descriptors are on the right track or unintelligible.

    Brian Willoughby

    Sound Consulting