This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem during writing to the Flash for MSP432

I wanted to write to the flash of the MSP432P401R launchpad 

I used this functions first

MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
FlashCtl_setWaitState(FLASH_BANK0, 2);
FlashCtl_setWaitState(FLASH_BANK1, 2);
MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48);
FlashCtl_unprotectSector(FLASH_MAIN_MEMORY_SPACE_BANK0, FLASH_SECTOR7 | FLASH_SECTOR8 | FLASH_SECTOR9);
FlashCtl_enableWordProgramming(FLASH_IMMEDIATE_WRITE_MODE);
FlashCtl_initiateSectorErase(FLASH_SECTOR7);

then I wrote to the flash using assembly language, but I found that the data is wrote to the flash just after I build the project before actually executing the store instructions 

also after I run the code two or three times I got error about writing to the flash, I had to reset the launchpad before using it again

what did I do wrong , and how can I fix that ?

I'm using IAR system

**Attention** This is a public forum