当前位置:文档之家› STM32L4实时时钟模块(RTC)介绍

STM32L4实时时钟模块(RTC)介绍


64
• Alternate function inputs:
• RTC_TAMP1: tamper1 event detection. • RTC_TAMP2: tamper2 event detection. • RTC_TAMP3: tamper3 event detection. • RTC_TS: timestamp event detection. • RTC_REFIN: reference clock input.
Presentation Title 02/07/2015
RTC Features (2/2)
• Alternate function outputs:
• RTC_CALIB: 512 Hz or 1Hz clock output (with an LSE frequency of 32.768 kHz). It is routed to the device RTC_OUT output. • RTC_ALARM: Alarm A, B flag output. It is routed to the device RTC_OUT output.
No VBAT
YES
3 pins/ 3 events
Edge or Level Detection with Configurable filtering External interrupt and NO trigger with filtering 32-bit Backup registers 20 32
• The RTC remains active what ever the low power mode
• Sleep, Stop 1 & 2, Standby, Shutdown
70
• When enabled, 5 events can exit the device from low power modes:
1. Write ‘0xCA’ into the RTC_WPR register 2. Write ‘0x53’ into the RTC_WPR register * Except for the clear of Alarm and Wakeup timer interrupt flags Writing a wrong key reactivates the write protection.
• Alarm A • Alarm B • Wakeup • Tamper 1/ 2 / 3 • TimeStamp
• The RTC remains active in VBAT mode (VDD off) when clocked by LSE • The RTC remains active under Reset except at Backup Domain Reset:
• When BDRST is set in the RCC • When both VDD and VBAT are powered down
70
RTC Alternate function configuration (1/2)
RTC pin (PC13) :
Pin configuration and function Alarm out output OD Alarm out output PP Calibration out output PP TAMPER1 input floating TIMESTAMP and TAMPER input floating TIMESTAMP input floating RTC_ALARM enabled (OSEL[1:0])
YES YES
YES Resolution down to RTCCLK YES
2 w/ subseconds Calib window : 8s/16s/32s Calibration step: 3.81ppm/1.91ppm/0.95 ppm Range [-480ppm +480ppm]
RTC overview across families (2/2)
Alarm B
TimeStamp Flag
RTCSEL [1:0] HSE / 32 LSE LSI
Smooth Calibration
=
ssr, ss, mm, HH/date Alarm A ssr, ss, mm, HH/date
Calendar
Alarm B Flag
RTCCLK
=
Alarm A Flag
Calendar
RTC_ALARM
ssr (binary format)
Asynchronous 7bit Prescaler Synchronous 15bit Prescaler
PREDIV_A [6:0]
PREDIV_S [14:0] 1 Hz
Day/date/month/year HH:mm:ss (12/24 format)
63
• Digital calibration circuit (periodic counter correction) to achieve 0.95 ppm accuracy • Time-stamp function for event saving with sub second precision (1 event) • 32 backup registers (128 bytes) which are reset when an tamper detection event occurs.
• The RTC clock source could be any of the following three:
• LSE oscillator clock : available in all LP modes + VBAT. • LSI oscillator clock : available in all LP modes except Shutdown. • HSE divided by 32 in clock controller.
01 or 10 or 11 1 01 or 10 or 11 Don’t care 1 00 00 00 01 or 10 or 11 00 00 01 or 10 or 11 00 00 01 or 10 or 11 00 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 01 or 10 or 11
Presentation Title 02/07/2015
RTC overview across families (1/2)
65 65
STM32F4x
STM32L1x
STM32L4x
RTC in VBAT Calendar in BCD Calendar Sub seconds access Calendar synchronization on the fly Alarm on calendar Calendar Calibration
STM32F4x Synchronization on mains Periodic wakeup Timestamp STM32L1x STM32L4x YES YES YES Sec, Min, Hour, Date, Sub seconds NO 3 pins/ 2 events
66 66
Timestamp on VBAT switch Tamper
RTC_CALIB 512 Hz COSEL
Wake-Up
16bit autoreload Timer
Periodic wake up Flag
WUCKSEL [2:0]
RTC registers write protection
• By default and after reset, the RTC registers are write protected to avoid possible parasitic write accesses.
RTC Clock Sources
• The RTC has two clock sources:
• RTCCLK used for RTC timer/counter, can be either the HSE/32, LSE or LSI clocks. • PCLK1 used for RTC register read/write access.
• DBP bit must be set in PWR_CR to enable RTC write access • A Key must be written in RTC_WPR register.
68 68
• To unlock write protection on all RTC registers
STM32L4
Real-Time Clock (RTC)
RTC Features (1/2)
• Ultra-low power battery supply current. • Calendar with Sub seconds, seconds, minutes, hours, week day, date, month, and year. • Daylight saving compensation programmable by software • Two programmable alarms with interrupt function. The alarms can be triggered by any combination of the calendar fields. • A periodic flag triggering an automatic wakeup interrupt. This flag is issued by a 16-bit auto-reload timer with programmable resolution. This timer is also called ‘wakeup timer’. • A second clock source (50 or 60Hz) can be used to update the calendar. • Maskable interrupts/events: • Alarm A, Alarm B, Wakeup interrupt, Time-stamp, Tamper detection
相关主题