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.

Does USBHCDPipeSchedule() allow multiple buffers to be prepared?

Other Parts Discussed in Thread: EK-TM4C1294XL

Some operating  systems (OSX) allow multiple buffers to be scheduled for isochronous transfers in order to sustain high bandwidths with low latency. I'm having some trouble achieving maintained bandwidth on the TM4C, and one thing I've tried is to call USBHCDPipeSchedule() multiple times with different buffer addresses to allow the USB system plenty of space to accumulate incoming data. However, there is no documentation to clarify whether the USB API allows only a single call to USBHCDPipeSchedule() - until the callback notifies that the buffer has been filled - or if multiple calls can queue multiple buffers in advance. If the latter, there is no documentation of how many buffers can be queued before the USB API runs out of storage to remember the separate buffer addresses. In the extreme case, dynamic memory allocation for buffer pointer storage would be needed, but that sort of implementation would obviously run the risk of added latency compared to a fixed allocation limit.

Are there any more detailed specification and documentation of the TivaWare USB Library other than SPMU297A?

I'm a bit spoiled by the TMS320VC55xx family, where the USB hardware is separately documented, and the USB software comes with full source. In that environment, all questions are more readily answered.

  • Hello Brian

    USBHCDPipeSchedule does not queue. It puts the data to the buffer and enables the transmission. If you wish to use continuous transfer you would need to use the DMA mode.
    The USB Library is not well documented for TM4C, but work is being done to make it more usable.

    Regards
    Amit
  • These endpoints are Isochronous IN endpoints. So there is no data yet, just pointers to buffers for holding the incoming data. I assume from your answer that there's no provision for multiple pointers.

    Is there support in the TivaWave USB Library for DMA from Isochronous IN endpoints? If so, I would obviously need to try that out to maintain the ~750 KB/s bandwidth.

    My apologies: I did not fully explain my situation.
  • Hello Brian,

    Yes, DMA is supported for Isochronous endpoints

    Regards
    Amit
  • It appears that only one uDMA buffer can be prepared at a time for a given Isochronous IN endpoint. Thus, the timing seems very critical, in that subsequent uDMA buffers must be quickly set before the next USB frame occurs if continuous bandwidth requires the endpoint to transfer in every frame.

    Is there any provision for ping-pong buffering, so that uDMA could be working on one buffer while the next is being set up?

    Alternatively, is there any hardware support for continuous uDMA and the equivalent of automatic MAP_USBHostRequestIN() calls to keep the process going?

    Pardon my question, since I suppose it's possible that the callbacks can be quick enough to keep Full Speed bandwidth going. Are there any examples of high-bandwidth isochronous IN throughput?
  • Hello Brian

    uDMA supports Ping-Pong buffers and need to be setup accordingly in the usbdma.c

    Regards
    Amit
  • Is there any example code for this? uDMA Ping-Pong buffering?

    I have started my project based on the usb_host_audio_in example, since that seems closest to my (non-audio) isochronous device. Thanks to today's answers, I've looked through the usblib sources and see that usb_host_audio_in is using USBHCD_PIPE_ISOC_IN_DMA when allocating the pipes to enable uDMA, ISOCH, IN features. I'm just not clear on whether this code takes advantage of uDMA ping-pong or not.

    Thanks.
  • Hello Brian,

    There is an example code for PING PONG Buffer (not with USB though) in TivaWare under "examples\boards\ek-tm4c1294xl\udma_demo"

    Regards
    Amit
  • Thank you. I should be able to piece together working code from the available examples.
  • I notice that uDMA also supports Memory Scatter-Gather transfer mode. When I was scheduling multiple ISOCH IN endpoint buffers, I was hoping that the TivaWare USB Library would use something like Memory Scatter-Gather to track all of the memory addresses and fill them sequentially. As I develop my firmware, I'll see if this uDMA transfer mode can be used for Isochronous IN endpoints.
  • Hello Brian

    Scatter Gather is somewhat more complex than Ping Pong. So, I would suggest Ping Pong first before Scatter Gather

    Regards
    Amit