Quality RTOS & Embedded Software

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


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