2022-11-04 09:08 AM
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:
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?
2022-11-07 09:28 AM
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.
2022-11-07 01:11 PM
Most likely the particular issue is because of this:
https://community.st.com/s/question/0D53W00001oImr4SAC/bug-stm32-lwip-ethernet-driver-tx-deadlock
Anyway...
2022-11-08 04:25 AM
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?