2025-02-19 07:07 AM
Hello. I am working on a project that uses a STM32L496VET6 microcontroller and that can work as an USB device. The board has the following usb circuit schematic:
The USB signals are connected directly to the MCU (D+ to PA12, D- to PA11, ID to PA10 and VBUS to PA9). The board is self-powered, so the USB power is not used. The VBUS goes through a voltage divider to reduce the voltage from 5V to approximately 3.14V. I configured the peripheral to work only as a device and the interruptions are also enabled. The middleware is configured to use the USB as a COM port.
Issue
When I plug the USB cable in the board, nothing happens, no interruption raises. Using a logic analyzer, I also saw that on idle, D+ is low and D- is high. When I plug the cable, D- goes low, being the unique change, nothing more happens. When I unplug, a interruption is raised and the disconnect callback function is called.
Attempts to fix
The steps 4 to 8 are repeated three times before the host stop trying and the device never reaches any function to send anything (like the ACK to the GET_DESCRIPTOR request). This was the closest I reached to have any signal, because without the external pull-up, nothing happens but the disconnect event. Maybe I am missing something, but I would appreciate any help.
2025-02-19 08:40 AM
Hi,
just question: you generate project with IDE + HAL etc ?
+ is
MX_USB_DEVICE_Init();
in main ?
2025-02-19 10:36 AM
Yes. I forgot to mention this detail, but I am using the STM32CubeIDE to generate the whole project and HAL drivers. Also, this MX_USB_DEVICE_Init() function is in the main.c file and the initialization seems fine, all the steps inside this function are executed with no erros.
2025-02-19 11:30 AM
I just asked because i had never this problem (using IDE+HAL).
Maybe look in IDE menu help->configuration -> manage...packages : is there a update for L4 (-> 1.18.1) ?