Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
stm32:peripherals:rtc_wakeup [2016/11/07 07:12] – feur | stm32:peripherals:rtc_wakeup [2017/10/24 10:45] – [Setup wakeup timer] kjaz | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Wake Up Timer ====== | ====== Wake Up Timer ====== | ||
- | The wakeup timer is a programmable 16 bit down-counter. \\ | + | The wakeup timer is a programmable 16 bit auto-reload |
The wakeup timer range can be extended to 17 bits. \\ | The wakeup timer range can be extended to 17 bits. \\ | ||
\\ {{rtc_timer.svg? | \\ {{rtc_timer.svg? | ||
+ | The wakeup timer can be used to generate a periodic interrupt through the wakeup timer flag (WUTF). Additionally the WUTF flag can be output (through signals WKUP, RTC_ALARM and on to RTC_AF1) to pin PC13. | ||
+ | |||
+ | The wakeup timer clock input can be | ||
+ | * RTCCLK (usually 32.768 kHz) divided by 2, 4, 8 or 16. \\ As a result this allows wakeup interrupt periods from 122 us to 32 s, with a resolution down to 61 us. | ||
+ | * ck_spre (usually 1 Hz internal clock). \\ As a result this allows wakeup interrupt periods from 1 s to around 36 hours. | ||
===== Programming Instructions ===== | ===== Programming Instructions ===== | ||
==== RTC register write protection ==== | ==== RTC register write protection ==== | ||
- | After a reset the backup domain is write protected. \\ | + | After a reset the backup domain is write protected. The backup domain encompasses: |
Unlock access to backup domain: | Unlock access to backup domain: | ||
* Set the '' | * Set the '' | ||
Line 22: | Line 27: | ||
The RTC clock is disabled by default. Select a clock source and enable the RTC clock. \\ | The RTC clock is disabled by default. Select a clock source and enable the RTC clock. \\ | ||
- | Make sure that the clock source is available while in power down mode. | + | Make sure that the clock source is available while in [[pwr# |
- | * Setup appropriate [[rcc_clock# | + | * Setup / enable an appropriate [[rcc_clock# |
* Select clock source for RTCCLK in '' | * Select clock source for RTCCLK in '' | ||
* Enable RTCCLK in '' | * Enable RTCCLK in '' | ||
Line 32: | Line 37: | ||
* Disable wakeup timer in '' | * Disable wakeup timer in '' | ||
* Wait until configuration of RTC is allowed. \\ Check corresponding bit in '' | * Wait until configuration of RTC is allowed. \\ Check corresponding bit in '' | ||
- | * Program reload value in '' | ||
* Program prescaler value in '' | * Program prescaler value in '' | ||
+ | * Program reload value in '' | ||
* Enable wakeup interrupt in '' | * Enable wakeup interrupt in '' | ||
- | To use the wakeup interrupt, you need to enable it in the NVIC \\ | + | To use the wakeup interrupt, you need to configure |
- | and configure | + | and enable it in the NVIC: |
* Clear any pending wakeup interrupt flag in '' | * Clear any pending wakeup interrupt flag in '' | ||
* Configure the dedicated [[exti|EXTI interrupt]] channel for the RTC. \\ I.e. select edge and enable. | * Configure the dedicated [[exti|EXTI interrupt]] channel for the RTC. \\ I.e. select edge and enable. | ||
Line 51: | Line 56: | ||
===== Configuration Registers ===== | ===== Configuration Registers ===== | ||
- | ==== CR ==== | + | ==== RTC_CR |
Configuration register | Configuration register | ||
Line 67: | Line 72: | ||
|:::|1|Wake up timer interrupt enabled|| | |:::|1|Wake up timer interrupt enabled|| | ||
- | ==== WUTR ==== | + | ==== RTC_WUTR |
Wakeup timer register | Wakeup timer register | ||
Line 76: | Line 81: | ||
===== Status Registers ===== | ===== Status Registers ===== | ||
- | ==== ISR ==== | + | ==== RTC_ISR |
Initialization and status register | Initialization and status register |