型号:STM32U575VG型号 Flash大小1MB,未使用secure功能; 代码如下:在对指定Page进行擦除时发现擦除失败,但是调用的相关驱动接口函数都没有返回错误,请问有遇到类似问题的吗?
- /* Fill EraseInit structure STM32U575VG Flash SIZE = 1024KB,sectors = 128,one page = 8K*/
- erase_init_cfg.TypeErase = FLASH_TYPEERASE_PAGES;
- erase_init_cfg.Banks = FLASH_BANK_1;
- erase_init_cfg.Page = start_page; // erase start page
- erase_init_cfg.NbPages = page_cnt;
- __disable_irq();
- /* Unlock the Flash to enable the flash control register access *************/
- error_state[0] = HAL_FLASH_Unlock();
- __HAL_FLASH_CLEAR_FLAG( FLASH_FLAG_ALL_ERRORS );
- error_state[1] = HAL_FLASHEx_Erase(&erase_init_cfg, &PageErr);
- /* Lock the Flash to disable the flash control register access (recommended
- to protect the FLASH memory against possible unwanted operation) *********/
- error_state[2] = HAL_FLASH_Lock();
-
- __enable_irq();
复制代码
 |