Skip to main content
Graduate
April 11, 2024
Question

Single word flash programming is not properly write the memory and disturbed multi write

  • April 11, 2024
  • 5 replies
  • 2639 views
Hi, I work in the stm32h503rbt6 controller, I use an internal clock 64Mhz and developed the Flash driver on my own and also works well in multi-word write only, single word write is not working, it is not writing the data in Flash memory(in single word). Anyone, please help how to resolve it
    This topic has been closed for replies.

    5 replies

    Super User
    April 12, 2024

    In context of writing the internal flash, word means the "flash word" which for STM32H503 is 128 bits (16 bytes). You can write less than 16 bytes to a "flash word" (see the RM for details) but then you cannot write other bytes in the same flash word, because of ECC (see the RM for details again).  Typically you want to fill entire 16-byte "flash words", maybe except of the last incomplete "word".

    Bottom line, the internal flash is special and not friendly to byte-granular (or even bit-granular) writes, as possible with some other memories.

     

    Mohan30Author
    Graduate
    April 20, 2024

    Hi all,

    @Pavel A.  Thank you, buddy. but

    Still, I have that issue, I can't find the proper solution, anyone guide me to get the proper solution 

    Thanks

    Super User
    April 20, 2024

    Here you can find help for your project.

    Somebody who will drill into your requirements, study documentation and examples, find proper design and help writing code.

     

    Super User
    April 20, 2024

    Hi,

    >works well in multi-word write only, single word write is not working

    Single word write is not possible . Just accept this.

    Full 16-byte "flash words" have to be written. Thats it.

    Mohan30Author
    Graduate
    April 20, 2024

    Hi @AScha.3 

    Can you explain that, why single word write method is not working?

    I want to know about reason.

    Thanks

    Super User
    April 20, 2024

    Hi,

    see rm :

    AScha3_0-1713613504968.png

    So every write, that not generates a valid ECC will give a exception - "flash corrupted" or so .

    You can set just one bit - but only when writing a full 16-byte "flash word" with this bit and all other zero or what you want.

    AScha3_1-1713613800756.png

     

    Super User
    April 20, 2024

    The ECC by itself is not the problem. Some flash chips have ECC as well but they are designed to allow more granular writes. (This invalidates ECC on the block, but write succeeds TL;DR) It's just the ST implementation choice. If you want to write by small pieces, use suitable external memory chip. No external chip? then comply with ST limitation.