Quality RTOS & Embedded Software

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


Interrupt and Task Synchronization Issue when using Semaphore.

Posted by naveenkumarbece on March 17, 2016

Interrupt and Task Synchronization Issue when using Semaphore.

Scenario: I have one ISR and one FreeRTOS Task. The ISR copies the data into queue whenever the ISR occurs. and FreeRTOS Task copies the data whenever there are some data in the queue. It is synchronsied using Semahpores.

If the interrupt calls evvery 100/10 ms, everything fine. if the interrupt calls every 1ms/100m micro seconds, the FreeRTOS task is not reading anything from the FIFO and the buffer overflows at the ISR Side.

Since, the ISR takes the Semaphore always, it seems that the FreeRTOS is not copying the data and in the blocked or suspended mode.

Any idea how to handle this scenario? any other way other than Semaphore?

ISR { Semaphore takefrom ISR(); // Copies data into static queue Semaphore givefrom ISR();


FreeRTOS Task { Semaphore take(port_MaxDelay); // Receives data from the static queue Semaphore give(); }

Interrupt and Task Synchronization Issue when using Semaphore.

Posted by hs2sf on March 18, 2016

You should try to reduce the interrupt rate (e.g. add an ISR private buffer to collect some more date before putting it into the shared, sem.protected Q). I guess your system is just overloaded when using the higher interrupt rate ie. is busy with ISR processing and there is no chance for the task to get into running state.

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

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

Latest News

Meet us at Embedded World. Hall 3A-525.

Hear from Richard Barry at Embedded World. Feb 28, 16:00, Hall 4-428.

Video: Watch James Gosling & Richard Barry at re:Invent, Las Vegas 2017.

FreeRTOS kernel V10.0.1 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