Quality RTOS & Embedded Software

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




Loading

Multiple tasks woken from ISR in V5.0.2?

Posted by Jeff Henshaw on June 26, 2008
I'm running V5.0.2 on an Atmel AT3UCA0512. The UART ISR handles both transmitter empty and receiver full interrupts by either pulling a character from a queue or posting a character to a queue. If both conditions are simultaneously true then the ISR could potentially activate TWO tasks.

Is this possible, or illegal, or what? How would I handle this? Would I detect that the 1st task has been activated and ignore the 2nd interrupt cause, leaving the IRQ to fire again and then handling the 2nd interrupt source? Or do I just note that a task was activated and let taskYIELD_FROM_ISR() figure it out?

RE: Multiple tasks woken from ISR in V5.0.2?

Posted by MEdwards on June 26, 2008
No problem.

void interrupt_routine( void )
{
int Woken = 0;

// Do something.

// Send to a task. Woken will be set
// to true if this send wakes a task.
xQueueSendFromISR(q, &Woken);

// Do something else.

// Send to another task. Again, Woken
// will be set to true if this send
// wakes a task.
xQueueSendFromISR(q2, &Woken);

// Two sends so you might have woken
// two tasks. FreeRTOS will have done
// this for you, but will always return
// to the highest priority ready task
// which might be one of the two tasks
// woken in this isr, or might be the
// task that was originally running
// anyway.
portYIELD_FROM_ISR(Woken);
}

RE: Multiple tasks woken from ISR in V5.0.2?

Posted by Jeff Henshaw on June 26, 2008
Great, thanks !!!


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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