[SOLVED] Need Help with EEPROM Emulation

Post here first, or if you can't find a relevant section!
User avatar
Pito
Posts: 1738
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Need Help with EEPROM Emulation

Post by Pito » Sun Jan 14, 2018 11:04 am

Run the sketch with writing to the EEPROM address 0 and then power it off, and then READ the memory with the STLink. You should see 0 there, I would guess. Then PROGRAM the sketch with writing to the EEPROM commented out, and then READ it with the STLink. You will see FF there most probably.
Pukao Hats Cleaning Services Ltd.

alexandros
Posts: 73
Joined: Mon Oct 02, 2017 6:51 pm

Re: Need Help with EEPROM Emulation

Post by alexandros » Tue Jan 16, 2018 7:11 am

Pito wrote:
Sun Jan 14, 2018 11:04 am
Run the sketch with writing to the EEPROM address 0 and then power it off, and then READ the memory with the STLink. You should see 0 there, I would guess. Then PROGRAM the sketch with writing to the EEPROM commented out, and then READ it with the STLink. You will see FF there most probably.
OK now i am very confused , Pito is that possible? , So can i use it to store some data or not? :(
Is it storing values as long as the program is alive? i dont get it, is there any other way except putting an eeprom external chip?

victor_pv
Posts: 1863
Joined: Mon Apr 27, 2015 12:12 pm

Re: Need Help with EEPROM Emulation

Post by victor_pv » Wed Jan 17, 2018 7:51 pm

As pointed out before, the problem is most likely that you are wiping the whole flash when uploading with St-Link.

You must use a method that doesn't wipe the whole flash (you can do so if using the ST_link GUI tool, has an option to select whether you want to completely erase the mcu or only the required pages). Our bootloader also only clear individual pages.
The ROM serial bootloader, as st-link can do it either way, you have to use the GUI to select what you want to do.

alexandros
Posts: 73
Joined: Mon Oct 02, 2017 6:51 pm

Re: [SOLVED] Need Help with EEPROM Emulation

Post by alexandros » Wed Jan 17, 2018 8:39 pm

Thanks for your replies guys

Actually i made it work.

When i used This

Code: Select all

			
			EEPROM.PageBase0 = 0x801F000;
			EEPROM.PageBase1 = 0x801F800;
			EEPROM.PageSize  = 0x800;
			
Instead of this

Code: Select all

			EEPROM.PageBase0 = 0x801F000;
			EEPROM.PageBase1 = 0x801F800;
			EEPROM.PageSize  = 0x400;

Post Reply