2024-04-19 11:34 PM
I use STM32F407 USB2.0 HS to send data periodically. The USB mode is high-speed mode. I configure the breakpoint IN transmission as the interrupt transmission mode. I use CDC_Transmit to send data. Each time it is judged that the last transmission is completed before sending data, and the time of interrupting the transmission is The interval is 1ms. I built a FIFO for the USB packet. The rate of USB packet generation is 2ms. I measured the time interval for each write and send data to USB and found that the maximum time interval will increase as the measurement time increases. Generally, the maximum interval for half an hour is 100ms, and for one hour it will be around 180ms. Our host computer is written in python, using the libusb library, and runs on the Windows 11 operating system. Can you guys see what the problem is?
Solved! Go to Solution.
2024-04-28 03:29 AM
I changed the USB protocol to virtual serial port and solved the problem. The read interval is now very stable, with a read interval of about 1.3 seconds appearing every few hours.
2024-04-20 01:28 AM - edited 2024-04-20 01:29 AM
>The USB mode is high-speed mode.
So you connected a hi-speed PHY ?
+
>and runs on the Windows 11 operating system. Can you guys see what the problem is?
Win 11 ? :)
You cannot expect fixed timing , its not a RTOS ! (response might come in a statistical manner , 1...300 ms or so.)
(On USB audio transfer start i got everything between 20ms and 400ms .)
>for one hour it will be around 180ms
More precisely : the response is permanently increasing - or there are just some "slow" and most other responses still at xx ms ?
2024-04-20 01:32 AM
>More precisely : the response is permanently increasing - or there are just some "slow" and most other responses still at xx ms ?
The maximum USB transmission interval is increased to 180ms, and the average time is still 2ms. I measured it one night and the maximum interval was 1.8 seconds.
2024-04-20 01:57 AM - edited 2024-04-20 01:59 AM
So you :
A: have to live with this timing.
B: use other operating system (Linux should be better here.)
C: prevent any other action on your system, especially on all USB connections;
Windows will sometimes execute very "blocking" actions, like anti-virus defender, update loading, or more like this.
(I had on my Win11 Laptop , when opening a jpg picture (usually instant) to wait 54 sec (i looked at a clock - unbelievable ! ) until pic come up. And task-manager just showing 20% cpu load - all cheating )
2024-04-28 03:29 AM
I changed the USB protocol to virtual serial port and solved the problem. The read interval is now very stable, with a read interval of about 1.3 seconds appearing every few hours.