cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746, STM32CubeIDE

ADębs.1
Senior

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

Andrzej

19 REPLIES 19
TDK
Guru

See CubeMX examples for how to properly call HAL_FLASHEx_Erase and HAL_FLASH_Program.

https://github.com/STMicroelectronics/STM32CubeF7/blob/c7c5ec99c7482ea8bcdbf0a869c930af4547088f/Projects/STM32F769I_EVAL/Applications/EEPROM/EEPROM_Emulation/Src/eeprom.c

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

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

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

Thank you. I will write back.

Andrzej

https://controllerstech.com/flash-programming-in-stm32/

I'm sorry, but this is at the same level that HAL/Cube code is - unusable APIs, broken logic, full of bugs, inefficient, lack of basic C knowledge and generally stupid code. Such an incompetent people should not teach anyone. And also generally such type of videos do not teach anything. "Copy this, click that..." doesn't explain HOW and WHY.

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

No, problem. I suggested an application note, earlier. I prefer good written documentation to most video tutorials.

I fixed the link to the AN in my earlier message.

I also found this library: EmuEEPROM. Based on AN3969, it's actively maintained.

For me it is not nonsense as you suggest.

Andrzej

I wrote a test program. On line 58 I had to add #define. Display attention.

There is information on line 693.

Why?

Andrzej