AnsweredAssumed Answered

f407 read/write flash error

Question asked by shen.cheng on Nov 13, 2013
Latest reply on Nov 15, 2013 by shen.cheng
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

and i try to run this code without otherthings the same problem occur
                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);

every function return flash_error_program status
i really dont understand why this happen
my chips is stm32f407ze
please somebody help

update: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 problem

update3: 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 code