Hi,
I'm using the MCU STM32l476, and I have a problem with RTC.
The RTC works only if the board is turned on. When the board is turned off or it's sent a command to the MCU go to shutdown mode, the RTC is reset to zero values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 09:16 AM
According to the datasheet, there is shutdown mode with and without RTC, so I believe it's a problem of configuration. Can be some parameter of configuration that is missing? How to configure the shutdown mode with RTC?
Thanks!
- Labels:
-
RTC
-
STM32L4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 10:49 AM
Which oscillator are you using for RTC? In shutdown mode RTC can work only with LSE, not LSI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 11:54 AM
I'm using the LSE oscilator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 12:42 PM
And what happens with RTC if you reset the board either by pulling the NRST pin down, or in software, i.e. without turning the power off?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 01:15 PM
Also an idea.. Maybe you are reading RTC incorrectly? RTC has a special procedure for reading and setting date/time values. Looking with a debugger will not show these registers correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 02:57 PM
> Looking with a debugger will not show these registers correctly.
The lock/unlock mechanism with BYPASS=0 may surely be confusing, but should not result in reading 0.
OTOH, reading after startup may indeed return 0, if the synchronization mechanism indicated by RSF bit is not observed. Nevertheless, the proper procedure to read time/date is described clearly in the Reading the calendar subchapter of RTC chapter of RM.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 04:16 AM
For reading I'm using the functions HAL_RTC_GetDate() and HAL_RTC_GetTime(). For setting HAL_RTC_SetDate() and HAL_RTC_SetTime()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 05:49 AM
Do you have a backup power supply connected to the VBAT pin? One that remains on when you turn off power to the board?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 06:06 AM
Yes, I have a backup supply connected to VBAT pin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 06:37 AM
And what happens with RTC if you reset the board either by pulling the NRST pin down, or in software, i.e. without turning the power off?
JW