Skip to main content
Visitor II
August 30, 2024
Question

USB stick enum error on STM32H7B0 board

  • August 30, 2024
  • 2 replies
  • 1520 views

Hi everyone:

 

I am trying to add USB stick support to STM32H7B0VBT based board. I used STM32CubeMX to generate code relating to USB host, FatFs, and system clock. USB plugging in and unplugging can be recognized by the middleware (in usbh_core.c), but the return value is always USBH_BUSY from function USBH_HandleEnum(). So the operation on USB stick is not functional. I have a few questions here:

1. We use the USB port as USB OTG, the D+ and D- signal is connected to ground with 1.5 ohm pull-down resistor.  Anything else should we take care of regarding to the USB OTG interface.

2. As to system clock, what is the best way to configure for USB OTG with STM32CubeMX.

3. As to the register relating to USB host, what registers should be checked, and what are the correct values for each register.

 

Thanks & Best Regards,

Arthur

    This topic has been closed for replies.

    2 replies

    Graduate II
    August 30, 2024

    I tried increasing the number of interfaces changing the define USBH_MAX_NUM_INTERFACES and introducing some traces to se how many interfaces you have, I did so using usart and having the mcu connected to the computer.
    The place where you read how many interfaces the device has is inside this function:
    static USBH_StatusTypeDef USBH_ParseCfgDesc(USBH_HandleTypeDef *phost, uint8_t *buf, uint16_t length)

    I managed to increase it and select the proper interface but I'm getting stucked on GetLineCodeCoding afterwards.

    Tell me if changing that helped you.

    Cheers

    Technical Moderator
    August 30, 2024

    Hi @Huiqi 

    1. According to datasheet, Table 122 footnote, No external termination series resistors are required on USB_DP (D+) and USB_DM (D-); the matching impedance is already included.

    2. Which speed? USB core typically operates at 48MHz. AHB frequency should be higher than 30 MHz. 

    3. You can check in the reference manual, Global interrupt register section 62.14.20 Host-mode registers and  to be checked! Otherwise, I would recommend using debug logs for instance. In which case you are getting USBH_BUSY from function USBH_HandleEnum()

     

    On this package STM32H7B0VBT, if using High Speed mode, you will need to switch between analog ports to use OTG_HS_ULPI_DIR and OTG_HS_ULPI_NXT (PC2_C and PC3_C).

    Another advice for HS operations, when choosing your PHY, check carefully the timing values for compatibility. You can refer to this article How to check compatibility on USB ULPI transceiver... - STMicroelectronics Community.

    HuiqiAuthor
    Visitor II
    September 2, 2024

    Hi @FBL 

    Thanks for your reply.

    1. I used STM32H7B0VBT's ports PA11 & PA12 as USB OTG FS (DP & DM), and I do not need to use high speed mode.

    2. An external 8MHz oscillator is used in our application. As to the USB speed, I mean the value "To USB(MHz)" in STM32CubeMX software's Clock Configuration. Should it be 48MHz or 12MHz for FS mode?

    3. I am checking the value of register section 62.14.20, but I am not quite sure the correct value (bit value) in each register. Can you let me know the value or bit value I need to check. The register values in my application are shown below.

    Huiqi_0-1725254323145.png

    Best Regards,

    Technical Moderator
    September 3, 2024

    Hi @Huiqi 

    I guess you didn't get my first point. 

    You mentioned "the D+ and D- signal is connected to ground with 1.5 ohm pull-down resistor. "

    However, the datasheet says: 

    No external termination series resistors are required on USB_DP (D+) and USB_DM (D-); the matching impedance is already included.

    You should not add more resistors on DP and DM.

    Second, USB clock source must be always 48MHz. The output depends on the operating speed FS or HS. Check the reference manual section 62.4.3 OTG_HS core

    FBL_0-1725371511243.png

     

    Finally try to increase USBD_DEBUG_LEVEL. It is simpler to have middleware logs to debug console than checking each register.