Skip to content

Commit 53299b9

Browse files
qingehaoliuxianliang
authored andcommitted
修复stm32l4系列flash在下载完程序后首次擦除会失败的问题
1 parent e1cf0cd commit 53299b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size)
233233
HAL_FLASH_Unlock();
234234

235235
/* Clear OPTVERR bit set on virgin samples */
236-
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
236+
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR | FLASH_FLAG_PGSERR);
237237
/* Get the 1st page to erase */
238238
FirstPage = GetPage(addr);
239239
/* Get the number of pages to erase from 1st page */

0 commit comments

Comments
 (0)