2024-03-08 07:59 AM
What is the fastest way to transfer data from an MCU to a PC?
I have an stm32h723zg that I want to use to transfer 40Mbits/sec data to a PC, but I am not sure what is the way to achieve this I tried USB CDC but got only 0.5Mbits/sec due to the limitation of the serial terminal
I am thinking I can use a QSPI to USB FTDI chip or ethernet which would be better? or what is the best way to do this?
has anyone been able to reach this data rate before?
2024-03-08 08:12 AM
(HS) USB CDC can get you to several hundred Mbps, provided your software on the other end polls the port fast enough. USB MSC likely also the same. Ethernet can also get you well over 40 Mbps.
USB FS CDC will top out around 8 Mbps or so.
2024-03-08 01:48 PM - edited 2024-03-08 05:40 PM
USB CDC HS would definitely not reach 40Mbits/s easily. I'm looking at it for two evenings now ;)
I identified the following annoyances:
Edit: following TDK advice, I made this very simple example with the unmodified CDC driver, see toto2. Speed is 317Mbits/s when the STM32H747 do only write. (for some reason, it work only in debug)
As a side note. I just noticed you are using a nucleo, so it has no external HS PHY like on some discovery. In this case you are doomed in term of speed. I possess a H735 disco too which is about the same MCU, but it only has FS.
Best regards.
2024-03-08 03:30 PM
> USB CDC HS would definitely not reach 40Mbits/s easily. I'm looking at it for two evenings now
I'm not speaking theoretically. I've done it. Note that you need HS, which typically requires an external PHY. It will take some careful/mindful coding on both sides. Typical serial port programs like PUTTY are not designed to handle 40 Mbps throughput.
> The CDC HS driver by ST use an endpoint max packet size of 512bytes. Compared to an ETH jumbo packet of 9k, this is really small.
True, but this is a USB restriction/decision, not something ST has chosen.
> The CDC mode is mainly to send text (ie printable data) to a terminal. Hence on a PC, the baudrates are standardized. On my Windows 11 that is max 128kbits/s.
The baud rate on USB CDC has nothing to do with the rate of data transmission on the line. It's kept to support the serial port protocol which sets/retrieves these settings.