After my project program was built according to the specifications, I found that it could not run on the FreeRTOS system (I have investigated and it is not a memory shortage issue, nor should it be a priority issue). My S32DS compiler version is shown in the image below.
The task failed to be created. Does this version not support FreeRTOS? Or are there any special configuration requirements?
Hello @sunshine88 ,
The application is not actually stuck because of the sys_msleep(5000) call itself. The behavior indicates that the time base used by sys_now() is not incrementing. Therefore, the timeout condition inside sys_msleep() can never be reached.
In the OSIF configuration screenshot, OsIfUseSystemTimer is enabled and the operating system type is set to FreeRTOS. However, the references under OsIfCounterConfig_0, including the counter and system timer clock references, appear to be incomplete or empty. Adding the PIT component alone does not guarantee that the OSIF time base is correctly configured and initialized.
Please do not modify the TCP/IP Stack source code or implement another delay workaround at this point. Instead, I recommend the following:
lwip_FreeRTOS_s32K358 example from the installed TCP/IP Stack package.sys_now() increments in the original example.We still need the information requested previously to analyze the custom project correctly:
lwip_FreeRTOS_s32K358 example works on the same hardware;sys_now();xTaskGetTickCount() is increasing.Please first check xTaskGetTickCount(). If it increases while sys_now() remains constant, the FreeRTOS scheduler and tick interrupt are running, and the problem is specifically in the OSIF time-base configuration or initialization. If xTaskGetTickCount() also remains constant, the problem is more fundamental and the FreeRTOS tick interrupt or scheduler configuration must be investigated.
If possible, please also provide the complete project archive rather than configuration screenshots only. Without the generated configuration and initialization code, it is not possible to determine which timer or clock source is actually used by sys_now().
Best regards,
Pavel
Hello, I have created an LWIP program routine, but the Ethernet mainLoopTask task is stuck at sys_msleep(5000); unable to delay. When I step into this function, I find that startTime = sys_now(); the sys_now() function cannot count. My current configuration page is as follows. What could be causing this? I'm very confused.
Hello @sunshine88 ,
The versions shown in your screenshots should support FreeRTOS. S32 Design Studio 3.5 Update 14, RTD 4.0.0, FreeRTOS 4.0.0, and TCP/IP Stack 1.0.4 appear to be the expected package combination, so this does not look like a general version compatibility issue.
According to the code shown, the failure occurs directly in xTaskCreate(). Could you please provide the following information?
Please note that sufficient total MCU RAM does not necessarily mean that sufficient FreeRTOS heap is available. xTaskCreate() dynamically allocates both the task control block and the task stack from the FreeRTOS heap. Also, the 1024U stack-depth argument normally represents stack elements rather than bytes, so the actual allocation is larger than 1024 bytes on the Cortex-M7.
As a baseline test, I recommend importing and running the original lwIP FreeRTOS example without modifications. Once the original example works, please add the additional task with a small stack, a normal priority, and a vTaskDelay() call inside its loop. This will help distinguish an environment or board configuration problem from an issue introduced by the additional task.
Best regards,
Pavel