RTC Not Working When Using VDD for VBAT on STM32L4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-22 4:27 AM
Hello STM32 Community,
I’m encountering an issue with the RTC on my STM32L4 microcontroller. When I connect VDD to the VBAT pin (without using a battery), the RTC is not functioning. However, if I use a battery for VBAT, the RTC works fine.
Here’s the situation:
- I’m not using a battery for VBAT, and I’m connecting VDD directly to VBAT.
- The RTC does not work in this configuration.
- When I use a battery for VBAT, the RTC works as expected.
My Questions:
- Is there an issue with supplying both VDD and VBAT at the same time, without using a battery for VBAT?
- Why does the RTC stop working when VDD is connected to VBAT directly, but works fine with a battery?
- What is the correct setup for powering the RTC when VBAT is connected to VDD instead of using a battery?
Any insights or recommendations for solving this would be greatly appreciated!
Thank you for your help!
Solved! Go to Solution.
- Labels:
-
RTC
-
STM32L4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-24 1:04 PM
For test purpose, you can add one resister (220Ohm? depends your power consume) between Vbat and Vdd ,add one capacitor 100 uF , provide power to Vbat. This will emulate Vbat and Vdd delay.
It may give you idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-25 3:13 AM
1. Internal without Battery:
- BDCR: 0x0000820B
- Differences from default:
- LSEON (bit 0) = 1 (LSE enabled).
- LSERDY (bit 1) = 1 (LSE is ready).
- LSEDRV (bits 3-4) = 01 (Medium-low drive strength).
- RTCSEL (bits 8-9) = 01 (RTC clock source is LSE).
- RTCEN (bit 15) = 1 (RTC is enabled).
- RTC_TR: 0x00000033: Time shows 00:00:33.
Comparison with Default:
- LSE is enabled, and the RTC is running properly with the LSE clock source.
- RTC has incremented from the default time of 00:00:00 to 00:00:33.
2. Internal with Battery:
- BDCR: 0x0000820B (Same as previous).
- RTC_TR: 0x00000115: Time shows 00:01:15.
Comparison with Default:
- Similar to the previous case, but the time has incremented to 00:01:15.
- The battery ensures that the RTC keeps counting even if the main power is lost, unlike the default state where the RTC is disabled.
3. External with Coin Battery:
- BDCR: 0x0000810B
- Differences from default:
- LSEON (bit 0) = 1 (LSE enabled).
- LSERDY (bit 1) = 1 (LSE is ready).
- LSEDRV (bits 3-4) = 00 (Low drive strength).
- RTCSEL (bits 8-9) = 01 (RTC clock source is LSE).
- RTCEN (bit 15) = 1 (RTC is enabled).
- RTC_TR: 0x00000006: Time shows 00:00:06.
Comparison with Default:
- LSE is enabled, and the RTC is counting up from 00:00:06.
- The coin battery allows the RTC to keep running without VDD.
- By default, the RTC would be disabled and not operational.
4. External without Battery (Drive Medium-Low):
- BDCR: 0x00008100
- Differences from default:
- LSEON (bit 0) = 0 (LSE not enabled).
- LSERDY (bit 1) = 0 (LSE is not ready).
- LSEDRV (bits 3-4) = 01 (Medium-low drive strength set).
- RTCSEL (bits 8-9) = 00 (No clock source for the RTC).
- RTCEN (bit 15) = 0 (RTC clock is disabled).
- RTC_TR: 0x00000000: Time shows 00:00:00 (default).
Comparison with Default:
- The RTC is effectively disabled, similar to the default state.
- Without a valid clock source, the RTC does not function, and time remains at 00:00:00.
5. External without Battery (Drive High):
- BDCR: 0x00008100 (Same as the previous case).
- RTC_TR: 0x00000000 (Same as default).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-25 7:33 AM
You find the BDCR bit 8 need change to "1" , could you write to this bit?
This time the register is locked, you need follow reference manual page 1038 , enable this register first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-25 8:18 AM
@mÆŽALLEm, @STTwo-32
For this case, reset cause different, any suggestion from ST?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-10-25 10:04 AM
Issue Solved - RTC LSE Oscillator Configuration
Hi everyone,
The issue has been resolved! I made a few configuration changes:
- First, I disabled the LSI.
- Then, I set the LSE drive to high.
- Finally, I enabled the LSE.
After these adjustments, the oscillator is now working as expected.
Thank you for your support!
Best regards,
A. Sujith

- « Previous
-
- 1
- 2
- Next »