7/25/2023 0 Comments Stm32 real time clock![]() With battery, LSI_Clock, flashed after removing power Unplug usb and plug back in, rtc.isTimeSet returns false, clock goes back to time at compile Reboot without removing power, rtc.isTimeSet returns true No battery, LSI_Clock, flashed without removing power Rtc_config(clkSource, rtc.HOUR_24, mydate, mytime) Serial.println("unconditional rtc_config") STM32RTC::Source_Clock clkSource = rtc.LSE_CLOCK ![]() Serial.println("With battery, LSE_Clock, flashed without removing power") Static STM32RTC::AM_PM period = STM32RTC::AM Static STM32RTC::Hour_Format hourFormat = STM32RTC::HOUR_24 I'm new to the world of microcontrollers and the Arduino environment has made it much more accessible than it would have been otherwise.īy Frederic Pillon for STMicroelectronics My appreciation to the developers who have made it possible to use the Arduino ide with STM32 boards. I've been able to get the SD card working along with several I2C sensors (SHT35, BME280) and a one wire temperature sensor (ds18b20). In other tests, it has behaved as expected. This board is the one with the built in SD card reader and battery. With no battery, the time reverts to the time when the microcontroller was programmed. When plugged back in, it picks up where it left off. The code I used, based on cutting and pasting from Frederic Pillon's RTC_Tests program, is below.Īlso, with a battery in place, the time when power was removed is preserved. With the battery and the LSI clock source, rtc.isTimeSet() returns true after unplugging the usb cable. I believe the connection between the battery and the microcontroller is good: without a battery, rtc.isTimeSet() returns false after unplugging the usb cable and plugging it back in. The problem: with a battery in place, the RTC doesn't keep time when power is removed.Īm I wrong in thinking that the RTC should keep time on battery power alone? From other posts on this forum, I realize that I can't expect a very accurate clock but I had assumed that it would keep running when unplugged.
0 Comments
Leave a Reply. |