2021-06-02 01:17 PM
Hello,
I developed a custom-designed system with an STM32F767 microprocessor and controlled its parameters with a user interface through a Bluetooth module. When I power off then power on the system, I couldn't communicate with the circuit board. Is there a way to store codes without affecting power off?
Thank you,
2021-06-02 01:45 PM
Use battery-backup RAM, an external EEPROM, or portion of the internal FLASH.
JW
2021-06-02 01:48 PM
How can use internal FLASH?
2021-06-02 02:02 PM
Read the FLASH chapter in RM.
JW
2021-06-02 02:19 PM
I have checked the reference manual, https://www.st.com/resource/en/reference_manual/dm00224583-stm32f76xxx-and-stm32f77xxx-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf
Then I see the flash memory bank and section address and commanding flash memory. But I don't know how exactly to place my codes in flash memory?
2021-06-02 03:02 PM
Flash is non-volatile, which means it will keep its value after reset. However, you must erase an entire page of flash before writing to it instead of accessing bytes as in RAM. Programs typically store user data by reserving an entire page of flash. Using a page of flash in this way is sometimes called EEPROM emulation.
Here's an example:
2021-06-02 03:03 PM
Put the data in a structure, erase a sector you've chosen or set aside for this purpose, erase then write the block of data into it.
STM32Cube_FW_F7_V1.16.0\Projects\STM32F767ZI-Nucleo\Examples\FLASH\FLASH_EraseProgram
Probably want to floor-plan some of the smaller sectors/blocks so it uses less resources, and is quicker.
If multiple instances of the data structure will fit you can journal them across the available space, with perhaps checksums and sequence numbers, so you can recover the latest data when you restart.
2021-06-04 08:31 AM
Thank you for your comments!
I verified that the codes were stored in the flash memory bank 2 with STLink utility (attached figure). To diagnose the problem, I placed led blinking comments after receiving data commands from the UART and after sending data commands with the UART. When I powered off and then power on the circuit, it received the data but it didn't send it back. How can I solve this issue?
2021-06-05 09:13 AM
My crystal ball indicates that the author did mislead all the previous experienced users... Probably the author saw that the device is not working as expected and assumed that it's because the code is erased/not stored.
Therefore the solution is to debug and fix the code. And there are a zillion UART/USART related topics. One of the best is this:
2021-06-07 08:54 AM
@Piranha Thank you for reporting the crystal ball view.
On my system, I used the UART in polling mode, so does it may reason to fail the system when transmitting data? I checked the link that you have linked, so based on the pros and cons of the modes, does the DMA mode operation solve the problem?