大家好,小弟在用STM8L151G4U6时发现 E2PROM无法操作,具体如下:
使用官方示例 Unlock Program区间是OK的,但是Unlock data区间就一直死在等待FLAG那里,如果把等待去掉直接往下执行,在ERASE那里也会死掉,不知道怎么回事,请大家帮忙看看,我就是想利用E2PROM掉电存储几个字节而已,单片机供电3V:
/* Define flash programming Time*/
FLASH_SetProgrammingTime(FLASH_ProgramTime_Standard);
FLASH_Unlock(FLASH_MemType_Program);
/* Wait until Flash Program area unlocked flag is set*/
while (FLASH_GetFlagStatus(FLASH_FLAG_PUL) == RESET)
{}
/* Unlock flash data eeprom memory */
FLASH_Unlock(FLASH_MemType_Data);
/* Wait until Data EEPROM area unlocked flag is set*/
while (FLASH_GetFlagStatus(FLASH_FLAG_DUL) == RESET) ------------》这里一直走不过去
{}
FLASH_EraseBlock(0, FLASH_MemType_Data);
|