Stm32 USB OTG Host and Device
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-24 06:34 AM
Hello everyone,
I have recently started working with a Nucleo board based on STM32L4R5. IDE: STM32CubeIDE and the HAL drivers.
I am trying to use the USB on the Nucleo board as OTG(both Host and Device depending on the connection). I am not found any examples that I can refer to.(I only got few that indicate either host or device)
I have come across examples that support either device or host. Also came across these documents: UM1720 and UM1734.
I am open for any suggestion as this is my first time working with USB.
Thank you.
- Labels:
-
STM32L4 Series
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-24 06:53 AM
There's not much to it - basically you switch between device and host based on state of the ID pin of the AB connector. There's some little hardware support for the switch of the hardware in the OTG module, but at the end of the day, you'll need to deinit/init the software stack anyway.
Cube does not have examples AFAIK, but the old SPL-based USB stack does https://www.st.com/en/embedded-software/stsw-stm32046.html . That of course predates the 'L4+ family, and the stack itself is very different from the Cube one, but maybe you could extract some wisdom out of it.
I never used OTG myself but probably wouldn't bother looking at the native hardware support at all, as I wrote above.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-24 09:12 AM
Thank you for the information @Community member​
I will try testing your suggestion.
Pratham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-12-06 02:50 AM
did you tried as otg? i unable to connect stm as device with cpu as host. in the usbd_start() function, when global interupt enable, it is entering in to infinite loop.
can you suggest me, what to do?
did you got it?