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.

TM4C1294NCPDT: how Tivaware USB host HUB enumerates downstream devices ?

Part Number: TM4C1294NCPDT

Hi TI,

I am trying to port Tivaware USB host HUB to beaglebone black, basically just reworking on StarterWare, following Tivaware example project.

The most confused me is how usbhostenum.c finds downstream devices.

Here is my observation,

1. The below 3 functions in usbhostenum.c seem not be called by any other function/program. There is no effect after I commented it out and rebuild the example project.

GetEventFlag(uint32_t ui32Event),

USBHCDEventEnable(uint32_t ui32Index, void *pvEventDriver, uint32_t ui32Event)

USBHCDEventDisable(uint32_t ui32Index, void *pvEventDriver, uint32_t ui32Event)

2. main function constantly calls USBHCDMain(void), and further calls USBHHubMain() from inside USBHCDMain(void);

after hub successfully opened, g_sUSBHCD.piDeviceState[DEV_NUM] still stay at eHCDIdle (in USBHCDMain at usbhostenum.c), while g_sRootHub.psPorts[ui8Port].iState suddently (in USBHHubMain() at usbhhub.c) change from ePortIdle to ePortConnected, then downstream devices got enumerated, and finally g_sUSBHCD.piDeviceState[DEV_NUM] become eHCDDevConfigured .

What I do not understand is how g_sRootHub.psPorts[ui8Port].iState become ePortConnected.

3. HubIntINCallback() in usbhhub.c has case USB_EVENT_RX_AVAILABLE: and case USB_EVENT_SCHEDULER:

it reads back g_ulHubChanges, which further be assigned to g_ulChangeFlags, and indicates DEV_NUM locations, i.e., 2,4,8,16 for my tests. (0 has been occupied by HUB controller), which indicates finding downstream devices at psPorts location 1~4.

for some reason, in my porting codes, case USB_EVENT_SCHEDULER always return g_ulHubChanges=0; I am not sure whether my porting codes are bugged, or USBHCDPipeSchedule actually receives 0 value. 

 

Wish TI experts can elaborate more detail. Thanks in advance.

Mike

 

  • Hello Michael,

    We aren't really in position to support porting TivaWare USB library to BeagleBone, but when I return to the office on Monday I can try and look into a few of your specific queries on the library. While I am the USB 'expert' for the team, I was not the one who wrote the USB stack so I may not be able to answer all the questions.
  • Hi Ralph Jacobi,

    Thank you for the quick reply, and looking forward of your seasoned guidance.

    Best

    Mike

  • Hello Michael,

    Regarding ePortConnected,

    It looks like that is set by the API HubDriverDeviceConnect which is called within USBHHubMain when the status check for HUB_PORT_STATUS_DEVICE_PRESENT passes.

    Regarding g_ulHubChanges,

    I think the only way to know for sure would be to monitor the USB bus and see for yourself what is being sent.

    My understanding is that before porting, it returned non-zero values, and now it only returns 0? If so, I'd be concerned that an issue is there.
  • Hi Ralph Jacobi,

    Thank you for the suggestions.

    I gave up the rework on StarterWare usblib. Instead, following the previous post ///e2e.ti.com/.../439277 who ported Tivaware usblib to StarterWare project, though still missing DMA (MSC requests DMA to write/read data, while Tivaware'uDMA not available in StarterWare)

    I successfully inserted StarterWare DMA into the Tivaware usblib.

    Now everything is working well.

    Thank you for the support.

    Best

    Mike