当前位置:网站首页>USB virtual serial port (CDC) limit speed test
USB virtual serial port (CDC) limit speed test
2022-07-28 17:42:00 【sudort】
all the time , Want to USB Virtual serial port , This thing is not generally convenient , Is particularly convenient , Recently I am debugging USB There has always been a puzzle when using virtual serial port ,USB How fast can the virtual serial port transmit , Online search did not find a specific and clear data . So I personally tested , I believe the results can explain some problems , Now I will share the measured data with you .
I use national technology N32G4FR The series chips are described as follows :
| N32G4FR Series adoption 32 bit ARM Cortex-M4F kernel , Maximum operating frequency 144MHz, Supports floating-point operations and DSP Instructions , Integration up to 512KB Encrypted storage Flash, It can be used to safely store fingerprint information , 144KB SRAM, 2x12bit 5Msps ADC, 2x1Msps 12bit DAC, Support up to 18 Channel capacitive touch button , Integrated multiplexer U(S)ART、 I2C、 SPI、 QSPI、 USB、 SDIO、 CAN communication interface , At the same time, it integrates digital video (DVP) Interface , Support mainstream semiconductor fingerprint and optical fingerprint sensor , built-in Cryptographic algorithm hardware acceleration engine |
USB The features are as follows :
N32G4FR Series products are embedded with a compatible full speed USB Device controller , Follow full speed USB equipment (12Mbit/ second ) standard , Endpoints can be configured by software , With standby function / Wake up function . USB A dedicated 48MHz The clock is controlled by an internal master PLL generator directive ( To ensure communication stability , The clock source must be HSE External high-speed crystal ).
The test method :
1. Use official USB The virtual serial port routine is modified . Remove unnecessary content . take USB The endpoint of 1 Receive as host .
2. In fact, I also see many tests on the Internet USB The content of virtual serial port speed , It seems that most of them use software to test . After analysis, it is found that such methods are limited by the operating system , And serial port software , So I use oscilloscope to measure USB State .
3. take USB The endpoint in the routine 1IN The callback function adds a IO Mouth jump .

Slave endpoint 1 The sending function of is as follows :

USB The packet size of the enumeration sending and receiving endpoints is configured as 64 byte :

The software used in the upper computer test is SSCOM V5.13.1 Serial port baud rate is set to 1500000:

Test one :USB Send packet size :30 Number of bags 1024 Function as follows :

The data received by the serial port debugging software is correct :
Oscilloscope probe test jump IO Oral duration is 56.3ms Here's the picture :

Conclusion 1:USB Send packet size :30 Number of bags 1024 The total number of bytes sent is 30KByte, The time used is 56.3ms The final data transmission speed is 532.8KByte/S
Test two :USB Send packet size :30 Number of bags 2048 Function as follows :

The data received by the serial port debugging software is correct :

Oscilloscope probe test jump IO Oral duration is 103.8ms Here's the picture :

Conclusion two :USB Send packet size :30 Number of bags 2048 The total number of bytes sent is 60KByte, The time used is 103.8ms The final data transmission speed is 578.03KByte/S
Test three :USB Send packet size :30 Number of bags 10240 Function as follows :

Serial port debugging software receives data error , Through the analysis of , Personally, I think this serial port debugging software can't receive big data in a short time , It should be that the operating system received so much data , The debugging software cannot read the data in the buffer in time , Cause data loss :

Oscilloscope probe test jump IO Oral duration is 541ms Here's the picture :

Conclusion three :USB Send packet size :30 Number of bags 10240 The total number of bytes sent is 300KByte, The time used is 541ms The final data transmission speed is 554.52KByte/S
Test 4 :USB Send packet size :30 Number of bags 20480 Function as follows :

Serial port debugging software receives data error

Oscilloscope probe test jump IO Oral duration is 1082ms Here's the picture :

Conclusion 4 :USB Send packet size :30 Number of bags 20480 The total number of bytes sent is 600KByte, The time used is 1082ms The final data transmission speed is 554.52KByte/S
Test five :USB Send packet size :60 Number of bags 512 Function as follows :

The data received by the serial port debugging software is correct :

Oscilloscope probe test jump IO Oral duration is 35.5ms Here's the picture :

Conclusion 5 :USB Send packet size :60 Number of bags 512 The total number of bytes sent is 30KByte, The time used is 35.5ms The final data transmission speed is 845.07KByte/S
Test six :USB Send packet size :60 Number of bags 1024 Function as follows :

The data received by the serial port debugging software is correct :

