Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

XMC™ Forum Discussions

User16529
Level 4
Level 4
First solution authored
Hi!
I want to store some data in flash, so they could be always avaliable. I write in XMC_FLASH_SECTOR_7 = 0x0C01C000, but after a power down the data are erased. I read on the RM that sector 7 is used for Erhercat eeprom emulation, so i think that's why the data are erased after a power down.
I've tried to write to another sector, 0x0C030000, that is empty, but i get an hard falut error, i think this is because my firmware code start from 0x0C020000 and maybe the 0x0C030000 address is allocated for the code.
I need to write data everytime is it necessary during the application and I need these data to be avaliable after a power down. Is there a way to do that? Where can i write data in flash without compromise the firmware code or everything else that is important?

Thank you for any advise
0 Likes
1 Reply
User6412
Level 4
Level 4
Your software part which writes some data into the flash (or erase sectors) should be located in the RAM. All interrupts should be disabled during flash erase and write operations. Check this in your code.
0 Likes