cancel
Showing results for 
Search instead for 
Did you mean: 

Using STM32G4 with Zephyr and USB Networking

JayBeavers
Associate II
I am trying to stand up a project using an STM32G4 using Zephyr with USB Device Next Networking. I have a similar project up and running on an nRF52. I'm getting the error on my STM32 project that upon system reset, I get a hard fault in z_cstart() -> ... -> statics_init() -> sys_heap_init(). I've isolated this to be a problem when I turn on CONFIG_NET_L2_ETHERNET=y.  If I set CONFIG_DEBUG=y I see a similar failure upon the call to z_bss_zero().
 
From what I can tell, the errors are consistent with an error initializing the soc memory.  This is a custom board with a G473CC soc.  I've made a custom zephyr dts for this board with #include <st/g4/stm32g473Xc.dtsi> so afaik the memory definitions should be correct.
 
I haven't set any memory protections in the option bytes, is there perhaps a default protection in place that comes from the factory that may be causing an issue?
2 REPLIES 2
JayBeavers
Associate II

For whatever reason, I don't have the same memory initialization issues when I use a Nucleo-H533RE.  I can't use my Nucleo-G431RB for testing, as it doesn't expose the USB port.

All said though, I never see the Zephyr USB-Device-Next stack initialize on the Nucleo-H533RE.  When I use a Nordic nRF52840-DK, I can see the USB stack come online with:

usbd: msg_cb: USBD message: VBUS ready

However I don't get the same from my H533RE.  From what I can tell, USBD never "really" starts up, though I don't see warnings or errors to say why.

Hello @JayBeavers

Could you share the memory regions defined in your DTS file and linker script? 

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.