Hi, It is weird but when I use EEPROM funcs with RTC, CPU hangs and freeze after trying to write EEPROM in loop(). and even restart do not bring it to the loop (maybe because have Attached battery) until I remove the rtc.begin() line once and then start and then write the rtc.begin() to repeat the same problem.
Both EEPROM and RTC work fine without other ones in sketch.
I even use lesser flash and shift EEPROM FLASH_BASE_ADDRESS back and forth but still the same.
After crashes it's hang on the EEPROM.write(addr,_byte) in my setup();
I used STM32F103RC and version 1.8.0 core and the last STM32RTC version.
Here is my code:
`
include
include
include
define LED_PIN PA8
STM32RTC& rtc = STM32RTC::getInstance();
uint8_t value = 10;
uint32_t lasttime;
void setup() {
pinMode(LED_PIN, OUTPUT);
rtc.setClockSource(STM32RTC::LSE_CLOCK);
rtc.begin(); // initialize RTC 24H format
Hi, It is weird but when I use EEPROM funcs with RTC, CPU hangs and freeze after trying to write EEPROM in loop(). and even restart do not bring it to the loop (maybe because have Attached battery) until I remove the rtc.begin() line once and then start and then write the rtc.begin() to repeat the same problem. Both EEPROM and RTC work fine without other ones in sketch. I even use lesser flash and shift EEPROM FLASH_BASE_ADDRESS back and forth but still the same. After crashes it's hang on the EEPROM.write(addr,_byte) in my setup(); I used STM32F103RC and version 1.8.0 core and the last STM32RTC version. Here is my code:
`
include
include
include
define LED_PIN PA8
STM32RTC& rtc = STM32RTC::getInstance(); uint8_t value = 10; uint32_t lasttime;
void setup() {
pinMode(LED_PIN, OUTPUT);
rtc.setClockSource(STM32RTC::LSE_CLOCK); rtc.begin(); // initialize RTC 24H format
}
void loop() {
Heartbeat(LED_PIN,2);
if(millis()-lasttime >= 2000){ if(value>=255) value=0; else value++; EEPROM.write(0, value); lasttime=millis(); }
}
void Heartbeat(byte _ledPin, uint8_t ReduceSpeedFactor){ static LightChrono heartbeatChrono; static unsigned long interval_millis = 50*ReduceSpeedFactor; static int counter = 0; static bool ledState = false;
} `
code.zip