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




Loading

Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by sminder on March 31, 2014

Hello. I've got a problem when I use a task unfreezing through xSemaphoreTake() function. I have a task that waiting a semaphore which set in an appropriate interrupt. But a measurement of period of time between a moment of set the semaphore and a moment when the task release him makes me unhappy. It takes too much time (up to 1 ms) and this period is very unstable. The task has maximal priority. Semaphore is binary. Can I minimize this period?


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by richard_damon on March 31, 2014

Does your ISR check the "wasWoken" flag and initiate a task reschedule? If not, the system will wait till the next timer tick.

How to do that is a bit port dependent.


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by sminder on April 1, 2014

Rescheduling was a good idea. Richard, thanks a lot!


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by sminder on August 5, 2014

I rejoiced too soon. I use the xTimerResetFromISR() function in my interrupt subroutine for restarting my software timer. After a start of device it looks like good, but if I use this function again the time between call of the xTimerResetFromISR() and the first triggering of the software timer differ times from time. I use the portENDSWITCHINGISR(false) function in the end of the interrupt subroutine.


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by rtel on August 5, 2014

Timer callbacks execute in the timer service task, which is scheduled just like any other task. Do you have the priority of the task set higher than the application tasks so it runs immediately?


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by richard_damon on August 6, 2014

portENDSWITCHINGISR(false) means that no task switch will be performed.

It should be portENDSWITCHINGISR(wasWoken)


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by sminder on August 8, 2014

Thanks a lot for all your advices. I decided it is impossible to use the RTOS software timer for hard period intervals so I decided to use hardware timer for this matter.


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by richard_damon on August 8, 2014

Timers in FreeRTOS have a precision of 1 timer tick, as that is what they are based on. A timer will always trigger a a particular tick of the timer, there is no way to use them to trigger an operation in the middle of a tick period. That says that with a 1 ms tick period (which is what the demos you, but is actually faster then I find I normally need), a "1 tick" timer may go off practically immediately if it is started just before the tick interrupt occurs, up to nearly a full ms if it is started just after the tick interrupt.

This sort of variability is inherent in a global tick based time system.

If you really need something to happen a precise time after something else (with mill-second or better accuracy), then yes, you need an independent hardware timer of some sort.


Too much time between xSemaphoreGiveFromISR and xSemaphoreTake()

Posted by sminder on August 15, 2014

Thanks a lot for your explanation


[ 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