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.

mistake in DK-TM4C129X OTG sample code?

I have been trying to get USB OTG working on my DK-TM4C129X dev kit, and found what looks like a mistake in the sample code. Starting at line 252 of usb_otg_mouse.c (in the main() function) there is the following code:

    // Initialize the USB controller for dual mode operation with a 2ms polling
    // rate.
    //
    USBOTGModeInit(0, 2000, g_pui8HCDPool, HCD_MEMORY_SIZE);

The description for the second parameter of the USBOTGModeInit() function in the USBLIB UG states that the value is supposed to be in ms. Yet the function is being called with a value of 2000 rather than 2, which would be needed to match the comment that says it is being set up for 2 ms polling.


Seems like the comment should either say you are initializing the controller for 2 seconds polling, or the parameter should be changed to 2.

Regards,

Dave

  • I tried different values for the polling rate parameter, and found that if I used 2, 20 or 100 the code would not detect plugging/unplugging the USB cable. When I tried 200 it seemed to work okay.

    So it appears the intent of the example code was to do 2 second polling, not 2 ms. It would be nice if the user guide gave some suggestions as to what a reasonable value would be.
  • Hello Dave,

    I agree it is misleading. The value is described ms and the usage is in seconds.

    Regards
    Amit