Skip to main content
Visitor II
December 4, 2024
Question

STM32H5 USB HOST CDC not able to receive messages

  • December 4, 2024
  • 2 replies
  • 1592 views

First of all I am not sure if this is the right location.

It wasn't: you posted under MPUs; moved to MCUs.

I have a custom PCB with an STM32H5 chip embedded.
This PCB needs to be a USB Host for a sensor that uses USB. If I connect the sensor to my laptop the sensor works fine, but when I have the sensor connected to the PCB. I doesn't work as expected.

We used an logic analyzer to see if there was any difference in the messages that were being send, but we don't see any difference, except for the address. In the images below, you can see the images. image(3) is the image from Laptop to the sensor. image(4) is the image from PCB to the sensor.

I used this library https://github.com/STMicroelectronics/stm32-mw-usb-host/tree/8b21b5c4a6b8df42ad46b9df63bb87c47bd7b2f5 as I want to be able to use FreeRTOS and not be stuck with ThreadX

Do you have any idea where I could look or what we might have done wrong or something we missed. I also included a .zip of the code as we have it right now.

If there is anything that I forgot to mention, please let me know.

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    December 10, 2024

    Hi @Sara02 

    Would you attach detailed breakdown of the USB traffic. Could you confirm the sensor is enumerated as intended. If possible to visualize enumeration in IO Terminal or via HyperTerminal.

    Sara02Author
    Visitor II
    December 11, 2024

    Hey @FBL,

    I am using Linux, so Hyperterminal is no option as far as I see.
    The IO terminal seems to need additional hardware.

    Is this correct or am I missing something?

    The enumeration looks like it goes right as far as I can see. When I check the settings they seem similar to what I see when I check it with the sensor connected to my laptop.

     

    Technical Moderator
    December 12, 2024

    Hi @Sara02 

    You can use linux command line, for OUT direction, to send a file in binary form to COM port

    bash -c 'cat filename >/dev/ttyACM0'

    To receive data from the COM port ttyACM0 and discard it immediately, you can use the cat command as follows:

    cat /dev/ttyACM0 >/dev/null
    Many tools can help you capture and analyze USB traffic. If I understand correctly, it seems like the issue is linked to the hardware design. I suggest you check general guidelines for USB design on STM32 in AN4879.
    Sara02Author
    Visitor II
    December 12, 2024

    Why should I use these commands on my laptop when I am trying to get the communication from my custom PCB with embedded STM32H5 chip to a USB sensor working? 

    Maybe this picture makes it more clear what I mean and how it should work.

    Sara02_0-1734014871134.png

     

    If I connect the same sensor to my laptop it works. In that case the USB Host would be my laptop.
    If I would add the captured data, you would see a working connection between my laptop and the sensor, of which we already know that it works. Or is there something else your looking for in the captured data?