uint8_t u8TestBuf[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
uint8_t u8Len = 18u;
/* Unlock EFM. */
EFM_Unlock();
/* Enable flash. */
EFM_FlashCmd(Enable);
/* Wait flash ready. */
while(Set != EFM_GetFlagStatus(EFM_FLAG_RDY))
{
;
}
/* Erase sector 61 62. */
EFM_SectorErase(FLASH_SECTOR61_ADDR);
EFM_SectorErase(FLASH_SECTOR62_ADRR);
/* Sequence program. */
EFM_SequenceProgram(FLASH_SECTOR61_ADDR, (uint32_t)u8Len, u8TestBuf);
EFM_SequenceProgram(FLASH_SECTOR62_ADRR, (uint32_t)u8Len, u8TestBuf);
EFM_MassErase(FLASH_SECTOR61_ADDR);
/* Lock EFM. */
EFM_Lock();
while(1)
{
;
}
|