2019-09-29 01:57 PM
I have custom board with a STM32F446 processor I am trying to test
using cubeMX (v5.3.0) generated code for a USB human interface (mouse).
Unfortunately, I have had very sporadic results with getting the computer
to recognize it as a USB mouse. The computer shows it connecting, then
disconnecting, rarely but sometimes recognizing it as a mouse only to disconnect a minute later. Micro is running at 168Mhz. with heap size set to 1000.
I have replaced the USB connector on the board, the cpu and the crystal. Confirmed the same USB cable I am testing with works perfectly with other devices.
Could someone confirm the code generated by the cubeMX as a OTG USB device, human interface still produces working code for a USB mouse?
2019-09-29 03:30 PM
Is your chip running fine otherwise? Where in your code do things fail or get hung up?
2019-09-29 04:11 PM
Chip runs fine and does not hang. In debug, the last line that executes is MX_USB_DEVICE_Init() in main(). If I put something the while(1), it will run.
2019-10-05 03:01 PM
In case someone comes across this...
The cubeMX (v5.3.0) generated code for a USB human interface (mouse) works fine.
My problem was caused by the the long 3.3V rail going around the perimeter of the board. I replaced C12 with a 47uF capacitor and the device remained connected and working for over 4 hours before I disconnected it.
Only odd thing is the MCU did not hang and would execute any other code without issue even though the USB connection failed. Maybe the part of the MCU which handles the USB is powered by pin 48.
2019-10-05 03:21 PM
STM32F4 has a brownout detector, Clock security system. Maybe, worth to enable that to ensure correct operation.
-- pa
2019-10-05 04:25 PM
I did not know that and will definitely look into it. Might have saved me a lot of trouble.
Thank you.