Quality RTOS & Embedded Software

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


Semaphore/vTaskResume - 7.3.0

Posted by Westmoreland Engineering on November 2, 2012
First - Richard - I haven't had a chance to go through the new items in v7.3 - but for the low power additions - anything there specific for the MSP430 in the updated kernel? I will take a look.

2nd question - just a sanity check:
I have a semaphore that is given from an ISR periodically from a Timer IRQ. There is a task that blocks on this - but the task is also resumed asynchronously to, but not necessarily so, by another task.
Question is - if the timer IRQ makes the semaphore available more than once - and the task isn''t resumed - is that a problem? The semaphore is a binary semaphore - the ones preferred to be used from a timer IRQ - correct?

Thanks In Advance,

RE: Semaphore/vTaskResume - 7.3.0

Posted by Richard on November 2, 2012
“anything there specific for the MSP430 in the updated kernel”

There is not yet anything specific to the MSP430. There are generic hooks that allow the tickless mode to be used with a little coding on the application site too, as explained here: http://www.freertos.org/low-power-tickless-rtos.html. The Cortex-M ports have a built in implementation, and other ports will do in the future.

“Question is - if the timer IRQ makes the semaphore available more than once - and the task isn''t resumed - is that a problem?”

So, if the task is being resumed, it must have been suspended? Is that correct?

If it is suspended while it is waiting for a semaphore, when it is resumed it will re-check to see if the semaphore is available. If the semaphore is not available then it will block again to wait for it (assuming any specified block time remains). If the semaphore is available it will take it and exit the xSemaphoreTake() function.

If an interrupt 'gives' the semaphore twice while the task is suspended then the task will recognise the semaphore is available when it is resumed, but it won't recognise that the semaphore has been given twice. If you need it to know the semaphore has been given twice then use a counting semaphore.

Whether a binary or counting semaphore is preferred depends on the application.


[ 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