FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [October 2015 Threads] Task stops executing and disappears while other tasks continues normallyPosted by inimicus8 on October 12, 2015 Hi
I have a task that I resume from an interrupt. After some time (10 minutes too several hours) the task that gets resumed from the interrupt stop executing. This while all other tasks continues to function normally.
Interrupt code:
void CANRXInterrupt( void )
{
………..
xYieldRequired = xTaskResumeFromISR( canHandle );
portYIELDFROMISR( xYieldRequired );
}
OS Task code:
while (1)
{
CAN_ReceiveRoutine();
vTaskSuspend( NULL );
}
When I call vTaskList() after the task have stopped working the effected task does not appear in the list anymore.
vTaskList() before CAN_T task stops executing:
Name State Priority Stack Num
ShellT R 5 300 4
CANT R 1 428 3
IDLE R 0 491 6
IRT B 3 482 2
ErrorT B 6 483 5
Main_T B 2 460 1
Tmr Svc B 2 993 7
>
vTaskList() after CAN_T task stops executing:
Name State Priority Stack Num
ErrorT R 6 483 5
IDLE R 0 491 6
ShellT B 5 300 4
IRT B 3 477 2
MainT B 2 460 1
Tmr Svc B 2 993 7
I don’t think its stack overflow because I don’t end up in the vApplicationStackOverflowHook() and there seems to be plenty of memory still available when I call vTaskList() before the task stops working. I also don’t get caught in the configASSERT .
Anyone having a clue what could be wrong here?
Why does the task disappear from the vTaskList()?
Info about platform: MCU: stm32f407: IDE: coocox 2.0.3. toolchain: gcc 4.8 2004. RTOS: FreeRTOS V8.2.2
Task stops executing and disappears while other tasks continues normallyPosted by rtel on October 12, 2015 If you are using the task suspend/resme mechanism to synchronise a task with an interrupt, then please don't, it is a dangerous technique to use. Please read the documentation page of the xTaskResumeFromISR(), and other posts in this forum where people have experienced the same issue.
The best and fasted way to do what you want is to use a direct to task notificiation. See http://www.freertos.org/vTaskNotifyGiveFromISR.html
Regards.
Task stops executing and disappears while other tasks continues normallyPosted by inimicus8 on October 12, 2015 Thank you for the reply! :-)
I have tried using the vTaskNotifyGiveFromISR( canHandle, NULL ) but the program only runs for a couple of minutes before it ends up in the HardFault_Handler().
If I don’t call the portYIELDFROMISR( pdTRUE ) the program seems to work fine but the task is not started directly after the interrupt and that is not acceptable.
I don’t know why I get this problem but I guess it might have something with the interrupt priority settings. But as I understand it I think the settings are correct.
The interrupt priority for the interrupt calling vTaskNotifyGiveFromISR() and portYIELDFROMISR() is the following:
~~~~
NVICPriorityGroupConfig(NVICPriorityGroup4);
NVICInitStructure.NVICIRQChannel = CAN1RX0IRQn;
NVICInitStructure.NVICIRQChannelPreemptionPriority = 15;
NVICInitStructure.NVICIRQChannelSubPriority = 15;
NVICInitStructure.NVICIRQChannelCmd = ENABLE;
NVICInit(&NVIC_InitStructure);
~~~~
This should be the lowest interrupt priority.
The freeRTOS config settings are:
~~~~
define configLIBRARYMAXSYSCALLINTERRUPTPRIORITY 5
define configKERNELINTERRUPTPRIORITY 255
define configMAXSYSCALLINTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11.
define configLIBRARYKERNELINTERRUPT_PRIORITY 15
~~~~
Task priority is:
xTaskCreate( CAN_Control_Task, ( const char * ) "CAN_T", configMINIMAL_STACK_SIZE, NULL, 1, &canHandle );
Anyone having a clue of why I end up in hard fault when I use vTaskNotifyGiveFromISR and portYIELDFROMISR from an interrupt? Or how I investigate further how to track down the fault?
Task stops executing and disappears while other tasks continues normallyPosted by rtel on October 12, 2015 Try setting the SubPriority to 0. Are you also calling
NVICPriorityGroupConfig( NVICPriorityGroup_4 );?
(http://www.freertos.org/RTOS-Cortex-M3-M4.html). Do you have configASSERT()
defined? Do you have stack overflow checking turned on?
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|