2025-05-05 7:24 AM
Hello,
I can run older TCP/IP examples on my F767 Nucleo but I want to start fresh and understand what is going on.
Basic project started with CubeIDE/CubeMX code generation. FreeRTOS, LWIP, fixed IP => Does not answer to ping. Turns out MX_LWIP_Init() never returns.
If I step into the ethernetif initialisation code, I see that anywhere HAL_Delay(ETH_REG_WRITE_DELAY) is called within stm32f7xx_hal_eth.c, it never returns, unless I step into it from the debugger and go step by step (and see uwTickFreq increment) until HAL_Delay returns.
I understand the time base is a common issue often because of the interrupt priorities, but I think I have everything setup correctly. I am using Timer 6 as a tick source, with its IT priority set to 0.
Again, I do see uwTickFreq increment if I run the code step by step.
I removed MX_LWIP_Init() from the code and added some HAL_Delay(1000) in the for(;;) loop in the defaulttask and it returns every second, which tells me HAL_Delay() and FreeRTOS work together in the configuration I have.
I am sure I am missing something simple but I cannot tell what...
2025-09-09 11:42 PM
I had nearly the same problem with the `MX_ETH_Init()` function never returning and getting stuck in the `HAL_Delay()`. In my case the problem was that I was creating a task before the hardware initialised. I assumed this should be harmless as I have not started the scheduler yet.
BaseType_t taskCreationRetVal;
taskCreationRetVal = xTaskCreate(uartDMATask, "uart_DMA_Print", STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, &uartTskHndl);
assert_param(taskCreationRetVal == pdPASS);
Turns out this is not allowed. My solution came from this link: https://forums.freertos.org/t/problem-with-hal-delay-function-in-freertos/12288/2
Basically: Inside the main function, do not put any FreeRTOS code before the hardware has had a chance to initialise.
@AndrewST check if anywhere in your main function there is FreeRTOS code before all the init's?