USB speed test

srjasz
Posts: 46
Joined: Wed Apr 03, 2024 4:29 pm

USB speed test

Postby srjasz » Tue Sep 10, 2024 6:38 pm

Just sharing the results of my USB speed tests. I am using s3 at 160Mhz. I found that the fastest speed possible was about 500K Bytes per second. That's in the area that I have been seeing form other peoples posts. To get that speed the RTOS spends about 40% of its time running the USB code, so not enough left for my particular application, maybe enough for yours. 100K Bytes per second was where the USB code started to have an impact on how much processing time was left for other things. I would say a good Rule Of Thumb would be, if your going faster than 100K Bytes per second, keep an eye on how much time is spent doing the USB. If you are thinking "the spec says it can go to 12Mbps" no, it can't.

Enjoy

MicroController
Posts: 1605
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: USB speed test

Postby MicroController » Tue Sep 10, 2024 8:00 pm

What happens when you run the CPU at its full 240MHz?

chegewara
Posts: 2332
Joined: Wed Jun 14, 2017 9:00 pm

Re: USB speed test

Postby chegewara » Tue Sep 10, 2024 8:10 pm

https://community.st.com/t5/mems-sensor ... d-p/523996

Now you have to add flash read/write operations time, which is another overhead.
Couple years ago I performed USB MSC tests on S3, you can find results somewhere on the forum.

As far as I remember the read speed could reach even 900kB/s.

I am suggesting using 240MHz clock, which seems to have nice boost on DMA operations.

srjasz
Posts: 46
Joined: Wed Apr 03, 2024 4:29 pm

Re: USB speed test

Postby srjasz » Wed Sep 11, 2024 2:04 pm

I should have mentioned that this was transmitting only. The product I am designing will be transmitting continuous sensor data which is the critical path. It will only be receiving a small amount of configuration data at initialization so no simultaneous transmit and receive.

I should have also mentioned I am using CDC_ACM.

chegewara
Posts: 2332
Joined: Wed Jun 14, 2017 9:00 pm

Re: USB speed test

Postby chegewara » Wed Sep 11, 2024 11:02 pm

https://developerhelp.microchip.com/xwi ... ull-speed/
In theory CDC ACM should reach transfer around 1MB/s, not sure if esp32 can reach such transfer speed, but it only theory.

To get highest throughput you have to make sure that:
- esp32 is sending data in tight loop without congestion
- your client app on PC can transfer data that fast

So, can you confirm somehow your client/test app can go that fast?

srjasz
Posts: 46
Joined: Wed Apr 03, 2024 4:29 pm

Re: USB speed test

Postby srjasz » Fri Sep 13, 2024 1:58 pm

The only thing the ESP32 was doing was sending USB, so yes, it was a very tight loop.

The PC application that was doing the receiving was written by my colleague. He has a lot of experience with USB communication, especially in high speed industrial control applications. We were able to verify that the application was indeed fast enough.

chegewara
Posts: 2332
Joined: Wed Jun 14, 2017 9:00 pm

Re: USB speed test

Postby chegewara » Wed Oct 02, 2024 4:07 am

I dont have good tools to make performance test on CDC-ACM yet, but this test should be good enough.
It is CDC-NCM doing iperf test from linux PC, DUT is this devkit
https://docs.espressif.com/projects/esp ... guide.html
results

Code: Select all

------------------------------------------------------------
Client connecting to 192.168.4.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.4.2 port 40978 connected with 192.168.4.1 port 5001 (icwnd/mss/irtt=14/1440/0)
[ ID] Interval       Transfer     Bandwidth
[  1] 0.0000-3.0000 sec  2.12 MBytes  5.94 Mbits/sec
[  1] 3.0000-6.0000 sec  2.25 MBytes  6.29 Mbits/sec
[  1] 6.0000-9.0000 sec  2.12 MBytes  5.94 Mbits/sec
[  1] 9.0000-12.0000 sec  2.25 MBytes  6.29 Mbits/sec
[  1] 12.0000-15.0000 sec  2.12 MBytes  5.94 Mbits/sec
[  1] 15.0000-18.0000 sec  2.25 MBytes  6.29 Mbits/sec
[  1] 18.0000-21.0000 sec  2.12 MBytes  5.94 Mbits/sec
[  1] 21.0000-24.0000 sec  2.25 MBytes  6.29 Mbits/sec
[  1] 24.0000-27.0000 sec  2.25 MBytes  6.29 Mbits/sec
write failed: Broken pipe
shutdown failed: Transport endpoint is not connected
[  1] 27.0000-30.0000 sec  2.37 MBytes  6.64 Mbits/sec
[  1] 0.0000-30.0066 sec  22.3 MBytes  6.24 Mbits/sec

Code: Select all

iperf> iperf -s -i 3
I (10007) IPERF: mode=tcp-server sip=localhost:5001, dip=0.0.0.0:5001, interval=3, time=30
I (10017) iperf: Socket created
iperf> I (13887) iperf: accept: 192.168.4.2,40978

Interval       Bandwidth
 0.0- 3.0 sec  5.76 Mbits/sec
 3.0- 6.0 sec  5.77 Mbits/sec
 6.0- 9.0 sec  5.91 Mbits/sec
 9.0-12.0 sec  5.89 Mbits/sec
12.0-15.0 sec  5.81 Mbits/sec
15.0-18.0 sec  5.83 Mbits/sec
18.0-21.0 sec  5.86 Mbits/sec
21.0-24.0 sec  5.91 Mbits/sec
24.0-27.0 sec  6.06 Mbits/sec
27.0-30.0 sec  6.17 Mbits/sec
 0.0-30.0 sec  5.90 Mbits/sec
I (43887) iperf: TCP Socket server is closed.
I (43887) iperf: iperf exit
It is not 1MB/s, but close enough.

Hope this helps you a bit.

Who is online

Users browsing this forum: No registered users and 94 guests