Skip to main content
vv_it
Associate
October 12, 2011
Question

STM32F10xxx Flash over writing/programming

Posted on October 12, 2011 at 10:48

Hi, I need to reset individual bits in already written word/byte in the on-chip flash (from 0x0800 0000). The problem is that according to Programming manual PM0075 (STM32F10xxx Flash memory microcontrollers) :

Flash program and erase controller (FPEC) preliminarily reads the value at the addressed main Flash memory location and checks that it has been erased.  If not, the program operation is skipped and a warning is issued by the PGERR

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

How can I write let’s say 0xF1 and later overwrite it by 0x01 or 0xF0 without emptying a flash memory page/block before?

    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    October 12, 2011
    Posted on October 12, 2011 at 13:50

    You'll need to use 16-bit wide flags, it really doesn't permit bit level programming.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    emalund
    Associate III
    October 12, 2011
    Posted on October 12, 2011 at 14:42

    to REset bits you do not need to erase.

    Erik

    vv_it
    vv_itAuthor
    Associate
    October 14, 2011
    Posted on October 14, 2011 at 18:01

    Hi Erik, could you please refine your message - I do not understand if you have solution to the problem of resetting individual bits in programmed flash?

    Hi clive1, why did you mention the wideness - could we bypass the FPEC check for 0xFFFF, or bypass FPEC itself during flash rewriting?
    Tesla DeLorean
    Guru
    October 14, 2011
    Posted on October 14, 2011 at 19:06

    I mentioned width in the context of the amount of void space you'll need to leave if you plan to come back and write something over it later.

    For instance a block marker, that says the following block is invalid or superceeded. You use flash in a journaled fashion so you can add incremental updates until you reach an erase threshold so you aren't continually writing/erasing the same block for petty changes.

    What type of flash memory does ST use? The whole 1 -> 0 model fails for MLC

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..