7 Replies Latest reply on Aug 9, 2019 7:00 AM by BoTa_264741

    USB UART data transfer speed Cortex-M3


      Hello all,


      I have a device that reads data from a sensor slowly (300 Bytes/s) and once a full measurement is done, the data is sent to a computer via USB/virtual COM port. The device currently has a 16MiB Flash memory (MX25L12835F), however, in the future I want to replace that with a 2GiB flash memory chip.


      For the processor, I'm using the Cypress ARM® Cortex®-M3 CY8c5866LTI-LP022. Using a virtual COM port, it communicates via a USB cable to the computer.

      Once the measurement is done, I read the data from the device and store it on the computer. However... reading 16MiB data takes about 6-8 minutes


      If I upgrade that to 2GiB, and read that all, it would take me... hours...


      So, couple of questions:


      - Why is the reading so slow? (changing Baudrate on the software on the PC doesn't make a difference)

      - Does it has to do with the 64Byte read/write buffer on the M3?

      - Or could it be due to inefficiently written firmware? (I don't have access to the source, but can ask for changes)

      - What could I do to improve this drastically, e.g. if I use a different chip PSoC 6?, would this be far better?


      Thank you,


        • 1. Re: USB UART data transfer speed Cortex-M3

          The USBUART uses Bulk Transfer to transfer data.  If one 64Byte packet is sent in a 1ms USB frame, the transfer speed will be 64000B/s  which is 22MiB/6min  The transfer speed 16MiB/6min is not so bad.


          If you want to improve the transfer speed, please consider to use a FIFO.  The original USBUART component has no FIFO implementation. So, I have created a project ti implement a FIFO to the USBUART.  Please refer following my github repository.


          GitHub - noritan/Design307: FIFO Implementation for USBUART for BLOG - "CY8C5888LTI-LP097" on "CY8CKIT-059"


          Please note that all comments are written in Japanese.

          You can increase the transfer speed by increase the periodic interrupt frequency.




          2 of 2 people found this helpful
          • 2. Re: USB UART data transfer speed Cortex-M3

            Domo arigato!


            That is however as far as my Japanese goes. Luckily there are translating machines!


            I've done the calculation, my current speed is ±43880 B/s (and is very consistent). Do note, it doesn't matter if I use the Cypress driver or the Windows 10 driver, both give the exact same speed.


            With regard to your answer:

            - FIFO, I assume it means "First In First Out"?

            - What kind of speed improvements could I expect? Is it a few seconds on a minute? or are we talking about big improvements?

            - Using your code, will the limit still be with the buffer size, or would it be limited by e.g. the processor's speed?


            Given that for the next design I can pick any chip, e.g. PSoC 63/64. Would this allow me to have much higher transfer speeds? (or better: what should I look for?)


            Thank you!


            • 3. Re: USB UART data transfer speed Cortex-M3


              once you upgrade to 2GB SD card, the fastest way to read data from the card will be to plug it directly into the computer slot. Even at fastest serial transfer rate ~1Mbd (approx 0.1 MB/sec), reading 6MB will take one minute, and 2GB card - forever...


              • 4. Re: USB UART data transfer speed Cortex-M3

                As you assumed, FIFO is "First-In First Out" or "Queue Buffer"


                I have measured the transfer speed with the TXFIFO project for several periodic interrupt frequency as follows.

                Interrupt Frequency (kHz)Transfer Speed (kiB/s)Time to send 16MiB (sec)

                Please note that this measurement result including the display time of the Tera Term application.

                If the interrupt frequency is increased to 10kHz, it was observed some packets are dropped due to the FIFO implementation.  So I think that 6.0kHz or 8.0kHz is the reasonable frequency.


                I am using a single 64Byte buffer in the implementation.  If multiple buffers are used for the FIFO the transfer speed may increased more.  Please do it yourself if you want.

                1 of 1 people found this helpful
                • 5. Re: USB UART data transfer speed Cortex-M3

                  Thank you once again! That shows quite an improvement for a relative simple implementation. I'll go and try the FIFO method myself!

                  • 6. Re: USB UART data transfer speed Cortex-M3

                    Thank you for your reply odissey1.

                    Using a removable storage won't be possible, due to the size requirements, usability and design of the case

                    However, serial port communication is not a requirement at all...


                    I'm brainstorming about a fully new design for the PCB. A couple of things are sure: it will have a USB type-C connector (not saying it supports USB 3...) and at least 2GiB storage. The PCB will be about 3.5cm by 3cm, one side can be fully chipped, while the other side contains a small screen (27mm x 21mm) and the remaining space can be used. More than enough space I would think. It all runs on a small 3.7V 600-700mAh battery.


                    The device needs to record data (using a sensor connected to the USB port), and once it is full/done/battery empty, I need to read all data to the PC.


                    If I plug in a USB 3 USB-stick, it allows me to download files with up to 5gb/s.

                    What do I need to make that happen? (i.e. allot faster than now, not necessarily 5gb/s).



                    - do I need special hardware, or is this possible with e.g. de PSoC 63/64 chip?

                    can you point me in a direction to search for?


                    Best regards,




                    After reading https://www.electronicdesign.com/boards/how-create-and-program-usb-devices#1 I figured I need a bulk endpoint OUT and a Control endpoint IN on the device. I guess there should be native drivers that can be used for that. Leaving the question what kind of hardware I need.

                    • 7. Re: USB UART data transfer speed Cortex-M3


                      I recollect a paper, where author needed 2x 12-bit ADC_SAR sustainable transfer to USB at 1Ms/sec each (4MB/sec total).using PSoC5. The solution was to use 2xSPI-to-USB external chip. PSoC5 provided 2x SPI outputs.



                      PS. This tutorial video about PSoC5 USB bulk transfer might be helpful

                      libusb and freeSoC Tutorial. Bidirectional BULK USB Transfers from PSoC to Computer on Vimeo