21ic问答首页 - GD32F450ZGT6 擦写Flash bank1 sector11失败
GD32F450ZGT6 擦写Flash bank1 sector11失败
sanbeicha2023-05-23
如题所述,在使用GD32450Z-EVAL开发板时,应用程序需要擦除Flash bank1,调试发现调用固件fmc_sector_erase返回擦除成功,实际查看Flash空间并未擦除成功,擦除接口代码如下:
fmc_unlock();
for (sectorIdx = first_sector; sectorIdx <= last_sector; sectorIdx++)
{
if(fmc_sector_erase(CTL_SN(sectorIdx)) != FMC_READY)
{
result = BLT_FALSE;
break;
}
}
fmc_lock();
请问这个问题该怎么解决呢?
fmc_unlock();
for (sectorIdx = first_sector; sectorIdx <= last_sector; sectorIdx++)
{
if(fmc_sector_erase(CTL_SN(sectorIdx)) != FMC_READY)
{
result = BLT_FALSE;
break;
}
}
fmc_lock();
请问这个问题该怎么解决呢?
赞0
为啥转换后地址会错误?
评论
2023-06-21
赞0
评论
2023-06-18
for (sector_num = 0; sector_num < 5; sector_num++) { ram_fmc_state = ram_fmc_sector_erase(CTL_SN(sector_num)); fmc_flag_clear(FMC_FLAG_END | FMC_FLAG_OPERR | FMC_FLAG_WPERR | FMC_FLAG_PGMERR | FMC_FLAG_PGSERR); if(ram_fmc_state!=FMC_READY) { while(1); } } 我这个连续擦除扇区 擦除第二个扇区后死机了 返回值正常 能帮分析一下么 大佬
赞0
/* erase all sectors one by one */
for (sectorIdx = first_sector; sectorIdx <= last_sector; sectorIdx++)
{
if((sectorIdx >= 12)&&(sectorIdx <= 23))
{
eraseIdx = sectorIdx + 4;
}
else if((sectorIdx >= 24)&&(sectorIdx <= 27))
{
eraseIdx = sectorIdx - 12;
}
if(fmc_sector_erase(CTL_SN(eraseIdx)) != FMC_READY)
{
/* could not perform erase operation */
result = BLT_FALSE;
/* error detected so don't bother continuing with the loop */
break;
}
}
评论
2023-05-23
您需要登录后才可以回复 登录 | 注册