Quality RTOS & Embedded Software

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


Loading

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 ]    [ 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