2019-07-25 01:49 AM
Hi guys,
I want to write data to the flash memory of the Stm8s003f3p6 processor. I can read / write to this processor's eeprom. But I can read the flash memory, but I can't write it. I write my codes with "IAR Embedded Workbench for STM8". I check the address I wrote in Debug mode, but I see that no data is written. I guess there's no way I haven't tried.
Here are the codes I wrote:
FLASH_PUKR = 0x56;
FLASH_PUKR = 0xAE;
while (!(FLASH_IAPSR & (1 << FLASH_IAPSR_PUL))){}
FLASH_CR2 = 1 << FLASH_CR2_PRG;
FLASH_NCR2 = (uint8_t) ~(1 << FLASH_NCR2_NPRG);
pct = *(uint32_t *)(0x8000);
(*(uint8_t*)(0x9000)) = 0x21;
MSA_Delay(20);
Solved! Go to Solution.
2019-07-26 11:11 AM
I fix problem. Problem is IAR debug.
2019-07-26 11:11 AM
I fix problem. Problem is IAR debug.