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

Task scheduling using calendar

Posted by sfross on September 14, 2016

Hi,

I was wondering what other community members would do or are doing for a application where a task in a RTOS that needs to fire at a given time or regular interval (e.g every hour starting at midnight).

I intend using Free RTOS on an EFM32GG to implemenet this feature.

I could find only one method after a goggle search. The task requests the calendar time, calculates the amount of time until it next needs fire and and the sleeps for this amount of time. It seems a bit in accurate, but since I have not tried it I suppose I cannot comment.

Applogies if I have posted this in the wrong place.

Thanks,

Ross


Task scheduling using calendar

Posted by davedoors on September 15, 2016

The accuracy of vTaskDelayUntil() depends on the accuracy of the crystal running the EFM. External crystals are extremely accurate. Low power internal crystals can be very inaccurate. The normal thing is to have a separate real time clock. The EFM probably has one built in. You can then check then trigger tasks from interrupts generated off the real time clock (easy) or use the real time clock to calibrate and adjust the rtos tick (harder).


Task scheduling using calendar

Posted by sfross on September 16, 2016

Hi Dave,

Thanks for your reply, I realise now that I was a bit vague in my comment about accuracy. In the examples I have seen the RTOS uses the hardware counter and there is a software time used for the calendar. The reason for this seems to be that, if they share the counter, the RTOS does not like a wild change in hardware counter when the calendar is synchronised.

My concern, possibly invalid, the two counter system may give inaccuracy in timing.

In a super loop example the calculation of the minutes in the day is done at the begging of the loop and any state machine within the look and do something based on the modulus of the result of this calculation with a given interval.

In the RTOS world, I guess I was hoping for a mechanism where the RTOS is instructed to fire a task(s) or generate a semaphore to the task(s). The task(s) would wake up or run and go back to sleep until the next event.

Ross


Task scheduling using calendar

Posted by richard_damon on September 16, 2016

I woud impement such a system using the RTOS clock to handle short term incremental timing (something needs to happen in 10 seconds), and some service running off that clock maintains the Time-of-Day clock, as well as the occational adjustments to correct the Time-of-Day. This service is then fires off the various requests for things at particular time marks.


Task scheduling using calendar

Posted by jackfarmersedge on September 16, 2016

If your controller has an RTC with a calendar function then set it to interrupt on your preset time of day. The interrupt routine sets a flag to wake up the task. That's how I do it on an STM32.


[ 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