本帖最后由 lss1985 于 2018-7-7 09:56 编辑
楼主大神问一下dataflash烧写大概需要多少时间啊,现在在存储按键值时会影响定时器里面的LED显示功能,就是在擦除dataflash时LED会闪一下
void DATA_FLASH_Write(uint32_t u32addr,uint32_t u32data)
{
DisableInterrupts();
SYS_UnlockReg();
FMC_ENABLE_ISP();
FMC_Erase(u32addr);
FMC_Write(u32addr,u32data);
FMC_DISABLE_ISP();
SYS_LockReg();
EnableInterrupts();
}
FMC用的库函数
static __INLINE void FMC_Write(uint32_t u32addr, uint32_t u32data)
{
FMC->ISPCMD = FMC_ISPCMD_PROGRAM; /* Set ISP Command Code */
FMC->ISPADR = u32addr; /* Set Target ROM Address. The address must be word alignment. */
FMC->ISPDAT = u32data; /* Set Data to Program */
FMC->ISPTRG = 0x1; /* Trigger to start ISP procedure */
__ISB(); /* To make sure ISP/CPU be Synchronized */
while(FMC->ISPTRG); /* Waiting for ISP Done */
}
static __INLINE int32_t FMC_Erase(uint32_t u32addr)
{
FMC->ISPCMD = FMC_ISPCMD_PAGE_ERASE; /* Set ISP Command Code */
FMC->ISPADR = u32addr; /* Set Target ROM Address. The address must be page alignment. */
FMC->ISPTRG = 0x1; /* Trigger to start ISP procedure */
__ISB(); /* To make sure ISP/CPU be Synchronized */
while(FMC->ISPTRG); /* Waiting for ISP Done */
/* Check ISPFF flag to know whether erase OK or fail. */
if(FMC->ISPCON & FMC_ISPCON_ISPFF_Msk)
{
FMC->ISPCON = FMC_ISPCON_ISPFF_Msk;
return -1;
}
return 0;
}
感觉擦除里面的while会影响定时器中断,因为前面关闭了总中断,而定时器是1ms扫描一次按键值并做显示
不知道这个问题怎么解决@yjgna |