cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM EMULATION in STM32F103RB. Not able to save data in flash once code size exceeds 64Kb

sne_123
Associate III

Hello everyone,

I am doing EEPROM EMULATION On STM32F103RB Series which has 128kb flash. I am able to erase and write the contents into flash. But when my code size exceeds 64KB, the content is not being written properly into the flash. Can anyone tell me why such happens and what is the solution so as to solve the issue???

1 ACCEPTED SOLUTION

Accepted Solutions

You need to observe the size of block your STM32 model erases in one erase step. I don't use STM32F1, so you need to look it up in RM0008.

Maybe you want to set it to the highest possible part of the FLASH, to leave way for potential future code extension?

JW

View solution in original post

5 REPLIES 5
Ozone
Lead

Perhaps because the EEPROM emulation uses the last 64k sector, while the first is used for your code. Check your map file.

Using the first sector also would destroy the code.

> Can anyone tell me why such happens and what is the solution so as to solve the issue???

Use real EEPROM, or a variant with more Flash.

sne_123
Associate III

Ok thank you Sir, I am new to flash programming. I am saving my data into flash from address "0x0800FC00" . If I change the starting address from "0x0800FC00" to

"0x0800FD00" , will it solve the issue??

You need to observe the size of block your STM32 model erases in one erase step. I don't use STM32F1, so you need to look it up in RM0008.

Maybe you want to set it to the highest possible part of the FLASH, to leave way for potential future code extension?

JW

And perhaps need to synchronize the EEPROM emulation settings with the linker file.

I don't know F103FB either, buf if the size required for your code is smaller, you could perhaps free more blocks (sectors) at higher addresses for the emulation.

sne_123
Associate III

@Ozone​  @Community member​  Thanks a lot for your support. I shifted the starting address to the end page of the main memory and that solved the issue. Previously the code size exceeded 64k and at the same time I was trying to save data on flash . But using end page ( 0x0801 FC00 - 0x0801 FFFF) solved the issue. Thanks a lot 🙂