cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-STM32h7s3l8 & USB-HOST

JaimeLujanLozano
Associate II
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?
12 REPLIES 12
FBL
ST Employee

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

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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);
 
 

 

FBL
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Harry_S
Associate

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

 

 

 

 

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

Hi @JaimeLujanLozano 

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi.

It's the same B02.

Hi.
With the example it works correctly.
I have tried to create a new example from the .ioc file, but it does not work since there are differences between files.
Using STM32CubeIde for a new project and adding USBPD, no reference to device TCPP0203 is included, so VBUS is not enabled in HOST mode.

Is there any example of USB-HOST for this board?
Thank you.

FBL
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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.