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.

starterware usb device example (usb_dev_serial)



Hi, can you please explain the significance of the function call to DelayTimerSetup() found in the "main" function in the file usb_dev_serial.c. The usb_dev_serial example runs fine however i'm trying do understand enough to port it to production software. I dug enought to know that the function call instanciates a timer, however, I can't find the need for this timer, and if the DelayTimerSetup() function is not called, the usb functionality does not work. Any info would be helpful..Thanks....

  • Dig just a bit deeper. The call to DelayTimerSetup() allows Sysdelay() to be called later. That function is called during device enumeration, ie.

    USBDCDCInit() -> USBDCDInit() -> delay() ->Sysdelay()

  • Hi MotoPauld,

    I have some generic suggestions to narrow down our understanding of the significance of DelayTimerSetup() in main(). You can try it out if needed.

    1. Having said that the usb functionality gets affected when the function DelayTimerSetup() is not called, the first question arises in our mind is that a. Whether the timer2 setups are associated with USB communication. Whether those functions are called just for introducing the delays or it is not just the delay but also some configuration settings with Interrupt controller(INTC) needed for ( USB ) peripheral operation.

    2. Calculate the time taken to execute the DelayTimerSetup() function. Introduce a normal delay function using a counter loop equivalent to it. If the USB functions properly, then we will know that it just expects a delay between the "ConfigureIntUSB()" and other function calls. Else we can dig in a direction, whether those timers are associated with any configuration like ENDpoint timeout interval / NAK timeout/ Polling interval e.t.c., ( Most probably this may not be case. It might be just a delay)

     

    Regards,

    Shankari

     

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------