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.

TM4C1231H6PM: USB bulk endpoints data transfer speed.

Part Number: TM4C1231H6PM

Hi everyone,

I am new to USB development and for some time now I am trying to make USB bulk communication to achieve 4 Mbyte/sec data transfer between the microcontroller and PC. I have made the communication bridge and was successful to pass data through USB by making a handle (bulk transfer with lib-USB). For the hardware side, I used the demo bulk echo code. In the demo code, it passes data by only one out and one in endpoint (BULK), my question is-

1. Is it sufficient to have just one pair of a bulk endpoint to transfer 4~8 Mbytes of data (considering it's a high-speed USB 2.0 device)?

2. The data buffer is defined as it seems to 255. Is it changeable to 512 bytes? How?

3. What is the use of having many endpoints?

Thank you.

6138.usb_dev_bulk.zip

  • Hello Arindam,

    Are you using USB High Speed mode? If not, you won't get 4Mbyte/sec data transfer. USB Full Speed is capped at 12 Mbit/sec which is 1.5MByte/sec.

    I haven't tried changing the data buffer size, but it looks changeable as the tUSBBuffer structure has the buffer size variable configured as a uint32_t so that would indicate that the USBlib should be able to handle larger buffers. But that won't resolve the speed issue from point 1.

    Regarding question 3: That isn't really device specific so I would recommend reading up on USB. One of the most useful resources I know of is: www.beyondlogic.org/.../usb3.shtml

  • TM4C chips support both USB Host and USB Device modes, as well as OTG. So, step one is to determine whether you're writing Device, Host, or OTG firmware. I assume from your message that the PC is the Host and your uC is the Device, but I suppose it's possible that you may want an OTG feature set. An unfortunate side-effect of the USB standard is that your device is at the mercy of the host drivers - if the PC does not schedule enough Bulk transfers then you will not meet your bandwidth requirements.

    One thing to consider is that if your application actually requires a steady stream at 4 MB/s then you should be using USB Isochronous endpoints and not USB Bulk endpoints. The USB Specification is designed to provide either a guarantee of uncorrupted data delivery by using Bulk, which will retry transmissions until successful but without a bandwidth guarantee -or- a guarantee of data bandwidth by using Isochronous, which forces the Host to schedule sufficient packets to meet the bandwidth but without any chance to retransmit the data in the unlikely event of a bus error. USB does not allow a guarantee of both bandwidth and data integrity. You must choose one or the other and adapt.

    While Ralph recommends a third-party resource, I tend to recommend the official USB Specifications. They're free at USB.org, and they represent the definitive standard. The documentation can be daunting, but it's required reading if you want to produce a professional product. There are far too many open-source projects from "makers" which technically misuse the USB standard, although it seems that consumers of these amateur products are willing to accept incomplete performance. If you want to avoid inconsistent results from one system to another, then I recommend becoming familiar with the official USB Specifications. There's nothing wrong with supplementing this resource with third-party documents like the ones Ralph suggested, but I suggest staying away from random open-source projects as examples, simply because they may not be using USB correctly. There are actually a few very popular USB Devices on the market which have performance problems because they do not use USB Isochronous endpoints to guarantee bandwidth.

  • Note that once you become familiar with the USB Specifications, you will find out the exact limits of what can be supported by each speed and endpoint type. Given the limitations of USB, I have found that the Texas Instruments usblib is capable of being configured for anything that is legal within the USB Spec.

    In other words, first find out what USB supports that will meet your needs, then figure out how to adapt the TI usblib to implement those specific parameters.
  • Hi Brian,

    Thanks for adding your valuable inputs!

    I suggested the third party site as it simplifies the explanations and is good for those new to USB development. I do agree that the specifications are important to understand as well. I think the beyondlogic site helps lay a foundation which makes the specs a bit easier to digest in my opinion, which is why I lead with recommending that.

    Hi Arindam,

    Also while posting I now realize I missed the comment of 'considering it's a high-speed USB 2.0 device' from your post... you can disregard my first question in that case. Though if you are using high-speed mode you need update a couple files from TivaWare USBlib as there were issues identified for high speed. Please see this post to get the latest files: e2e.ti.com/.../2543999
  • Hello Ralph,

    Thank you for your suggestions. I started practicing code on TM4C123GXL launchpad but it supports up to full-speed USB 2.0. I have another TM4c129GXl which support USB 2.0 high speed. That's why I mentioned considering it's a high speed :). Moreover, as far I have read data frame rate for high speed usb 2.0 bus is upto 8 frames(bulk)/microframe  from here. Now as the example code is documented in TIVA c series usb_bulk_example there are one endpoint out and one endpoint in that's why I was thinking do I need more than one pair of endpoints to get to that speed or not. If so I couldn't find an easy way to configure the endpoints in the code as it has numerous libraries included. I am searching for an easy way to configure endpoints such as PSoc has endpoint configuration tools and also MSP430 boards has.

    Thank you so much for helping.

  • Hello Arindam,

    On the topic of devices, you would need to use a TM4C129x device to be able to do High Speed mode. The TM4C123x devices don't support that (also, for the record, the device you picked for your post title doesn't have USB at all...)

    Also Brian mentioned using Isochronous endpoints over bulk would be better and I would agree with him, although I think we don't really have any examples for that.

    Also for High Speed, I would recommend you look at the software for High Speed covered here: http://www.ti.com/tool/TIDM-TM4C129USBHS

  • Hello Brian,
    I needed data integrity that's why I selected bulk over Isochronous transfer. I am searching a way to configure the endpoints and also figuring out if I need many endpoints to get to that speed. I think reading USB specification might help.
    Thank you for your suggestion. :)
  • Hello Ralph,
    I think the Tiva C seris launchpad has native USB support. Your suggestion regarding TM4c129 is good. I am also figuring how to configure enpoints according to my need in CCS. If you could mention than it would be helpfull.

    Thanks.
  • Ralph Jacobi said:
    ... using Isochronous endpoints over bulk would be better and I would agree ..., although I think we don't really have any examples for that.

    There are examples for usb_host_audio and usb_host_audio_in, but I don't see any usb_dev_audio examples. You can probably glean how to use the isochronous API from the host examples, although the directions would be reversed for IN and OUT. However, since you need the data integrity of Bulk, you can probably skip Isochronous. Besides, although Apple makes it trivial to support USB Isochronous from user applications, Windows pretty much requires driver development (or the very latest OS releases).