cancel
Showing results for 
Search instead for 
Did you mean: 

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

Mohan30
Associate III
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
8 REPLIES 8
Pavel A.
Evangelist III

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.

 

Mohan30
Associate III

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

Pavel A.
Evangelist III

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.

 

AScha.3
Chief III

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.

If you feel a post has answered your question, please click "Accept as Solution".

Hi @AScha.3 

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

I want to know about reason.

Thanks

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

 

If you feel a post has answered your question, please click "Accept as Solution".

@AScha.3 

Thanks,  Buddy. for your update:smiling_face_with_smiling_eyes:

Pavel A.
Evangelist III

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.