2026-03-04 11:09 AM - last edited on 2026-03-09 3:40 AM by KDJEM.1
Hello,
I have some setup variables in my app which should retained while the power is switched off. Normally I would use the dedicated Backup RAM, but the board does not have backup battery, battery socket, not a battery connector. The Backup RAM is not usable with STM32n6570-DK board.
The MCU does not have internal flash memory with backup area. (This worked with H747 and H723 MCUs) The board has an external 1Mbit flash memory controlled by OCTOSPI so I might store data in the external flash. I need max 512 bytes only. This 512-byte backup should be placed to the end of the external flash.
Can anybody advice how to do this?
Best regards,
Louis
2026-03-04 6:12 PM
What are you looking for in particular? This is not a code writing service.
Erase the page of flash, write new values. Re-read it on startup. If power shuts off during writing, the data can be corrupted so sometimes two pages are used.
See the EEPROM emulation library for ST's solution for this. It's not set up for the N6 as it doesn't have internal flash, but it could be adapted.
How to use EEPROM emulation on STM32 MCUs - Application note
2026-03-05 12:13 AM
Just for sure. I already solved flash based back/restore settings in H747I-DISCO, H723-Nucleo and U5-DK2 boards. All of these had internal flash memory. The N6 has external flash (128MB) only controlled via XSPI and I have never used Octo SPI, I do not know how to initialize it, even I am not sure whether it has Memory Mapped mode. I thought I ask it from the community. It was not a good decision.
2026-03-05 2:30 AM - edited 2026-03-05 4:53 AM
So your real question is, "how to write to XSPI Flash?", then ?
PS:
Does this Knowledge Base article help: Overall FAQs for QUADSPI/OCTOSPI/HSPI/XSPI ?
2026-03-05 8:29 AM - edited 2026-03-05 9:35 AM
I thought an answer something like this...
This will be complicated...
Your idea to use XSPI2 to store your settings in the external flash is problematic.
The probable hardware solutions:
The probable software solution:
Louis
2026-03-06 6:35 AM
Sorry, it was a nice idea, but it will never work. After the FSBL loaded the Application code into RAM then all control will be set too Application project. The FSBL does not run any more. So, sending an interrupt to FSBL (or polling IPC_Request.saveRequest = true in main loop of FSBL will never work. I think I give it up and I try to save the settings to an SD card.
Louis