Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

State task Delayed

Posted by witc on February 3, 2019

Hi,

I am using FreeRTOS 9 with STM32L152. I use implementation from CUBEMX. I have 2 questions: 1) When I run my code, sometimes after for example 1 hour of running my code, the watchdog in my code resets the MCU. When I debuged it I found out, that the TASK B is in some weird state. FreeRTOS Task list in True Studio shows that the the state of Task B is DELAYED - waht does it mean? I did not found this state any where - there are written only states like Blocked, Running,... The Task become in running state but it takes some time.

2) Sometimes I can see in Percepio TraceAlyzer, that some task has prepared a new message in queue, but the FreeRTOS still persist in Idle (in my case tickless - MCU is in STOP mode). Why the FreeRTOS does not run the corresponding task where isxQueueReceive(QueueCoreHandle, &ReceiveData, portMAX_DELAY); See the picture in attachement.

Thank you very much. Jan.


State task Delayed

Posted by rtel on February 3, 2019

1) When I run my code, sometimes after for example 1 hour of running my code, the watchdog in my code resets the MCU. When I debuged it I found out, that the TASK B is in some weird state. FreeRTOS Task list in True Studio shows that the the state of Task B is DELAYED - waht does it mean? I did not found this state any where - there are written only states like Blocked, Running,... The Task become in running state but it takes some time.

Not familiar with that plug-in, but I'm going to guess they are using Delayed for what we call Blocked.

2) Sometimes I can see in Percepio TraceAlyzer, that some task has prepared a new message in queue, but the FreeRTOS still persist in Idle (in my case tickless - MCU is in STOP mode). Why the FreeRTOS does not run the corresponding task where is|xQueueReceive(QueueCoreHandle, &ReceiveData, portMAX_DELAY);| See the picture in attachement.

Do you use the 'xHigherPriorityTaskWoken' parameter in the function used to write to the queue from the ISR? If not then the task switch won't happen until the next tick.

Attachments

FreeRTOS.png (88703 bytes)

State task Delayed

Posted by witc on February 3, 2019

Hi, thank you for fast reply! 1) They use Blocked too - it means the Delayed is something different 2) I use it like this: ~~~ signed portBASE_TYPE xHigherPriorityTaskWoken; xHigherPriorityTaskWoken=pdFALSE;

LL_TIM_DisableCounter(TIM6);

/* Watchdog checking */
SendData.Address=ADDR_CORE_TIME_TO_CHECK_WATCHDOG;

if (xQueueSendToFrontFromISR(QueueCoreHandle, &SendData,&xHigherPriorityTaskWoken)!=pdPASS)
{
	SendErrorCode_AND_Reset(0,0);
}

portYIELD_FROM_ISR(xHigherPriorityTaskWoken);

~~~

Attachments

FreeRTOS.png (88703 bytes)

State task Delayed

Posted by rtel on February 3, 2019

1) They use Blocked too - it means the Delayed is something different

Maybe they differentiate between a task that is blocked on an event (like waiting for something from a queue) and a task that has called either vTaskDelay() or vTaskDelayUntil()? Just guessing though - is there any documentation for the plug-in?

2) I use it like this:

Code looks fine. Can you step into the function to see why it doesn't switch?

Attachments

FreeRTOS.png (88703 bytes)

State task Delayed

Posted by witc on February 6, 2019

Hi Richard,

Now I can not replicate the state. But I can reliably replicate this similar problem (see a picture): TaskRF ends up with command vTaskDelay(2); And even if TaskRF has a new message in the Queue, the Task is stopped and Idle becomes running. There are no Any semaphores, or mutexes... The code can run in this area many times, but after some time it ends there. Do you have any idea why this happen?

Best Regards, Jan.

Attachments

Richard.png (115807 bytes)

State task Delayed

Posted by richard_damon on February 6, 2019

Well a call to vTaskDelay(2) means to block the calling task for 2 timer ticks, doesn't matter if there is some other queue with data.

Attachments

FreeRTOS.png (88703 bytes)

State task Delayed

Posted by witc on February 6, 2019

Sure, I understand it. But the FreeRTOS spends in IDLE much more time than only 2 (in ma case ms).

Attachments

FreeRTOS.png (88703 bytes)


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Mediatek

Renesas

RISC-V

SiFIve RISC-V

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner