Quality RTOS & Embedded Software

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


Using portYIELD_FROM_ISR with STM32F4 while trigger a task on an external event

Posted by dcorreia on January 28, 2016

I am trying to properly understand how portYIELDFROMISR() works. I am having some funny behavior in my code. Let consider the following 1.Premeption is enabled 2.I have a highest priority task waiting on a semaphore to be given. A context switch may or have occured 2.The ISR runs and portYIELDFROMISR() is called because a highest prioirty task was waiting

At what point does the RTOS tell the highest priority task to run. 1. Does the highest priority task know it has to run before the next premetive context switch OR 3. Does it have to wait until another premeption event occours before the context switch can occour. Which would make it run

**Additional information **

The reason I am asking this is because my RTOS tick is 200Hz, but the interrupt that drive one of my task is 1kHz. So this task must run at 1kHz rate no exceptions. But that task also has to wait another semaphore to be release by DMA receive interrupt. The DMA RX semaphore has timeouts but these timeouts are obvoisly reference againts the 200Hz tick interrupt. So if a context switch can only occur when a prempetion event occurs (i.e 200Hz) that means portYIELDFROMISR() does not do what I intend it to do.

Some other notes 1. The DMA RX interrupt will always run before the next 1kHz interrupt. This is guaranteed 2. Interrupt prioirty are setup so that the RX DMA interrupt has a higher prioirty than the 1Khz interrupt..

Using portYIELD_FROM_ISR with STM32F4 while trigger a task on an external event

Posted by richard_damon on January 29, 2016

An ISR calling portYIELDFROMISR cause a context switch to the now highest priority ready task, in effect, making the currently running task do a yield. Basically, the timer tick in effect calls portYIELDFROMISR every timer tick if time slicing is enabled or if after updating timeout timers some higher priority task is now ready to run.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists