Skip to main content
ayaki
Associate II
February 14, 2019
Solved

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

  • February 14, 2019
  • 3 replies
  • 4909 views

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.

This topic has been closed for replies.
Best answer by Tesla DeLorean

 /* 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

3 replies

After Forever
Senior III
February 14, 2019

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.

ayaki
ayakiAuthor
Associate II
February 15, 2019

it works now. thank you very much. :thumbs_up:

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
February 14, 2019

 /* 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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
ayaki
ayakiAuthor
Associate II
February 15, 2019

it works now. thank you very much. :thumbs_up:

ZYubi
Associate III
March 12, 2019

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

ZYubi
Associate III
March 12, 2019

/* 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?

Kilian Nötzold
Associate III
June 26, 2019

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.