Skip to main content
ADębs.1
Senior
June 7, 2021
Solved

STM32F746, STM32CubeIDE

  • June 7, 2021
  • 5 replies
  • 3356 views

How to remember in STM32F746G-Disco uint32_t? Save after power off and recall when power is restored?

Andrzej

This topic has been closed for replies.
Best answer by Maurizio1

This YouTube tutorial should help you: STM32 FLASH Programming || SECTOR TYPE || M4, M7

5 replies

Maurizio1
Associate II
June 7, 2021

Maybe you can use the SD card?

This tutorial is based on your board:

https://www.youtube.com/watch?v=I9KDN1o6924

Please use more more meaningful titles for your questions.

TDK
Super User
June 7, 2021

It takes some work if you want to store things on the chip itself. Dedicate a page of flash to storing user values. You must erase the entire page of flash to overwrite the values.

Otherwise use an external EEPROM/FRAM or SD card as Maurizio suggests.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ADębs.1
ADębs.1Author
Senior
June 7, 2021

I need to save 4 bytes when power off.

Andrzej

Maurizio1
Associate II
June 7, 2021

This is an application note describing the process of so-called "EEPROM emulation".

AN3969

[Edited to link the AN about devices that are more similar to the one used by the OP]

It does not require a SD card to be present in your system (which already has a SD drive), but it's relatively more complex to be organized, as you have to know the layout of the embedded flash memory in order to not overwrite your own code.

If you can handle that, "EEPROM emulation" is probably better for a fixed, simple data as a 4-byte unsigned integer.

ADębs.1
ADębs.1Author
Senior
June 10, 2021

I want to write and read FLASH. Please send the sector addresses file STM32F7.

Andrzej

ADębs.1
ADębs.1Author
Senior
June 10, 2021

When I use "HAL_FLASH_Program (FLASH_TYPEPROGRAM_WORD, FLASH_SECTOR_4, total_time);" I need to "FLASH_Erase_Sector (FLASH_SECTOR_4, FLASH_VOLTAGE_RANGE_3);" ?

Andrzej

Maurizio1
Maurizio1Best answer
Associate II
June 11, 2021

This YouTube tutorial should help you: STM32 FLASH Programming || SECTOR TYPE || M4, M7

ADębs.1
ADębs.1Author
Senior
June 12, 2021

Thank you. I will write back.

Andrzej

TDK
Super User
June 10, 2021
"If you feel a post has answered your question, please click ""Accept as Solution""."
ADębs.1
ADębs.1Author
Senior
June 11, 2021

Need:

1.after turning on the power, read the saved value from FLASH (uint32_t)

2.Unlock FLASH 2. delete the FLASH sector

3.Set the power drop interrupt in StartTask02

4. write one byte in the interrupt (uint32_t)

5.Lock FLASH

Will it work?

Andrzej

Piranha
Principal III
June 12, 2021

Read the FLASH section in a reference manual and also the whole AN3969. Many current and future questions will be answered by that...