2012-05-27 05:47 PM
I tried to use the firmware lib to program it ,but failed.
FLASH_Unlock(FLASH_MEMTYPE_DATA); for(i = 0; i < DataLeng; i=i+4) { FLASH_ProgramWord(StartAddr + i,(*(u32*)pBuf)); pBuf= pBuf+4;; FLASH_WaitForLastOperation(FLASH_MEMTYPE_DATA); } FLASH_Lock(FLASH_MEMTYPE_DATA); But when I use program_byte, it sucess. I just want to save time because I need to programe 23 byte at sequence address one time. Thanks! ChrisChen2012-05-28 06:17 AM
Hi Chris,
It's just because of the mistake of the firmware code, check the FLASH_ProgramWord() function in stm8l15x_flash.c then correct the Address variable type to uint32_t. After all, hope it will be working properly.2012-06-02 12:00 AM
Thanks for your reply,Now it's ok.
Thanks very much. cgha2012-06-02 12:46 AM
But it's very strange, because when I use the logic analyzer to measure the programe time, it's as long as byte programe. It takes about 187ms to write 7 words. So I think uncomment the
//FLASH->NCR2 &= (u8)(~FLASH_NCR2_NWPRG); will not enter word programe mode,but still use byte programe mode ? Why? ChrisChen