EEPROM Freezing on stm32l4r5zit6p

Post here all questions related to STM32 core if you can't find a relevant section!
Post Reply
ant32t
Posts: 2
Joined: Fri May 14, 2021 8:39 pm

EEPROM Freezing on stm32l4r5zit6p

Post by ant32t »

I've been having problems with the mcu freezing when reading or writing to EEPROM. When it happens it is reproducible on a very simple sketch. Once it is able to read and write successfully it seems to stay working between firmware updates and reboots. It seems like erasing the flash can sometimes cause it to start freezing or start working. A few boards I flashed multiple times and switched them on and off a few times to get it to not freeze. Any ideas on troubleshooting steps to take?

Code: Select all

#include <EEPROM.h>

void setup() {
  uint32_t val;
  EEPROM.get(0 ,val);
}

void loop() {
	
}
When debugging I get this back trace. This is using platformio with stm32duino 1.9.0 but I also tested it with 2.0.0 using the above sketch.

Code: Select all

#0  WWDG_IRQHandler () at /build/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/gcc/startup_stm32l4r5xx.s:116
#1  <signal handler called>
#2  0x08003d02 in memcpy ()
#3  0x080036d2 in eeprom_buffer_fill () at /build/framework-arduinoststm32/libraries/SrcWrapper/src/stm32/stm32_eeprom.c:198
#4  0x080036e4 in eeprom_read_byte (pos=pos@entry=0) at /build/framework-arduinoststm32/libraries/SrcWrapper/src/stm32/stm32_eeprom.c:154
#5  0x08003a64 in EERef::operator* (this=<optimized out>) at /build/framework-arduinoststm32/libraries/EEPROM/src/EEPROM.h:159
#6  EERef::operator unsigned char (this=<optimized out>) at /build/framework-arduinoststm32/libraries/EEPROM/src/EEPROM.h:46
#7  EEPROMClass::get<unsigned long long> (t=@0x2009ffd0: 576534179064315910, idx=0, this=<optimized out>) at /build/framework-arduinoststm32/libraries/EEPROM/src/EEPROM.h:231
#8  setup () at src/main.cpp:37
#9  0x0800093a in main () at /build/framework-arduinoststm32/cores/arduino/main.cpp:52
#10 0x0800097a in Reset_Handler () at /build/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/gcc/startup_stm32l4r5xx.s:98
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: EEPROM Freezing on stm32l4r5zit6p

Post by fpiSTM »

ant32t
Posts: 2
Joined: Fri May 14, 2021 8:39 pm

Re: EEPROM Freezing on stm32l4r5zit6p

Post by ant32t »

Those defines look to be correct for stm32l4r5zit6p. https://www.st.com/en/microcontrollers- ... 4r5zi.html

Code: Select all

#define FLASH_BASE            (0x08000000UL) /*!< FLASH(up to 2 MB) base address   */
#define FLASH_END             (0x081FFFFFUL) /*!< FLASH END address                */
#define FLASH_BANK1_END       (0x080FFFFFUL) /*!< FLASH END address of bank1       */
#define FLASH_BANK2_END       (0x081FFFFFUL) /*!< FLASH END address of bank2       */
https://raw.githubusercontent.com/stm32 ... 32l4r5xx.h

any further steps to troubleshoot this would be appreciated
Post Reply

Return to “General discussion”