Quality RTOS & Embedded Software

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




Loading

Using an ISR - Semaphore to unblock a task

Posted by stmiko on May 5, 2010
Hello,

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

Stephan

RE: Using an ISR - Semaphore to unblock a task

Posted by stmiko on May 5, 2010
Hello,

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

while(1)
{
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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

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