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 an ISR - Semaphore to unblock a task

Posted by stmiko on May 5, 2010

I´ve got some "problems" with the named topic. I using a task to calculate some date which i get from an ISR. When the task is blocked with vTaskDelay it works without problems, but i want to start the task only when it get a ready state from the ISR.
This is realized with xSemaphoreGiveFromISR() and in the task with an if - request and xSemaphoreTake(). The problem is, that i can´t stop this task, when it once jumped into the task, which uses the xSemaphoreTake().
In the ISR there is also a context switch with portEND_SWITCHING_ISR() because the unblocked task has the highest priority.

The second problem is, it seems, that after starting the scheduler he goes to the blocked task and don´t stop at the "if - semaphore - request"?

Does any know this problem? I using the Version 5.2.0 of FreeRTOS


RE: Using an ISR - Semaphore to unblock a task

Posted by stmiko on May 5, 2010

according to the first problem, i have found the reason. It has nothing to do with FreeRTOS...
But how can i avoid, that the task will run one time after starting the scheduler?

RE: Using an ISR - Semaphore to unblock a task

Posted by Dave on May 5, 2010
Take the semaphore before entering the task loop.

void atask( void *p )
xSemaphoreTake(sem,0); // dont block

xSemaphoreTake(sem,max_delay); // now you will block here because the semaphore is not available

// do something

RE: Using an ISR - Semaphore to unblock a task

Posted by stmiko on May 5, 2010
Thank you for this information, it works...

[ 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