2024-06-16 08:47 AM
I'm using the stm23F103C8 and I would use the RTC internal cloak/calendar. The program is working fine and I have used the LSE osc (32KHz..) as clock source. I have connected a 3V battery to the VBAT pin. My problem is that the switching off the main supply (3.3V) the LSE and RTC stops (vrified with scope).
Attached the main.c.
Can you help me??
2024-06-17 04:41 AM
> My problem is that the switching off the main supply (3.3V) the LSE and RTC stops
How do you know?
> (vrified with scope).
LSE is a low power oscillator and loading it by oscilloscope probe can very likely stop it.
JW
2024-06-17 05:44 AM
Yes I know but anyway at power on the RTC is running but starts from 00:00:00.
I programmed the device with the complete init of RTC. The RTC starts with the correct initialized time.
After that I removed the time/date init from te RTC_init, reprogrammed the device, and the RTC is running with the programmed time and increment correctly.
I see it from the UART. Now removing the main power, Vbat connected to 3V battery, and repowering the RTC is running but starts from 00:00:00.
I normally use DS1307 or similar external RTC, now I would use the internal resource..
Thanks in advance for any help
2024-06-17 06:41 AM - edited 2024-06-17 06:42 AM
> at power on the RTC is running but starts from 00:00:00
If you'd have problem with LSE not oscillating, while the time would not advance, it also would not reset.
So you either don't have properly connected VBAT or any of the VDD/VDDA/GND pins, or you perform a backup-domain reset (see RCC_BDCR.BDRST - maybe some "library" which you are using performs this for you) upon startup.
Or maybe you just incorrectly read out the RTC after reset, see Reading RTC registers subchapter of RTC chapter in RM.
JW
2024-06-18 12:40 AM
Is rtc set time is disabled? Does it set as per the values? After initially setting you have to disable it.
2024-06-18 05:32 AM
All VSS_x/VSSA are tied together. RTC set routines are commented.
I'll check for the backup-domain management. It's possible to have a simple example?