STLink_V2调试STM32L071 IAP功能时,执行到FLASH_If_Erase()出现以下
// 在以下代码中 增加1ms延时,解决问题。原因待解。
HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError)
{
/* If the erase operation is completed, disable the ERASE Bit */
CLEAR_BIT(FLASH->PECR, FLASH_PECR_PROG);
CLEAR_BIT(FLASH->PECR, FLASH_PECR_ERASE);
if (status != HAL_OK)
{
/* In case of error, stop erase procedure and return the faulty address */
*PageError = address;
break;
}
HAL_Delay(1); //不加debug时,自动退出
}
}
}