Does anyone have a problem writing to Eeprom?
When I try to write say a '0x80, a '0x3f' is reported as written So I stored my data as 4 bit nybbles, , which works (I'm using the discovery Board.)
Russ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-09-12 3:23 PM
char *address = (char *) 0x4000;
void flashwrite(char dat)
{
// thanks to https://github.com/midnight-wonderer/stm8-eeprom-bug/blob/workaround-//method/src/firmware.c
// one Mr. Sarun Rattanasiri
while ((FLASH->IAPSR & FLASH_IAPSR_DUL)==0)
{
FLASH->DUKR = FLASH_RASS_KEY1;
FLASH->DUKR = FLASH_RASS_KEY2;
}
*address = 0;
*address = dat;
FLASH->IAPSR &= ~FLASH_IAPSR_DUL;
}
