USB bug in latest STM32CubeIDE update and a workaround
Hi,
I had previously set up a USB serial communication that has been working with multiple STM32 types and in multiple projects. With the latest update to STM32CubeIDE Version: 1.15.0 Build: 20695_20240315_1429 (UTC) I had a problem.
Problem: unassigned variable warnings in USB_DEVICE/App/usbd_desc.c when tried to build the project. The project runs but the COM port number changes with each restart of the MCU which is very inconvenient for practical use.
Workaround: In the file USB_DEVICE/App/usbd_desc.c edit the routine starting to replace the missing commands as per below.
I hope this helps. Maybe it could be fixed in a new release.
H.
/**
* @brief Create the serial number string descriptor
* @param None
* @retval None
*/
static void Get_SerialNum(void)
{
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
deviceserial0 = *(uint32_t *) DEVICE_ID1; // Missing
deviceserial1 = *(uint32_t *) DEVICE_ID2; // Missing
deviceserial2 = *(uint32_t *) DEVICE_ID3; // Missing
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
{
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
}
}
/**
