AnsweredAssumed Answered

erase is not working in my board!!!

Question asked by ouled_omar.ilyes on Apr 20, 2016
Latest reply on Apr 21, 2016 by ForumSTM32.ForumSTM3
Hello everyone,
I'm developing a code in STM32F407VG. this code will erase the flash memory in a first step, and for a further work will upload a code into this memory.
this is my code for erasing the flash memory.
//unlocking the flash memoryif((FLASH->CR & 0x80000000) != 0x0)        {                FLASH->KEYR = 0x45670123;                FLASH->KEYR = 0xCDEF89AB;        }//clear the flagsFLASH->SR |= (0x80 | 0x40 | 0x20 | 0x2);// erase all pagesFLASH->CR |= 0x4 | 0x8000;FLASH->CR |= 0x10000;    /* Disable the MER Bit */FLASH->CR &= ~(0x4 | 0x8000);// writing//locking flashFLASH_CR |= 0x80000000;
Please, give me where am I wrong.
(I should work directly with registers)
Thank you and Best Regards.

Outcomes