RTEMS: Working with RTC

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Working with RTC
Board Support Packages » ARM » Atmel/Microchip SAM E70, S70, V70 and V71 » Contributed Code

The RTC driver provides the interface to configure and use the RTC peripheral.

It manages date, time, and alarms.
This timer is clocked by the 32kHz system clock, and is not impacted by power management settings (PMC). To be accurate, it is better to use an external 32kHz crystal instead of the internal 32kHz RC.
It uses BCD format, and time can be set in AM/PM or 24h mode through a configuration bit in the mode register.
To update date or time, the user has to follow these few steps :

- Set UPDTIM and/or UPDCAL bit(s) in RTC_CR,
- Polling or IRQ on the ACKUPD bit of RTC_CR,
- Clear ACKUPD bit in RTC_SCCR,
- Update Time and/or Calendar values in RTC_TIMR/RTC_CALR (BCD format),
- Clear UPDTIM and/or UPDCAL bit in RTC_CR.

An alarm can be set to happen on month, date, hours, minutes or seconds, by setting the proper "Enable" bit of each of these fields in the Time and Calendar registers. This allows a large number of configurations to be available for the user. Alarm occurrence can be detected even by polling or interrupt.

A check of the validity of the date and time format and values written by the user is automatically done. Errors are reported through the Valid Entry Register.

For more accurate information, please look at the RTC section of the Datasheet.

Related files :
rtc.c
rtc.h.