How to implement STM32F4 as a USB Host to CDC Slave?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-17 1:13 AM
we are working on a project where an STM32F4 microcontroller is used as a host to connect with an external device. we are considering using the USB interface for this purpose. Can we refer to the following example to implement USB host functionality on the STM32F4, and are there any specific considerations or configurations we should be aware of for proper communication and integration?
https://controllerstech.com/usb-cdc-device-and-host-in-stm32/
- Labels:
-
Documentation
-
STM32Cube MCU Packages
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-17 2:36 AM
Hello @tejashwini ,
Let me first welcome you to the ST Community :)
You can find relevant USB Host examples in the STM32CubeF4 MCU package.
I advise you to refer to the User manual UM1720 for the "STM32Cube USB host library" which provides detailed and examples for USB Host implementation.
Hope this helped you!
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-10 1:55 AM
Hi ,
Thanks for reply.
I have used USB CDC Standalone example it is working fine.
Implementing the same function by generating project from STMcubemx is getting device desciptor, transmitting data but not receiving data.
So any solutions for this is helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-14 5:14 AM
Try increasing the heap size or configuring the USB library to use static allocation, as insufficient heap size or improper memory allocation can cause issues with data reception.
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-14 8:01 PM
I have tried with increasing heap and stack size, but also it is not working fine. CDC stand alone example from STM32 has same heap and stack size which is working fine.
Implementing the same is causing an issue in my project as Transmit callBack is not happening.
Thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-15 7:03 AM - edited ‎2025-01-15 7:06 AM
If CDC example from CubeF4 works, so you can compare your generated code with the working Cube example (compare configuration, functions...).
Maybe, check the packet size that does not exceed 64 bytes for full-speed USB CDC transfers.
If you need to receive more data, modify the application code to handle longer messages by splitting them into multiple packets. How to select suitable endpoints for your STM32 US... - STMicroelectronics Community
You can share more details or your project (ioc file) if your issue is not resolved.
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-27 2:57 AM
