Skip to main content
Graduate
February 16, 2024
Question

How to interface or use STM32H5xx USB Host with Classic USB Library

  • February 16, 2024
  • 3 replies
  • 3710 views

I have been trying to use the USB Host CDC library for a project but there is no example and online support available for STM32H5xx Series Controller. If anyone can share this Implementation please share the example on how to use the STM32H5xx USB as a host to read data from other MCU with USB Protocol.

    This topic has been closed for replies.

    3 replies

    Visitor II
    February 17, 2024

    Sorry, what do you want to do?

    USB CDC is, as I know, USB VCP UART Device. And this is actually a USB Device function (not acting as a host).
    It is intended to let a PC see your MCU as a USB VCP (UART) device and communicate like via UART.

    I am pretty sure, there is not any demo for an USB CDC Host implementation (handling a VCP UART COM port provided by a Device).

    Technically, yes: one MCU could be USB CDC Device (acting as a USB VCP UART. the usual case to use) and another a USB CDC Host. But this is usually never used and not provided as a demo, I think (why such a host implementation would be needed, if Host is usually the PC).

    Connect both MCUs via regular native UART and it should be fine. Why using USB for UART? (too much overhead)

    NikhilPAuthor
    Graduate
    February 18, 2024

    Actually the hardware is already manufactured and the UART ports of the Host Controller( 2 STM32 Device are used one is a Master or host controller and other is slave controller connected to each other via USB) were being used or unavailable due to other peripheral Usage. Thats why for exchaging data i we have used USB protocol. That why i needed to Configure one STM32H5xx series controller as master or USB host and other STM32 device as USB Device.

    Super User
    February 17, 2024

    Here example to use USB on H5xx  without rtos :

    https://github.com/STMicroelectronics/stm32h5-classic-coremw-apps

     

    NikhilPAuthor
    Graduate
    February 19, 2024

    @AScha.3  This Example is for USB HID Host, I am looking for USB CDC Host.

    Super User
    February 19, 2024

    Right, but it should be not to difficult, to merge this with a USB CDC Host example (with threadX).

    Here from STM - also CDC - 

    Middleware USB Host : 

    https://github.com/STMicroelectronics/stm32_mw_usb_host/tree/8b21b5c4a6b8df42ad46b9df63bb87c47bd7b2f5/Class/CDC

     

    NikhilPAuthor
    Graduate
    February 20, 2024

    @AScha.3 @tjaekel Thanks for the information. I have referred this video for development purpose https://www.youtube.com/watch?v=pC16Aon4crk&t=36s. Although the STM32H5xx series dont directly provide USB peripheral interface. I read the code which is mentioned this video. After that i tried combining the USB Host library which @AScha.3 Mentioned. After a couple of hours i compared all the necessary USB core and CDC files. I have code which is readily working on the STM32H563ZIT6 Nucleo Development board. Just dropping the file below i any one needs it in future to directly interface with the Core USB Library. I am Able to Receive and transmit data to and from a Slave STM32 controller, the data can be viewed in the USB_RX_Buffer and USB_TX_Buffer.