cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot ping using LWIP+FreeRTOS on Nucleo-F746ZG

ZBru
Associate II

Hi everyone, I'm new in this field. I was trying to integrate FreeRTOS with my TCP Server. While without FreeRTOS everything works fine, with FreeRTOS I cannot even make a simple ping. I'm looking everywhere for a solution but there aren't solutions that seem to work.

The steps that I follow are:

  1. Opening STM32CubeIDE 1.10.1
  2. Selecting my board
  3. Configuring the ETH as RMII and the relative's pins (in particular the pins PG11 and PG13)
  4. I enable LWIP and configure: the Driver_PHY as LAN8742, the DHCP as static (with relative addresses assignments) and the MEM_SIZE as 10*1024.
  5. I enable FreeRTOS and I set it to enable the USE_NEWLIB_REENTRANT.
  6. Finally, I set TIM6 as the Timebase source and I generate the project.

No warnings or errors are shown. In the main, I can see in the DefaultTask the MX_LWIP_Init(). Then I program the board and I try to ping it without success.

Can anyone help me to find out the problem?

3 REPLIES 3
ZBru
Associate II

Edit: I solved selecting CMSIS_v1 (instead of CMSIS_v2) and by increasing the stack size of the default task from 128 to 256.

Now I avoid hard faults and I can ping.

Everything is nice and good but using CMSIS_v1 is a huge constraint since there are a lot of libraries that make use of CMSIS_v2. Thus, roughly speaking I can say that the problem persists. So, anyone who is aware of a method to make stm32f7xx with LwIP stack + FreeRTOS (CMSIS_v2) work of have some suggestions is very welcome.

ZBru
Associate II

First of all, thank you @Piranha​. I saw you put a lot of effort into the ethernet issue.

My problem is related to the tx-deadlock. I made the changes you suggested here: https://community.st.com/s/question/0D53W00001oImr4SAC/bug-stm32-lwip-ethernet-driver-tx-deadlock for the semaphores initialization. Moreover, I have also updated the ethernet link thread as follows:

void ethernet_link_thread(void* argument){
//.....
 
   struct netif *netif = (struct netif *) argument;
/* USER CODE BEGIN ETH link init */
  /* ETH_CODE: call HAL_ETH_Start_IT instead of HAL_ETH_Start
   * This is required for operation with RTOS.
   * This trick allows to keep this change through
   * code re-generation by STM32CubeMX
   */
#define HAL_ETH_Start HAL_ETH_Start_IT
  /* ETH_CODE: workaround to call LOCK_TCPIP_CORE when accessing netif link functions*/
  LOCK_TCPIP_CORE();
/* USER CODE END ETH link init */
 
 
//.....
 
if(linkchanged)
    {
      /* Get MAC Config MAC */
      HAL_ETH_GetMACConfig(&heth, &MACConf);
      MACConf.DuplexMode = duplex;
      MACConf.Speed = speed;
      HAL_ETH_SetMACConfig(&heth, &MACConf);
      HAL_ETH_Start(&heth);
      netif_set_up(netif);
      netif_set_link_up(netif);
    }
 
//..
 
/* USER CODE BEGIN ETH link Thread core code for User BSP */
 
  /* ETH_CODE: workaround to call LOCK_TCPIP_CORE when accessing netif link functions*/
    UNLOCK_TCPIP_CORE();
    osDelay(100);
    LOCK_TCPIP_CORE();
    continue; /* skip next osDelay */
 
/* USER CODE END ETH link Thread core code for User BSP */
 
//...
}

Nonetheless, I still can't ping because I'm stuck on the osSemaphoreAcquire. In particular, I'm locked in queue.c on the instruction:

configASSERT (pxQueue-> uxItemSize == 0);

I also looked at your post: https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32 without finding a solution related with my problem. Do you have any other suggestions?