2009-08-24 09:12 PM
Internal Flash Write Operation Problem
2011-05-17 04:21 AM
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 Regards2011-05-17 04:21 AM
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 errorSet by hardware when an address to be programmed contains a value different from '0xFFFF' before programming. Cheers, STOne-32.
2011-05-17 04:21 AM
Thanks a lot dear STOne-32,
I have solved the problem with that. Cheers, Özen