Skip to content

STM32F4: Infinite reboot loop due to Ethernet initialization #35395

@mrfuchs

Description

@mrfuchs

This is a follow-up to issue #32771.

After porting an existing project from Zephyr 2.2 to Zephyr 2.5, I'm facing infinite reboots during initialization due to Ethernet initialization. Unfortunately and contrary to the fixes suggested in #32771, neither #35218 nor disabling auto-negotiation alone helped with my setup. I'm using a custom board based on an STM32F437VI SOC.

However, combining all three patches fixes the boot behavior for me:

  1. Apply drivers: ethernet: eth_stm32_hal.c: enable IRQ at the end of iface init #35218
  2. Apply patch re. auto-negotiation disable from STM32 with Ethernet crashes when receiving packets early #32771 (comment)
  3. Comment the calls to HAL_Delay() in HAL_ETH_Init():
 stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_eth.c b/stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_eth.c
index 2b6567b1..8fee17c7 100644
--- a/stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_eth.c
+++ b/stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_eth.c
@@ -338,7 +338,7 @@ HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
   }
 
   /* Delay to assure PHY reset */
-  HAL_Delay(PHY_RESET_DELAY);
+//  HAL_Delay(PHY_RESET_DELAY);
 
   if((heth->Init).AutoNegotiation != ETH_AUTONEGOTIATION_DISABLE)
   {
@@ -475,7 +475,7 @@ HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
     }
 
     /* Delay to assure PHY configuration */
-    HAL_Delay(PHY_CONFIG_DELAY);
+//    HAL_Delay(PHY_CONFIG_DELAY);
   }
 
   /* Config MAC and DMA */

Otherwise the system crashes/reboots here (with the stack trace below):

SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;

Thread #1 57005 (Suspended : Breakpoint)	
	arch_swap() at swap.c:41 0x801e7a6	
	z_swap_irqlock() at kswap.h:162 0x8034074	
	z_swap() at kswap.h:173 0x8034074	
	z_tick_sleep() at sched.c:1’268 0x8034074	
	z_tick_sleep() at sched.c:1’235 0x8034074	
	z_impl_k_sleep() at sched.c:1’296 0x80340b4	
	k_sleep() at kernel.h:86 0x80398f8	
	HAL_ETH_Init() at stm32f4xx_hal_eth.c:341 0x80292f4	
	eth_initialize() at eth_stm32_hal.c:686 0x801e38e	
	z_sys_init_run_level() at device.c:61 0x80334ba	
	bg_thread_main() at init.c:149 0x8033696	
	z_thread_entry() at thread_entry.c:29 0x8038e88	
	arch_switch_to_main_thread() at thread.c:526 0x801e9a4	
	0xaaaaaaaa

Metadata

Metadata

Assignees

Labels

bugThe issue is a bug, or the PR is fixing a bugplatform: STM32ST Micro STM32priority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions