2013-11-13 02:03 AM
i use my own board and try to use SD card to update IAP when i try to erase/write flash the function always return ''flash_error_program''
i checked flash->sr value is 0xC0, but i just follow the step with stm32f4_iap_using_usart program which download from st.comand i try to run this code without otherthings the same problem occurFLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_PGSERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_WRPERR | FLASH_FLAG_OPERR | FLASH_FLAG_EOP);
FLASH_OB_Unlock();
FLASH_OB_WRPConfig(OB_WRP_Sector_4, DISABLE);
FLASH_OB_WRPConfig(OB_WRP_Sector_5, DISABLE);
FLASH_OB_WRPConfig(OB_WRP_Sector_6, DISABLE);
FLASH_OB_WRPConfig(OB_WRP_Sector_7, DISABLE);
FLASH_EraseSector(FLASH_Sector_4,VoltageRange_3);
FLASH_EraseSector(FLASH_Sector_5,VoltageRange_3);
FLASH_EraseSector(FLASH_Sector_6,VoltageRange_3);
FLASH_EraseSector(FLASH_Sector_7,VoltageRange_3);
every function return flash_error_program statusi really dont understand why this happenmy chips is stm32f407zeplease somebody helpupdate:i try to use stm32f4_iap_using_usart staff on my board and i comment all usart things which my board didnt use, when i run to erase function the same problem occur, it return flash_error_program again. is it hardware problem? but i tried 2 boards, it always same update2: found where the problem is. when i change the data of flash register like when i call flash_unlock() the flash->ack didnt change same as clear flag so the sr didnt be clear that the problem occur.still confuse what makes this problemupdate3: i found i make a mistake i cant read the flash->keyr, the flash_unlock works fine the flash has been unlock when i check flash->cr, i found where the problem is i can clear flag manually on keil debug view but when i run any step of my code the PGPERR and PGSERR back to high. It should be set by hardware but i didnt run any code2013-11-14 03:00 AM
Did you tried to use the ST-Link Utility tool for Flash erase?
-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2013-11-14 05:22 PM
Nope, i dont have stlink but i use Jlink to erase/download program on flash all work
2013-11-14 06:42 PM
Wouldn't you need to FLASH_OB_Launch() to commit the changes of the Option Bytes, prior to doing an erase?
2013-11-14 06:50 PM
i tried but still not work