2019-02-14 05:45 AM
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.
Solved! Go to Solution.
2019-02-14 10:20 AM
/* 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
2019-02-14 07:58 AM
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.
2019-02-14 10:20 AM
/* 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
2019-02-14 10:02 PM
it works now. thank you very much. :thumbs_up:
2019-02-14 10:03 PM
it works now. thank you very much. :thumbs_up:
2019-03-11 06:36 PM
I met a problem,The Backup SRAM can read and write,but can't keep DATA when reset the MCU.
2019-03-11 06:48 PM
/* 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?
2019-06-26 12:20 PM
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.
2020-12-31 12:43 AM
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.