When I was developing the stm32usb device for my project, I found that the usb sending would often block the main function, or the program could not run smoothly, and the real-time performance was greatly reduced. It was normal for it to be stuck for tens of milliseconds. I don't understand why st would write such a usb program. It's really stupid. After several twists and turns, I found a solution:
In the usb_dcusb_dcd_int.c file, the function DCD_WriteEmptyTxFifo has a bug, which will often cause an infinite loop and make the USB library take too long.
It should be modified as follows, adding the statement in the red box to the original program:
The USB connection is not a reliable real-time connection, and it is normal to lose packets sometimes. After the modification, the USB will no longer be blocked and will be very smooth, but you should pay attention to adding packet loss processing logic to solve the USB packet loss problem. I am using a USBHID device, and the source code of the upper computer three platforms is attached https://download.csdn.net/download/u012572552/10612090
Previous article:STM32 routine USB HID bidirectional data transmission
Next article:STM32 USB HID custom device bulk transmission
Recommended ReadingLatest update time:2024-11-16 11:50
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Want to exchange, use TI LM3S8962EVALUATION KIT for an NXP Rapid IoT
- Ultra-wideband application analysis collection
- [TI star product limited time purchase] + CC2640R2 is quite attractive at this price!
- The difference between radio remote control and infrared remote control
- AT32F425-Evaluation Report-Flash Read and Write 07
- ShineBlink ultra-low-code IoT chip App remotely controls relays to connect to Gizwits Cloud
- Essential for getting started! STM32 IoT practical tutorial
- 【TI Recommended Course】#TI.com Online Purchasing Special: Smart Buildings#
- Report: Four key factors driving the development of IoT chips
- Where can I find the most complete Chinese version of the tutorial for ad18? Some videos on the Internet are incomplete.