Question
Hi, I am using stm8l001j3m3. In my project i can't write to eeprom. How can i do it?
My code as a below;
void EEPROM_WriteByte(unsigned int address, unsigned char value)
{
FLASH->DUKR = 0xAE;
FLASH->DUKR = 0x56;
(*(uint8_t *)(0x9FC0 + address)) = value;
FLASH->IAPSR &= FLASH_MemType_Data;
}
unsigned char EEPROM_ReadByte(unsigned int address)
{
unsigned char *ptr = (uint8_t *)(0x9FC0 + address);
return (*ptr);
}
