Problem with USB on STM32L412KBT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 1:03 AM
Hi, I have problem running USB on STM32L412KBT. The code hangs inside MX_USB_DEVICE_Init. Sometimes in function HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) (file stm32l4xx_ll_usb.c), sometimes in function HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx) (the same file).
- Using CubeMX 5.2.1, STM32Cube FW_L4 V1.14.0
- Custom board, stable 3v3 power source with many filtering capacitors
- Successfully upload code using USB DFU, so I think wiring is OK
- Tried multiple CPU clock speed
- Tried multiple USB clock source
- Tried multiple USB class type CDC, HID, ...
- When I comment MX_USB_DEVICE_Init all other peripherals seems to work correctly
Any help appreciated...
- Labels:
-
STM32CubeMX
-
STM32L4 Series
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 3:50 AM
As a quick workaround, while waiting for more useful replies, try to disable interrupts around MX_USB_DEVICE_Init()
-- pa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 8:53 AM
__disable_irq() did not help.
Strange thing is that it randomly hangs on different places.
One thing I forgot to mention is that I am using crystal-less USB, but I should be OK with this CPU. Is there anything special that I must setup or the CubeX generated code should be fine ?
Thanks....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 9:42 AM
Next quick try while waiting for more useful replies: increase stack size,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 1:45 PM
No luck with stack size...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 2:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 2:16 PM
Yes... thank you...
