cancel
Showing results for 
Search instead for 
Did you mean: 

Program word in flash

spa
Associate II
Posted on January 16, 2009 at 06:45

Program word in flash

2 REPLIES 2
spa
Associate II
Posted on May 17, 2011 at 12:59

Hi.

I’m trying to write to the flash but every time I try to do a FLASH_ProgramWord(), it ends up in the HardFault_Handler.

I'm using the approach that is used in ST’s Write_Portection examples.

Code:

/* Unlock the Flash Program Erase controller */

FLASH_Unlock();

FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP|FLASH_FLAG_PGERR |FLASH_FLAG_WRPRTERR);

/* Get pages write protection status */

WRPR_Value = FLASH_GetWriteProtectionOptionByte();

ProtectedPages = WRPR_Value & 0xFFFFFFFF;

if (ProtectedPages == 0x00)

{/* Pages are write protected */

/* Disable the write protection */

FLASHStatus = FLASH_EraseOptionBytes();

}

FLASH_ErasePage(APPLICATION_ADDRESS);

FLASHStatus = FLASH_ProgramWord(0x00001111,APPLICATION_ADDRESS);

I hope anyone can help me.

Søren P.

spa
Associate II
Posted on May 17, 2011 at 12:59

Hi.

Error located, embarrassed….

FLASH_ProgramWord() is (Address, Data) i had (Data, Address)

Best regards

Søren P.

:-]