cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to write 32 bytes in flash without affecting the other memory elements?

Mkuma.7
Associate III

Is there any way to erase 32bytes in flash?

17 REPLIES 17

Depends on where that other memory is, and how it falls on the page/block boundaries of the flash device.

For settings, configuration, calibration or serial number type stuff you can leave a region unwritten. Write to it once, or journal entries across it, using your code to locate the last valid record.

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

Is there any way to write 32 bytes in flash without affecting the other memory elements? Yes.

Can you tell me the command?

Yes. Given that the space for the binary is already erased.

If you tell me the command it will be helpful for me.

Can you please share the command?

Mkuma.7
Associate III

How to erase protected sectors? (When I tried to erase this warning was showed Protected sectors are not erased)

Mkuma.7
Associate III

How to erase protected sectors? (When I tried to erase this warning was showed Protected sectors are not erased)

Can anyone here help me with this?

Sorry I don't know how to do this with external tool like cube programmer. Maybe just prepare a suitable hex file that contains the 32 bytes, and disable erase.

For embedded STM32 program - just call HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, DATA_64) 4 times (8*4=32). Please see this example

Protected sectors are called protected because they cannot be erased easily.

First, remove write protection from these sectors. The protected sectors are defined in the "option bytes". See the CubeProgrammer user manual for details.