When the 407USB virtual serial port device is used, the COM port of the serial port of the device will change every time it is connected. How to fix the serial number assigned on the PC?
Answer:The serial number is actually allocated by the operating system, and the driver is allocated according to VID, PID and serial number; if you fix a serial number, you can fix the serial numbers of all VCPs (the serial number in the code provided by the SDK is based on the chip UID to calculate, here you can fix a serial number).
Our VID and PID are both fixed
In the usbd_descriptor.c descriptor file, change the serial number to fixed.
At this time, after burning the device with a fixed serial number, it will always be a fixed port no matter how you plug it in or out. You can see that I fixed it as COM15.
However, if two VCP devices with the same (code) serial number are inserted at the same time, the COM port of the second inserted device will automatically become the other (COM16).
When multiple devices are pulled out at the same time and only one device is plugged in, the original other port (COM16) will return to the fixed port COM15.
Comments
Please log in or sign up to comment.