cancel
Showing results for 
Search instead for 
Did you mean: 

hi, i am Revanth i am using STM8AF5288T controller i would like to read and write data to EEPROM but i couldn't find any procedure or any related registers to do someone help me with the procedure...

Mreva.1656
Associate
 
1 REPLY 1
Cristian Gyorgy
Senior III

Hi Revanth!

Reading data from EEPROM is just like reading any data from the STM8 memory space, nothing special. It's the same like reading data from RAM of Flash.

About writing, you should read the manuals. We distinguish between different writing modes, you can write 1 byte, 4 bytes or 64 bytes (some devices might have different page sizes) in one write cycle. Than, if you write an already erased location is faster than doing an erase-write operation. Again, this is explained in the manuals.

Basicly, you need to first unlock the EEPROM for writing, than write your data in the locations you want, wait for the write operation to complete (poll or use interrupts) and lock back the EEPROM for unwanted writes.

The exact code depends on what you want to do, compiler, asm/C and so on.

The registers you need are the flash registers: FLASH_DUKR, FLASH_IAPSR, FLASH_CR2.