Skip to main content
Visitor II
April 25, 2024
Solved

NUCLEO-STM32h7s3l8 & USB-HOST

  • April 25, 2024
  • 6 replies
  • 5994 views
Hello everyone.
I recently purchased a Nucleo STM32H7S3L8 board, and it is giving me problems.
I am using STM32CUBEIde to create a usb host and a CDC class.
I am using the x-cube-tcpp module, USB_OTH_HS and the problem is that the usb host does not initialize. It stops at the USB_CoreReset function,
exactly USBx->GRSTCTL is always 1, it doesn't change.

Can anybody help me?
    This topic has been closed for replies.
    Best answer by ericlafay

    Hi Everyone,

    I was able to get it to work if you update: USB_HS_REGEN to 'enabled' under the power and thermal tab

    ericlafay_0-1718400411010.png

     

    6 replies

    Technical Moderator
    April 25, 2024

    Hi @JaimeLujanLozano 

    Could you explain more the issue? Did you have an issue with the example provided in Cube Firmware. If your application is completely different, please share your code so that we can help you

     

    FBL_0-1714063887144.png

     

    Visitor II
    April 26, 2024
    Thanks in advance.
    I am connecting a USB-C modem using a specific CDC class.
    To activate VBUS I have modified the code generated by x-cube-tcpp, using only what is necessary to power VBUS. The Green LED lights up correctly and so does the modem.
    
    I have added the USB_OTG_HS feature and USB-HOST package in stm32CubeIde but the application crashes when the system calls usb_CoreReset().
    The calling order is:
    MX_TCPP_Init()
    (usb led lights up)
    MX_USB_HOST_init()
    USBH_Init()
    USBH_LL_Init()
    HAL_HCD_Init()
    USB_CoreInit()
    USB_CoreReset()
    and here it waits for HAL_TIMEOUT, since the USBx->GRSTCTL register does not finish initializing the PHY.
    The modifications in TCPP are (app_tcpp.c):
    /* ADC_Start();*/
     /*USBnoPD_State = USBnoPD_State_DETACHED;*/
     HAL_Delay(500);
     BSP_USBPD_PWR_VBUSDischargeOff(USBPD_PWR_TYPE_C_PORT_1);
     BSP_USBPD_PWR_VBUSOn(USBPD_PWR_TYPE_C_PORT_1);
     
     

     

    Technical Moderator
    May 2, 2024

    Hi @JaimeLujanLozano 

     

    After further investigation, it seems you have encountered an issue while porting your project (Disco board to Nucleo board).

    If your target seemed to be damaged, you can recover using CubeProgrammer and connect in Power Down mode so that you can erase the chip. In fact, you may have flashed an SMPS project and your nucleo power supply by default is LDO as referenced in the user manual STM32H7Rx/7Sx Nucleo-144 board (MB1737) - User manual

    Visitor II
    May 3, 2024

    Hello.
    He didn't quite understand her answer. I have the board configuration all by default.
    Tests carried out:
    x-cube-tcpp (WORKS, vbus is ok).
    USB-HOST (not working, crash on usb_corereset)
    USB device (not working, crash on usb_corereset).
    I just have to try the example from the repository (https://github.com/STMicroelectronics/STM32CubeH7RS/tree/main/Projects/NUCLEO-H7S3L8/Applications/USB_Device/CDC_Standalone).

    Sincerely: Jaime Lujan

    Technical Moderator
    May 3, 2024

    Hi @JaimeLujanLozano 

    Could you please specify NUCLEO-H7S3L8 board revision? It works as expected on my end (using B02) 

    Graduate II
    May 2, 2024

    I am experiencing the same issue on the NUCLEO-H7S3L8

    USB_OTG_GRSTCTL_CSRST is stuck to 1

    During usb configuration/initialisation 

    static HAL_StatusTypeDef USB_CoreReset(USB_OTG_GlobalTypeDef *USBx)
    {
    __IO uint32_t count = 0U;
    /* Wait for AHB master IDLE state. */
    do
    {
    count++;
    if (count > HAL_USB_TIMEOUT)
    {
    return HAL_TIMEOUT;
    }
    } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U);
    /* Core Soft Reset */
    count = 0U;
    USBx->GRSTCTL |= USB_OTG_GRSTCTL_CSRST;
    do
    {
    count++;
    if (count > HAL_USB_TIMEOUT)
    {
    return HAL_TIMEOUT;
    }
    } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST); //<<< Never leaves this state!!!
    return HAL_OK;
    }

    Harry_S_1-1714687674091.png

    Harry_S_2-1714687689930.png

    Harry_S_4-1714687984220.png

    Harry_S_5-1714688343052.png

    Can someone help with the above?

    Thanks

    Harry

     

     

     

     

    Technical Moderator
    May 7, 2024

    Hello @JaimeLujanLozano  & @Harry_S 

    I reproduced the issue on my side too and reported it to dedicated team. It seems the configuration of USB core in both instances is not correct after code generation. In fact, BSVLD bit field should be set in OTG_GOTGCTL. 

    Internal ticket number 180898

    Explorer
    May 7, 2024

    Is the USB core issue specific to that board, or other boards as well?  I'm working on the B-U585-IOT02A board right now.

     

    Visitor II
    May 8, 2024

    I was tested núcleo L496 and work correctly. Only fails núcleo H7S3L8.

     

    Visitor II
    May 15, 2024

    Solved!!!

    Hello.

    I don't understand exactly how, but importing the attached file works and doesn't stop.
    I have tried to reproduce the configuration from scratch in a new project and it doesn't work, I can't find an explanation.
    If you create a new project from the .ioc, it just works.

     

    ericlafayAnswer
    Visitor II
    June 14, 2024

    Hi Everyone,

    I was able to get it to work if you update: USB_HS_REGEN to 'enabled' under the power and thermal tab

    ericlafay_0-1718400411010.png