cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-F767ZI + STM32CubeIDE 1.16.0 HardFault_Handler triggered in ETH_SetDMAConfig()

wgoltermann
Associate

I built a simple stm32 project for a Nucleo-F767ZI from the STM32CubeIDE 1.16.0 or 1.14.0  with all peripherals initialized with their default values

- FREERTOS CMSIS_V1 or CMSIS_V2 API

- LWIP (dhcp / static ip address) LAN8742 PHY driver

- ETH in RMII mode (cannot be changed)

With the built-in debugger I was able to find that the function ETH_SetDMAConfig() triggered the HardFault_Handler at line 2833 (file Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.eth.c)

I know, there have been issues with the ethernet driver in the past but not recently.

The demo package LwIP_HTTP_Server_Netconn_RTOS runs ok

Any help would be appreciated

 

1 ACCEPTED SOLUTION

Accepted Solutions
wgoltermann
Associate

CubeMX sets the StackSize of the defaultTask to 128 even when LWIP is enabled
This default stack size value is far too low to run the LWIP stack (512 seems to be fine)

from main.c

void StartDefaultTask(void const * argument)
{

/* init code for LWIP */

MX_LWIP_Init();

}

 

Regards

View solution in original post

3 REPLIES 3
STea
ST Employee

Hello @wgoltermann ,

The line that you are referring to is the following if I get you right:

  HAL_Delay(ETH_REG_WRITE_DELAY);

This line was added as the 2.14.5 section of Errata sheet - STM32F76xxx STM32F77xxx - STM32F76xxx and STM32F77xxx device limitations
so, if you did change things related to the Systick config and period this might affect the behavior of the driver still not sure how this might cause a Hardfault.
I think a good reference point would be to clear all pinout if you are using CubeMX and the proceed with configuration of only the necessary peripheral and make sure to select another timebase for systick when using Freertos to keep the same timebase for HAL functions (see the stm32f7xx_hal_timebase_tim.c in STM32Cube_FW_F7_V1.17.2\Projects\STM32F767ZI-Nucleo\Applications\LwIP\LwIP_HTTP_Server_Netconn_RTOS) .

You can refer to the article How to create a project for STM32H7 with Ethernet ... - STMicroelectronics Community as a reference.
Regards

In order 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.

Hello @wgoltermann ,

any updates on this issue.
Regards

In order 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.
wgoltermann
Associate

CubeMX sets the StackSize of the defaultTask to 128 even when LWIP is enabled
This default stack size value is far too low to run the LWIP stack (512 seems to be fine)

from main.c

void StartDefaultTask(void const * argument)
{

/* init code for LWIP */

MX_LWIP_Init();

}

 

Regards