I had problems with the USB connector, it got disconnected every time i was giving power to the motor, until a discussion on the Discord chat opened my eye.
ST doesn't say anything in the STM32F405RG datasheet about the USB pull-up or termination resistor, but in their discovery board they use just two termination resistor of 22ohm.
That said you can find those two resistor in many many design, even in the VESC 6 designs, welll ... replace them with 0 ohm resistor or don't use them at all.
this is wrong.
As noted by mckenzie on this ST application note https://www.st.com/resource/en/application_note/an4879-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf they are in facvt stating that there is no need to provide and external termination resistor
On the internal USB PHYs, the matching output impedance is already embedded in the pad transceiver and is in line with the USB specification. No external resistors are needed.
In fact if you use those 22R you will probably get too much reflections and ringing and this will cause in USB instability.
Also it's suggested to wire the usb shield to the PCB ground, and not to use a ferrite bead as i got better result with a 0R resistor than a bead between board GND and USB gnd.
Hope this will help someone in the future