I have encountered a problem with my STM32L452VE - when I set up USB with CDC, it sometimes connects, sometimes not. When it doesn't connect, Windows clasically show yellow exclamation mark.
Increasing heap size and chaning packets size didn't solve this issue.
I have tried sniffing USB communication and problem seems to be the same every time - SET_CONFIGURATION is sent from host (PC) but no response is received. Upon closer inspection, I tried to modify HAL libraries by adding an extra delay, which miraculously solved the issue and now it succusefully connects every time.
As this this fix appears to be highly temporary, does anyone know the root of the issue?