Hello.
Thanks for the feedback. That was exactly the tip I needed.
I have now set the serial number string in the "usbd_desc.c" file.
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
{
UNUSED(speed);
*length = USB_SIZ_STRING_SERIAL;
/* Update the serial number string descriptor with the data from the unique
* ID */
Get_SerialNum();
/* USER CODE BEGIN USBD_FS_SerialStrDescriptor */
USBD_StringSerial[0] = 26;
USBD_StringSerial[1] = 3;
USBD_StringSerial[2] = 52;
USBD_StringSerial[3] = 0;
USBD_StringSerial[4] = 56;
USBD_StringSerial[5] = 0;
USBD_StringSerial[6] = 68;
USBD_StringSerial[7] = 0;
USBD_StringSerial[8] = 66;
USBD_StringSerial[9] = 0;
USBD_StringSerial[10] = 53;
USBD_StringSerial[11] = 0;
USBD_StringSerial[12] = 52;
USBD_StringSerial[13] = 0;
USBD_StringSerial[14] = 54;
USBD_StringSerial[15] = 0;
USBD_StringSerial[16] = 68;
USBD_StringSerial[17] = 0;
USBD_StringSerial[18] = 51;
USBD_StringSerial[19] = 0;
USBD_StringSerial[20] = 53;
USBD_StringSerial[21] = 0;
USBD_StringSerial[22] = 52;
USBD_StringSerial[23] = 0;
USBD_StringSerial[24] = 53;
USBD_StringSerial[25] = 0;
/* USER CODE END USBD_FS_SerialStrDescriptor */
return (uint8_t *) USBD_StringSerial;
}
Now the devices are always assigned the same ComPort number by Windows.
Only when two devices are connected to a Windows PC at the same time are different ComPort numbers assigned.
Is there a more elegant way to set the serial number?
Thank you for your help.
Regards
Rasmus