i have encounterd a wierd behavior i am using this library
https://github.com/rogerclarkmelbourne/ … OM_example
#include <EEPROM.h>
int AddressWrite,DataWrite;
void setup()
{
// initialize the digital pin as an output:
Serial1.begin(115200);
uint16 Status;
uint16 Data;
EEPROM.init();
EEPROM.PageBase0 = 0x801F000;
EEPROM.PageBase1 = 0x801F800;
EEPROM.PageSize = 0x400;
EEPROM.write(0, 1);
for (int i = 0; i < 255; i++)
{
Serial1.print( i);
Serial1.print( "= ");
Serial1.println( EEPROM.read(i));
}
}
void loop()
{
}
viewtopic.php?t=1576#p20405
However, I personally have not tested.
AN2594 is the authority documentation.
However, I never recommend use of this technique; rather implementing external storage is easy.
http://stm32duino.com/viewtopic.php?f=13&p=39136
and
viewtopic.php?t=586#p6075
Here is the pertinent note on emulation:
3.4 Cycling capability
A program/erase cycle consists of one or more write accesses and one page erase
operation.
When the EEPROM technology is used, each byte can be programmed and erased a finite
number of times, typically in the range of 10 000 to 100 000.
However, in embedded Flash memory, the minimum erase size is the page and the number
of program/erase cycles applied to a page is the number of possible erase cycles. The
STM32F10xxx’s electrical characteristics guarantee 10 000 program/erase cycles per page.
The maximum lifetime of the emulated EEPROM is thereby limited by the update rate of the
most frequently written parameter.
The cycling capability is dependent of the amount/size of data that the user wants to handle.
Ray
I am sure everything is fine with my code, I can live with 10.000 limited read writes, the question is why if I power reboot the board the eeprom is empty
Here is Roger’s take on the Blue Pill:
viewtopic.php?t=1576#p20754
As I have not played with the emulation, maybe one of our members has and can chime in. I would suggest you change Title to “Need Help with EEPROM Emulation.”
Ray
if you have only 64k it could not fit at 0x801F000
As mentioned in the topic provided by Ray:
For writing I use address 0x801F000 so that should be the “last” 4kB of the supposed 128kB flash on BP.
Is it possible that your upload method is erasing the whole memory at once?
Our bootloader should not do that, but if using the ROM bootloader, stlink or any other jtag probe, it’s possible that’s erasing all memory before writing rather than erase indivual pages.
[victor_pv – Sat Jan 13, 2018 9:56 pm] –
How are you uploading the sketch?
Is it possible that your upload method is erasing the whole memory at once?
Our bootloader should not do that, but if using the ROM bootloader, stlink or any other jtag probe, it’s possible that’s erasing all memory before writing rather than erase indivual pages.
Yeap , i use st link
if it went into a product, would you use 64k or 128k ?
it shouldn’t a) be done in first place
b) get past the first code review
apols too much aircraft stuff.
more than 64k is happenstance, it could 68k, 72k, 76k or 96k or any 4k block boundary, but not less then 64k.
actually as you’re outside the spec it could be 85356 or any number over 64k and less than 128k or maybe not.
stephen
[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.
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?
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.
Actually i made it work.
When i used This
EEPROM.PageBase0 = 0x801F000;
EEPROM.PageBase1 = 0x801F800;
EEPROM.PageSize = 0x800;


