Skip to main content
ozenozkaya
Associate II
August 25, 2009
Question

Internal Flash Write Operation Problem

  • August 25, 2009
  • 3 replies
  • 753 views
Posted on August 25, 2009 at 06:12

Internal Flash Write Operation Problem

    This topic has been closed for replies.

    3 replies

    16-32micros
    Associate III
    May 17, 2011
    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
    May 17, 2011
    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

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

    Thanks a lot dear STOne-32,

    I have solved the problem with that.

    Cheers,

    Özen