cancel
Showing results for 
Search instead for 
Did you mean: 

I can not use backup RAM for STM32H743BI. Is there any application note or source code for backup RAM.

ayaki
Associate II

I am using STM32H743BI controller. I need to use backup RAM as nonvolatile ram. So I use external 3V battery and LSE 32.768 crystal for RTC. RTC works well but I can not use backup RAM. I use code like below;

PWR->CR1 |= PWR_CR1_DBP;

while(((PWR->CR1 & PWR_CR1_DBP) == 0));

I do not know is there anything I should do. I can not find any application not or source code about backup RAM.

1 ACCEPTED SOLUTION

Accepted Solutions

 /* Enable Back up SRAM */

 /* Enable write access to Backup domain */

 PWR->CR1 |= PWR_CR1_DBP;

 while((PWR->CR1 & PWR_CR1_DBP) == RESET)

 {

 }

 /*Enable BKPRAM clock*/

 __HAL_RCC_BKPRAM_CLK_ENABLE();

STM32Cube_FW_H7_V1.3.0\Projects\STM32H743I_EVAL\Demonstration\STemWin\Core\Src\k_bsp.c

STM32Cube_FW_H7_V1.3.0\Projects\STM32H743I_EVAL\Demonstration\STemWin\Core\Src\k_rtc.c

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

View solution in original post

8 REPLIES 8

Find the Backup SRAM address and size in the Reference Manual's memory map description section.

You'll have to create a new section in your linker file (or "scatter" file, depending on your toolchain) with the description of you backup SRAM position and size, then make some data to end up in there using special declaration syntax. [Click Show More]

You can find this document at http://www.openstm32.org/Using+CCM+Memory?structure=Documentation useful, it describes how to use the CCM RAM for a GCC-based toolchain, but I think it can be applied to using the Backup SRAM too.

 /* Enable Back up SRAM */

 /* Enable write access to Backup domain */

 PWR->CR1 |= PWR_CR1_DBP;

 while((PWR->CR1 & PWR_CR1_DBP) == RESET)

 {

 }

 /*Enable BKPRAM clock*/

 __HAL_RCC_BKPRAM_CLK_ENABLE();

STM32Cube_FW_H7_V1.3.0\Projects\STM32H743I_EVAL\Demonstration\STemWin\Core\Src\k_bsp.c

STM32Cube_FW_H7_V1.3.0\Projects\STM32H743I_EVAL\Demonstration\STemWin\Core\Src\k_rtc.c

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

it works now. thank you very much. 👍

it works now. thank you very much. 👍

ZYubi
Associate II

I met a problem,The Backup SRAM can read and write,but can't keep DATA when reset the MCU.

/* Enable write access to Backup domain */

 PWR->CR1 |= PWR_CR1_DBP;

 while((PWR->CR1 & PWR_CR1_DBP) == RESET)

 {

 }

 /*Enable BKPRAM clock*/

 __HAL_RCC_BKPRAM_CLK_ENABLE();

  

 *(__IO uint32_t*)(0x38800000+36) = 12345678;

12345678 can be written in BACKUP RAM,but can't be keep if reset the MCU. What's wrong?

I was facing the same issue. I was able to solve this by adding:

SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)

after writing to the backup RAM.

The issue was that the data was still in the cache and has not been transferred into the SRAM when the rest occurs.

Worked for me. Thank you. There was another post, https://community.st.com/s/article/FAQ-STM32H7-SRAM-Backup-SRAM-content-is-not-preserved-after-reset, where it mention the reason and solution for this problem. In my case I was writing about 200 bytes, none of the data got retained after reset unless I use SCB_CleanDCache_by_Add() as suggested by Kilian.