Skip to main content
Visitor II
February 15, 2022
Question

STM32H7 - how to initialize USB HS on M4 core (Hard Fault)?

  • February 15, 2022
  • 2 replies
  • 1575 views

Hi!

I'm using STM32H747 MCU on STM32H747I-DISCO board and CubeIDE with a project template for 2-core parts. M7 core processing TouchGFX and all UI-related stuff. 

I'm trying to run a USB HS peripheral on a M4 core.

Selected context for USB_OTG_HS is M4 core in the project configuration (.ioc file).

By default, both cores start at the same time, M4 stops while M7 configures all peripherals and M4 runs after. But when the M4 core starts up and tries to initialize the USB, a Hard Fault error occurs.

When debugging the project, I can see that the error appears in

HAL_PCD_Start() -> __HAL_PCD_ENABLE(hpcd) -> USB_EnableGlobalInt().

This function writes register:

USBx->GAHBCFG |= USB_OTG_GAHBCFG_GINT;

But according to the manual RM0399 (60.14.3 OTG AHB configuration register (OTG_GAHBCFG)):

"Do not change this register after the initial programming. The application must program this register before starting any transactions on either the AHB or the USB."

So, my thoughts, this error occurs because the M7 core has already begun to communicate on the bus while the M4 core is trying to write to this register.

Are my assumptions correct?

Is there a way to move initialization and usage of USB HS to M4 core instead of M7?

(All examples, supplied with FW_H7 V1.9.1 firmware use M7 core for USB)

Perhaps someone could point me in the right direction.

Thank you.

    This topic has been closed for replies.

    2 replies

    Visitor II
    February 23, 2022

    Hello @LensFlare​ ,

    You can refer to the following example provided under our H7 Firmware Package that uses the multi-core support feature integrating the Mass Storage Class (MSC) (Cortex-M7) and Human Interface (HID) (Cortex-M4) in the same project:

    • Projects\STM32H747I-EVAL\Applications\USB_Device\HID-CM4_MSC-CM7

    This might help you.

    BeST Regards,

    Walid

    LensFlareAuthor
    Visitor II
    February 23, 2022

    Thank you, I’ll take a look.

    Explorer
    February 23, 2022

    see also about NewLib

    LensFlareAuthor
    Visitor II
    February 23, 2022

    Thank you, that is interesting.