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] [January 2017 Threads]
In our application, we want data collection and transmission to be synchronized to absolute time. For example, we want a specific transmission to occur every hour at the top or bottom of the hour. If we use the standard FreeRTOS APIs such as software timers or task delays, then our system is based on relative time from the last power up or reset.
My question is what is the best way to go about synchronizing specific events to absolute time. My thinking was to use a separate hardware timer that maintains an epoch. This epoch timer would get set to absolute time via GPS or some other method. Once this timer expired it would single an event to the task that maintained a count. Once that count reached count % 3600 == 0
then it would be time to transmit.
Thoughts? Is there an easier way to do this?
Thanks,
Darren
There will be many solutions for that.
I would also choose for a time source other than the kernel timer tick, just to keep them independent. I often use NTP as a time source and use one of the hardware timers to continue counting. Sometimes a small correction must me made due to XTAL's that aren't perfect.
Care must be taken when a few seconds are skipped, after a time correction. I would calculate the expiration time and wait for e.g. count > 0x58904C8D
, and do not use %
and ==
.
Starting in January 2038, the signed 32-bits notation (time_t
) will become negative. So it might be worth using unsigned or move to a 64-bit notation.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.