Quality RTOS & Embedded Software

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


Loading

Message processing time

Posted by Richard on November 12, 2012
If I post a message from an ISR does that message get immediately processed by the RTOS and acted upon or does it only get acted upon at the next RTOS tick?

RE: Message processing time

Posted by Richard Damon on November 12, 2012
If the ISR activates the scheduler (The method is port specific) then a task waiting on the queue/semaphore the ISR acted on (if it is now the highest priority ready task) will be activated, otherwise it will need to wait for the next time the scheduler is activated, which should be no later than the next tick (assuming it becomes the highest priority waiting task).

RE: Message processing time

Posted by Richard on November 12, 2012
If you call a function from an interrupt that causes a task to unblock, and the task that unblocks has a priority above or equal to the currently running task, then the interrupt will return directly to the unblocked task if you tell it to.

Here is a generic example. Note this uses a macro call portEND_SWITCHING_ISR(). In some ports this is called portYIELD_FROM_ISR(), which does the same thing.

void Dummy_IRQHandler(void)
{
long lHigherPriorityTaskWoken = pdFALSE;

/* Clear the interrupt if necessary. */
Dummy_ClearITPendingBit();

/* This interrupt does nothing more than demonstrate how to synchronise a
task with an interrupt. A semaphore is used for this purpose. Note
lHigherPriorityTaskWoken is initialised to zero. */
xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );

/* If there was a task that was blocked on the semaphore, and giving the
semaphore caused the task to unblock, and the unblocked task has a priority
higher than the current Running state task (the task that this interrupt
interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE
internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the
portEND_SWITCHING_ISR() macro will result in a context switch being pended to
ensure this interrupt returns directly to the unblocked, higher priority,
task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
}


Regards.

RE: Message processing time

Posted by Richard on November 12, 2012
Awesome - this is the first time I've needed to use the HigherPriorityTaskWoken flag and had forgotten about this behavior - that's most likely our issue.

If most of our tasks are at the same priority, then will returning TRUE cause a task of the same priority level (assuming it is running) to be immediately preempted?

Many thanks Richard.
Regards
travfrog


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


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

Latest News

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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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