找到了,必须是清除所有错误标志,否则擦除页会失败,第2条这里可以看到。在rm0454 stm32g0x0参考手册3.3.7FLASH Main memory erase sequences能找到这段
To erase a page (2 Kbytes), follow the procedure below:
1.Check that no Flash memory operation is ongoing by checking the BSY1 bit of the
FLASH status register (FLASH_SR).
2.Check and clear all error programming flags due to a previous programming. If not,
PGSERR is set.
3.Set the PER bit and select the page to erase (PNB) in the FLASH control register
(FLASH_CR).
4.Set the STRT bit of the FLASH control register (FLASH_CR).
5.Wait until the BSY1 bit of the FLASH status register (FLASH_SR) is cleared.