Quality RTOS & Embedded Software

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


Loading

taskYIELD in an ISR

Posted by lafleur on October 7, 2011
In the dsPIC33 demo, the serial driver interrupt routine has a taskYIELD, but in the Using the FreeRTOS Real Time Kernel, Sep 2011 edition (for the PIC32) stated that only API that end with FromISR are allowed in ISR... why is this an exception?? and not documented??

thanks...

also, in Microchips MPLAB Ver 8.76 there is a FreeRTOS viewing tool for displaying information on the current program... It display information on Task and CoRoutines, but never on Queues??? is it outdated??

void __attribute__((__interrupt__, auto_psv)) _U2RXInterrupt( void )
{
char cChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;

/* Get the character and post it on the queue of Rxed characters.
If the post causes a task to wake force a context switch as the woken task
may have a higher priority than the task we have interrupted. */
IFS1bits.U2RXIF = serCLEAR_FLAG;
while( U2STAbits.URXDA )
{
cChar = U2RXREG;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
}

if( xHigherPriorityTaskWoken != pdFALSE )
{
taskYIELD();
}
}

RE: taskYIELD in an ISR

Posted by Richard on October 7, 2011
“In the dsPIC33 demo, the serial driver interrupt routine has a taskYIELD, but in the Using the FreeRTOS Real Time Kernel, Sep 2011 edition (for the PIC32) stated that only API that end with FromISR are allowed in ISR”


The PIC32 book is for the PIC32, which in architecture terms is about as far away from a dsPIC as you can get. Why would it talk about an exception for a dsPIC any more than it would for a Cortex-M3?

Not calling a function that does not end in FromISR from an ISR is a very good general rule in all cases. Some, but not many, ports can tolerate taskYIELD() being called from an ISR, provided it is the last instruction in the ISR. In most cases, where this is the case, the call to taskYIELD() is hidden behind a macro called portYIELD_FROM_ISR(), or portEND_SWITCHING_ISR(). The PIC24/dsPIC port is rather old, and that is probably why it was not done in that case. The documentation page for that port (http://www.freertos.org/portpic24_dspic.html) does however say how it is done, albeit rather briefly.


“also, in Microchips MPLAB Ver 8.76 there is a FreeRTOS viewing tool for displaying information on the current program... It display information on Task and CoRoutines, but never on Queues??? is it outdated?? ”


See configQUEUE_REGISTRY_SIZE on http://www.freertos.org/a00110.html and
http://www.freertos.org/vQueueAddToRegistry.html

Regards.

RE: taskYIELD in an ISR

Posted by Samuel on October 14, 2011
We bought two documents from website, I get confused about "xSemaphoreGiveFromISR()".

1. In document "FreeRTOS Reference Manual", in page93,
void VISR( void *pvParameters)
{ .....
taskYIELD_FROM_ISR( xHigherPriorityTaskWoken);
}

2. In document " Using the RTOS REal Time Kernel" ARM Cortex-M3 Edition, page 93

void vSoftwareInterruptHandler (void)
{
...
portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
}.

My question is:
I can't find the function prototype for taskYIELD_FROM_ISR( ) and portEND_SWITCHING_ISR().

Regards
Samuel

RE: taskYIELD in an ISR

Posted by Richard Damon on October 14, 2011
These are macros in port macro.h (for the appropriate port). The exact method used to end an interrupt depends on the port.


[ 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