Fix onchip flash erase fail

This commit is contained in:
laoniaokkk 2023-09-20 11:48:44 +08:00 committed by Xiang Xiao
parent 7f5e6bd383
commit 4256dd934f

View File

@ -290,7 +290,7 @@ ssize_t up_progmem_eraseblock(size_t block)
flash_unlock();
modifyreg32(flash_ctrl, 0, FLASH_CTRL_SECERS);
modifyreg32(flash_addr, 0, block * AT32_FLASH_PAGESIZE);
modifyreg32(flash_addr, 0, block * AT32_FLASH_PAGESIZE + AT32_FLASH_BASE);
modifyreg32(flash_ctrl, 0, FLASH_CTRL_ERSTR);
while (getreg32(flash_sts) & FLASH_STS_OBF)