FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [September 2016 Threads] Task scheduling using calendarPosted 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 calendarPosted 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 calendarPosted 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 calendarPosted 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 calendarPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|