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

Synchronize Task To Absolute Time

Posted by dbeckwith01 on January 31, 2017

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


Synchronize Task To Absolute Time

Posted by heinbali01 on January 31, 2017

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.


[ 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