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.

USB NAK callback?

Greetings,

We are looking for a way to configure the Starterware USB stack to generate an interrupt and issue a callback when the host reads a bulk pipe and there is no data.

It appears that the transaction is NAKed for 5 or 6 seconds, then a STALL is issued.  The only interrupt I see for this is when the host sends a clear stall request.

All I have been able to find thus far is USBEndpointStatus() with which I could hopefully poll for USB_DEV_IN_UNDERRUN, then fill my outbound FIFO.

Any thoughts?

Gerry Belanger

  • Hi Gerard,

     The best way would be to use the TX complete interrupt to load the next packet. I guess you would be receiving this now. Another way would be to configure the controller for SENTSTALL interrupt and use the handler for loading the FIFO. By the way are you using the CPPI DMA or PIO mode for transfer.  

  • Vineeth,

    We are using this IN endpoint to send status to the host, which asks for it every 5 seconds or so.  So if I preload it, it is 5 seconds stale.

    I did not find a setting in USBDevEndpointConfigSet() to set a SENTSTALL interrupt.  Or am I looking in the wrong place in the API? 

    The STALL occurs 5-6 seconds after the initial IN, so that does not help anyway.  It would be better if we could receive TX underrun interrupt, then stuff the FIFO.

    We had that feature in the platform this project is replacing.

    From the flags being passed to USBDevEndpointConfigSet(), it looks like no DMA, so PIO. 

    At least I do not have to worry about keeping cache/memory coherency for the USB. Yet.

    Gerry Belanger

  • I found a better solution than polling for underrun.  The answer for http://e2e.ti.com/support/embedded/starterware/f/790/t/188951.aspx

    is what I was looking for.  An explanation for how to hook a callback to the IN interrupt.

    I will eventually implement that.

    Gerry Belanger