SDK的flash_demo擦写正常,下面是demo中擦写执行代码
uint32_t FlashCommandSequence (PFLASH_SSD_CONFIG pSSDConfig )
{
uint32_t ret; /* return code variable */
uint32_t temp; /* temporary variable */
/* clear CCIF to launch command */
temp = pSSDConfig->ftfxRegBase + FTFx_SSD_FSTAT_OFFSET;
REG_BIT_SET(temp, FTFx_SSD_FSTAT_CCIF);
/* wait for completion of this command */
temp = pSSDConfig->ftfxRegBase + FTFx_SSD_FSTAT_OFFSET;
while(0x0U == (REG_BIT_GET(temp, FTFx_SSD_FSTAT_CCIF)))
{
/* wait till CCIF bit is set */
/* serve callback function if counter reaches limitation */
if(NULL_CALLBACK != pSSDConfig->CallBack)
{
(pSSDConfig->CallBack)();
}
}
temp = pSSDConfig->ftfxRegBase + FTFx_SSD_FSTAT_OFFSET;
ret = ((uint32_t)(REG_READ(temp)) & FTFx_SSD_FSTAT_ERROR_BITS);
return(ret);
}
REG_BIT_SET(temp, FTFx_SSD_FSTAT_CCIF);这句话执行完擦写操作就生效了
我把demo里的代码移植到我的code中去,flash相关的寄存器值一样子的,只是运行完这句话并不会完成擦写操作。
有没有其他原因使flash无法擦写? |