STM32L4实时时钟模块(RTC)介绍
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
• 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:
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.
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.
OD: open drain; PP: push-pull.
71
RTC_CALIB enabled (COE)
Don’t care
RTC_OUT_RMP
RTC_ALARM_TYPE
Tamper 1 enabled (TAMP1E)
Don’t care
Time stamp enabled (TSE)
Don’t care
• 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])
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.
69
• Before to start using the RTC you have to program the clock controller :
• Configure and Enable the RTCCLK source in the RCC_BDCR register
69
RTC in Low Power Modes and in Reset
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 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
• 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:
0 0 1 0 1 Don’t care Don’t care
Don’t care Don’t care
Don’t care
Don’t care
Don’t care
Don’t care
1
0
Don’t care Don’t care 1 1
Don’t care Don’t care 0 1
Don’t care Don’t care 0 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)
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.
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.
• 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
YES
RTC Block Diagram
RTC_TAMP1 RTC_TAMP2 RTC_TAMP3 RTC_TS RTC_REFIN
Backup Registers and RTC Tamper Control registers
67 67
Tamper Flag
TimeStamp Registers
• 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.
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)
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
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
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
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
Байду номын сангаасTC 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
• Sleep, Stop 1 & 2, Standby, Shutdown
70
• When enabled, 5 events can exit the device from low power modes:
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.
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.
OD: open drain; PP: push-pull.
71
RTC_CALIB enabled (COE)
Don’t care
RTC_OUT_RMP
RTC_ALARM_TYPE
Tamper 1 enabled (TAMP1E)
Don’t care
Time stamp enabled (TSE)
Don’t care
• 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])
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.
69
• Before to start using the RTC you have to program the clock controller :
• Configure and Enable the RTCCLK source in the RCC_BDCR register
69
RTC in Low Power Modes and in Reset
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 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
• 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:
0 0 1 0 1 Don’t care Don’t care
Don’t care Don’t care
Don’t care
Don’t care
Don’t care
Don’t care
1
0
Don’t care Don’t care 1 1
Don’t care Don’t care 0 1
Don’t care Don’t care 0 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)
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.
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.
• 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
YES
RTC Block Diagram
RTC_TAMP1 RTC_TAMP2 RTC_TAMP3 RTC_TS RTC_REFIN
Backup Registers and RTC Tamper Control registers
67 67
Tamper Flag
TimeStamp Registers
• 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.
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)
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
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
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
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
Байду номын сангаасTC 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