cancel
Showing results for 
Search instead for 
Did you mean: 

Internal Flash Write Operation Problem

ozenozkaya
Associate II
Posted on August 25, 2009 at 06:12

Internal Flash Write Operation Problem

3 REPLIES 3
ozenozkaya
Associate II
Posted on May 17, 2011 at 13:21

Hello,

I am trying to write a variable to an address of the internal flash. but i can not write different values to an adress of the flash. it keeps the first value. For example:

Address = StartAddr;

for(i=1;i

{

SetNumber(i, 127);

PrepareLEDDriveBuffer();

ClearDisplay();

Delay(0x1FFFFFF);

Data = 0x00000000 + i;

FLASH->CR |= 1;

FLASH_Unlock();

FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

FLASHStatus = FLASH_ErasePage(Address);

FLASHStatus = FLASH_ProgramWord(Address, Data);

//Address = Address + 4;

}

when i do this, it always keeps the ''1'' value at the Adress! Please help...

Thanks and Regards

16-32micros
Associate III
Posted on May 17, 2011 at 13:21

Dear ozenozkaya,

This is a normal behavior of the STM32F1xx Flash, You can write to an address a data of 16-bit only if the content of address is equal to 0xFFFF

if you write a second time, then the Hardware logic will not write it. You can refer to our Flash Programming Manual PM0042 ( June 2009) :

http://www.st.com/stonline/products/literature/pm/13259.pdf

, See page 25/33 :

Bit 2 PGERR: Programming error

 

Set by hardware when an address to be programmed contains a value different from '0xFFFF' before programming.

Cheers,

STOne-32.

ozenozkaya
Associate II
Posted on May 17, 2011 at 13:21

Thanks a lot dear STOne-32,

I have solved the problem with that.

Cheers,

Özen