Closed
Description
Version used: Current HEAD + PR
Affected variant: RemRam v1
Currently I try to write some configuration values with the help of the EEPROM library to the flash.
Given this simple sketch:
#include <EEPROM.h>
void setup() {
Serial.begin(115200);
uint8_t v = EEPROM.read(0);
if (v == 123) {
Serial.println("Saved");
} else {
Serial.println("Wasn't saved");
EEPROM.write(0, 123);
}
}
void loop() {
delay(15);
}
The flash won't safe the variable content. I tracked down the problem to the set_data_to_flash() function in stm32_eeprom.c.
HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError) will return an HAL_ERROR and when debugging the error with HAL_FLASH_GetError(), I will receive a FLASH_ERROR_WRP error (FLASH Write protected error). SectorError contains a 0x17 (23).
Is there anything special I need to do when wanting to write to the flash when using a F7?