2019-11-26 10:47 PM
2019-12-17 01:11 PM
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.