2023-11-24 10:23 AM
Hello STM32 community!
I'm relatively new to the embedded field and have been diving into communication protocols through small projects. Currently, I'm working on implementing USB CDC on an STM32F446RE, and I've been facing challenges for the past two months.
I've extensively searched the internet and followed various tutorials, but unfortunately, none of them seem to work.
One of the tutorial that I followed: https://controllerstech.com/usb-cdc-device-and-host-in-stm32/
Regarding my hardware setup, I've cut a USB 2.0 cable, connected the power wire to 5V pin(with the jumper changed to E5V), and linked D+ and D- to their respective configured pins on the board.
I am getting the code 43: unrecognized device error
I would greatly appreciate it if anyone who has successfully implemented USB CDC on STM32 Nucleo boards could share the exact steps they took.
Your insights and guidance would be invaluable to me. Thank you in advance for any assistance you can provide!
Solved! Go to Solution.
2023-11-24 11:25 AM - edited 2023-11-24 11:26 AM
As @TDK wrote, the STM32 on Nucleo board gets its clock from the ST-LINK part by default. So ensure that the ST-LINK is powered and runs. The USB device examples are available for this Nucleo; guidance how to connect the USB pins to host should be available too, look in the documentation section of the Nucleo product page.
2023-11-24 10:49 AM
There is a CDC_Standalone in the CubeMX examples that will work. You'll need to adjust the clocks to work from your board. Nucleo is clocked from 8 MHz HSE bypass.
Have USB signals over jumper wires isn't ideal but will probably work at 12 MHz (USB FS).
2023-11-24 11:25 AM - edited 2023-11-24 11:26 AM
As @TDK wrote, the STM32 on Nucleo board gets its clock from the ST-LINK part by default. So ensure that the ST-LINK is powered and runs. The USB device examples are available for this Nucleo; guidance how to connect the USB pins to host should be available too, look in the documentation section of the Nucleo product page.
2023-11-24 12:39 PM
Try putting the mcu to bootloader mode, to activate the DFU bootloader. If it works, problem is your software, if it does not, problem is your hardware. (DFU bootloader probably works only on one of the two USB modules on the 'F446, see AN2606).
JW
2023-11-25 04:46 AM
The available examples are also not working and I have adjusted the clock frequency - 48MHz to USB and configured to USB OTG FS in Device mode only.