cancel
Showing results for 
Search instead for 
Did you mean: 

HAL USB_CoreReset times out on the CM4 core of a Nucleo-H745zi-q

WLear
Associate III

Attempting to get USB CDC running on the CM4 core of a stock Nucleo-H745zi-q board. USB_CoreReset() times out waiting for a soft reset. Any help would be greatly appreciated.

Timeout is in stm32h7xx_ll_usb.c, lines 1456-1469:

/* Core Soft Reset */
  count = 0U;
  USBx->GRSTCTL |= USB_OTG_GRSTCTL_CSRST;
 
  do
  {
    count++;
 
    if (count > 200000U)
    {
      return HAL_TIMEOUT;
    }
  } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);

USB clock is RC48

Project built with CubeMX V6.6.1, CubeIDE V1.10.1, Firmware FW_H7 V1.10.0

 I moved the USB from the CM4 core to the CM7, and this issue does not occur.

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

If you look at usbd_desc.c/line 337: Get_SerialNum() function does access the system memory. Unfortunately, CM4 doesn't have access to this region.

So to use the device ID as a serial number, you have to read it by CM7, save it in the RAM which will be available later-on for CM4. 

You can test it by -in Get_SerialNum()- replacing:

deviceserial0 = *(uint32_t *) DEVICE_ID1;

deviceserial1 = *(uint32_t *) DEVICE_ID2;

deviceserial2 = *(uint32_t *) DEVICE_ID3;

by:

deviceserial0 = 0xABCDEF12;

deviceserial1 = 0x12345678;

deviceserial2 = 0x12A3D459;

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.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

View solution in original post

5 REPLIES 5

Hello @WLear​ ,

You can refer to the following example provided under the H7 Firmware Package which uses both cores CM4 and CM7:

Path: Projects\STM32H747I-EVAL\Applications\USB_Device\HID-CM4_MSC-CM7

I hope this helps.

BeST Regards,

Walid

SofLit
ST Employee

Hello,

If you look at usbd_desc.c/line 337: Get_SerialNum() function does access the system memory. Unfortunately, CM4 doesn't have access to this region.

So to use the device ID as a serial number, you have to read it by CM7, save it in the RAM which will be available later-on for CM4. 

You can test it by -in Get_SerialNum()- replacing:

deviceserial0 = *(uint32_t *) DEVICE_ID1;

deviceserial1 = *(uint32_t *) DEVICE_ID2;

deviceserial2 = *(uint32_t *) DEVICE_ID3;

by:

deviceserial0 = 0xABCDEF12;

deviceserial1 = 0x12345678;

deviceserial2 = 0x12A3D459;

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.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

Thankyou. Unfortunately, this example exhibits the same issue as my code. See the response from @SofLit for the root cause.

Yes, This test patch does allow the USB init function to return without timing out. I trust this bug will be fixed in the next H7 firmware release.

I just ran into this bug, CubeIDE version 1.14.1, STM32H755, USB running on the CM4. Stepping through initialization I don't see it hitting the Get_SerialNum function before attempting the CoreReset. It times out waiting on USB_OTG_GRSTCTL_CSRST. I changed the Get_SerialNum function as described above but I'm still getting the time out. Were you able to implement a workaround to allow the CM4 to run USB? Thanks!