status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); /* If the erase operation is completed, disable the OPTER Bit */ CLEAR_BIT(FLASH->CR, FLASH_CR_OPTER); if(status == HAL_OK) { /* Enable the Option Bytes Programming operation */ SET_BIT(FLASH->CR, FLASH_CR_OPT...
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);程序设计:头文件://FLASH容量 #...
if(FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE, FLASH_BANK_1) != HAL_OK) { status = HAL_ERROR; } } /* 等待BANK2的操作完成 */ if((pEraseInit->Banks & FLASH_BANK_2) == FLASH_BANK_2) { if(FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE, FLASH_BANK_2) ...
PAGE_SIZE);voideaser_flash(void){/* -1- Unlock the Flash Bank Program Erase controller */HAL_FLASH_Unlock();/* -2- Clear All pending flags */__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP|FLASH_FLAG_WRPERR|FLASH_FLAG_PGERR);/* -3- erase the FLASH...
(uint32_t)FLASH_TIMEOUT_VALUE, bank); if(status == HAL_OK) { if(bank == FLASH_BANK_1) { #if defined (FLASH_OPTCR_PG_OTP) if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD) { /* 设置OTP寄存器的PG位,使能可以编程 */ SET_BIT(FLASH->OPTCR, FLASH_OPTCR_PG_OTP); } else #endif ...
{bank=FLASH_BANK_2;}/* 错误标识,无错误 */pFlash.ErrorCode=HAL_FLASH_ERROR_NONE;/* 等待操作完成 */status=FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE,bank);if(status==HAL_OK){if(bank==FLASH_BANK_1){#ifdefined(FLASH_OPTCR_PG_OTP)if(TypeProgram==FLASH_TYPEPROGRAM_OTP...
HAL_SPI_Transmit(&hspi1, cmd, 2, W25Qx_TIMEOUT_VALUE); W25Qx_Disable(); } ID 对于兆易创新W25Q64,主要有三种查询ID方式。 可以使用90H查询设备ID,以判断是否是W25Q64设备。 /* Identification Operations */ #define READ_ID_CMD 0x9F /** ...
*/staticvoidBSP_W25Qx_Reset(void){uint8_tcmd[2] = {RESET_ENABLE_CMD,RESET_MEMORY_CMD};W25Qx_Enable();/* Send the reset command */HAL_SPI_Transmit(&hspi1, cmd,2, W25Qx_TIMEOUT_VALUE);W25Qx_Disable(); } ID 对于兆易创新W25Q64,主要有三种查询ID方式。
W25Qx_Enable();/* Send the read ID command */HAL_SPI_Transmit(&hspi1, cmd,4, W25Qx_TIMEOUT_VALUE);/* Reception of the data */if(HAL_SPI_Receive(&hspi1, pData,Size,W25Qx_TIMEOUT_VALUE) != HAL_OK) {returnW25Qx_ERROR; ...
Hi, I'm receiving the error "PC of target system has unexpected value after erasing sector" while erasing external NOR FLASH S25FL127S (Cypress) connected to MCU LPC4357 (NXP) using J-Flash V6.32f. Earlier versions of J-Flash (V6.30 for example) the…