2024-04-09 01:53 PM
Hi,
I would like to setup a system with a telnet server and I'm trying to follow this guide: https://controllerstech.com/stm32-ethernet-4-tcp-server/ but unfortunately, upon launch, the system gets stuck at line1438 in queue.c:
/* Cannot block if the scheduler is suspended. */
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
}
#endif
it's a bit odd because it appears like when I don't change the MEM_SIZE variable but leave it its default (1600) it appears to not be stuck after creation of the config but once I change it to 10*1024 (as it's shown in the link above) I do not seem to be able to undo it anymore but it keeps getting stuck on call to MX_LWIP_Init(). Why is this I'm wondering and how can I fix it?
2024-04-09 02:17 PM
The code gets 'stuck" in queue.c because some function is waiting for a queue (or mutex) with a non-zero "wait" param BEFORE the FreeRTOS scheduler has started (osKernelStart() called). That is not allowed - as the comment says, tasks cannot be suspended if the scheduler is not (yet) running.
Where in MX_LWIP_Init() is the code getting "stuck"? Use the debugging tools, trace/step through the function.
If you are using dynamic allocation for your tasks, mutexes, queues, etc. then you definitely need to set MEM_SIZE much larger than the default 1600. I don't know what you mean by "do not seem to be able to undo it anymore".
2024-04-10 06:21 AM - edited 2024-04-10 06:33 AM
Hm? I've set MEM_SIZE to 10240 B now, would that be sufficient?
My application is empty at the moment, I just configured the empty framework in CubeIDE. I haven't modifed anything in the init sequence and my StartDefaultTask() function only looks like this:
void StartDefaultTask(void const * argument)
{
/* init code for LWIP */
MX_LWIP_Init();
/* USER CODE BEGIN 5 */
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END 5 */
}
the init sequence is:
osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
and the call stack when it hangs looks like this:
What I see is happening is:
any hints on how I can fix this? I've attacghed the empty project as *.7z file
2024-04-10 09:57 AM
Do you call osKernelInitialize()?
2024-04-10 01:47 PM
> Do you call osKernelInitialize()?
No, I don't see it being called anywhere but when I look at the implementation in cmis_os.c on line 141, it just shows the prototype without any content in the function:
/*********************** Kernel Control Functions *****************************/
/**
* @brief Initialize the RTOS Kernel for creating objects.
* @retval status code that indicates the execution status of the function.
* @note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.
*/
osStatus osKernelInitialize (void);
not sure abou this, looks like it might have been kept for backwards compatibility or something?
2024-04-17 01:57 PM
Are you using CMSIS ver 1 or ver 2? In cmsis_os2.c that function is defined and initializes the RTOS heap regions and sets the kernel state (which is needed by osKernelStart()). I can't speak to CMSIS ver 1, never used it.
2024-10-01 11:27 AM
Hi, I am having the same problem but I don´t know how to proceed, Do you find the solution to this problem?
Thanks in advance.
2024-10-08 02:43 PM
EXACTLY the same problem - getting "stuck" at the same line of code? If not, then explain exactly what you are seeing. And answer the questions that were asked above. Then we might be able to help.
2024-10-08 11:05 PM
I have the same problem that is represented in the capture, I get stuck at the same point. I have seen this problem in a nucleo-f439zi. I have tested also the cmsis os v2 and it doesn´t work either. This problem happened with the cmsis os v1. I think that the problem is because of a wrong configuration in LWIP or FreeRTOS.
2024-10-09 12:06 AM
Please check the stack size of the thread . .