Oscilloscope probe test jump IO Oral duration is 70ms Here's the picture :

Conclusion 6 :USB Send packet size :60 Number of bags 1024 The total number of bytes sent is 60KByte, The time used is 70ms The final data transmission speed is 857.14KByte/S
Test seven :USB Send packet size :60 Number of bags 5120 Function as follows :

Serial port debugging software receives data error

Oscilloscope probe test jump IO Oral duration is 353ms Here's the picture :

Conclusion 7 :USB Send packet size :60 Number of bags 5120 The total number of bytes sent is 300KByte, The time used is 353ms The final data transmission speed is 849.85KByte/S
Test eight :USB Send packet size :60 Number of bags 10240 Function as follows :

Serial port debugging software receives data error

Oscilloscope probe test jump IO Oral duration is 674ms Here's the picture :

Conclusion 8 :USB Send packet size :60 Number of bags 10240 The total number of bytes sent is 600KByte, The time used is 674ms The final data transmission speed is 890.20KByte/S
summary :
| test | Bag size (Byte) | Number of bags | Total bytes sent | Elapsed time (ms) | Speed (Kbyte/S) |
| One | 30 | 1024 | 30KByte | 56.3 | 532.8 |
| Two | 2048 | 60KByte | 103.8 | 578.03 | |
| 3、 ... and | 10240 | 300KByte | 541 | 554.52 | |
| Four | 20480 | 600KByte | 1082 | 554.52 | |
| 5、 ... and | 60 | 512 | 30KByte | 35.5 | 845.07 |
| 6、 ... and | 1024 | 60KByte | 70 | 857.14 | |
| 7、 ... and | 5120 | 300KByte | 353 | 849.85 | |
| 8、 ... and | 10240 | 600KByte | 674 | 890.2 |
In embedded development USB Virtual serial port data transmission :
1. The transmission speed can basically achieve 500KB/S~900KB/S The magnitude of .
2. The transmission speed is related to the upper computer software or operating system .
3. Try to use large packet data transmission , In this way, we can put USB The communication speed is brought into full play .
doubt :
1. During the test , The length of my port packet is set to 64 byte , But I use a package size of 64 There will be serious data loss during communication test , On the Internet, it is said to be in 64 After sending byte packet data, add a 0 Just send the data packet , Finally, I just learned a little, but didn't go deep , The maximum number of packages is 60 Bytes to test .
2. In general, the serial port debugging software is very powerful , At a single time 100K There is no problem in the transmission of bytes , The file data is greater than 100K There will be a serious data loss problem when bytes are used , This should be related to factors such as the reading operation of the upper computer and the size of the changed data .
边栏推荐
- R语言 sub()用法
- Factor in R
- Esp-mqtt-at instruction connects Alibaba cloud Internet of things platform
- MySQL implements sorting according to custom (specified order)
- 【 R语言—基础绘图】
- 网上出现的js小数计算的除法优化
- 软件测试到底有没有前景和出路?
- 【C语言笔记分享】字符函数和字符串函数(建议收藏)
- Visual Object Class介绍PASCAL VOC数据集
- 【C语言笔记分享】——动态内存管理malloc、free、calloc、realloc、柔性数组
猜你喜欢

谈谈你知道的发布上线(二)

Hgu95av2. Online installation failed

Insert text watermark in PDF

Talk about what you know about publishing online (I)

Public medical database

PCA 报错Error in eigen(crossprod(t(X), t(X)), symmetric = TRUE) : ‘x‘里有无穷值或遗漏值

【C语言进阶】——函数指针

Embedded development learning path

The browser has no Internet, and wechat can connect to the Internet (solution)

Master JVM interview topics and answers offer get soft (with learning roadmap)
随机推荐
Arya-专业web自动化测试平台
Public medical database
软件测试培训两个月骗局?培训机构到底如何选择?
Flat data to tree
学软件测试有用吗?
Talking about test platform -- Discussion on construction mode
Mmcv installation method
Kali installation configuration of penetration test killer
Strsplit() function
Factor in R
零基础学习软件测试有什么条件?
Easy to use vscode plug-in memo
MySQL implements sorting according to custom (specified order)
Database optimization -- deeply understand the underlying data structure and algorithm of MySQL index
Mysql database development specification
Talk about the measurement of "post release problems"
【C语言笔记分享】自定义类型:结构体,枚举,联合(建议收藏)
软件测试到底有没有前景和出路?
ionic 中遇到的一些东西
Awk of shell script