2023-02-22 02:08 PM
Hello everybody,
My name is Rego, as a hobby I work on displays, image processing, etc...
I'm not very familiar with ST, but I'm really enjoying these MCU.
I've already implemented RTC using VBAT and it works very well. Now I want SRAM backup,
On battery it loses data I can't understand the reason for the problem, can anyone help me?
thanks
Solved! Go to Solution.
2023-02-23 03:49 PM
Last time I did this on STM32H743-EVAL board, years ago.
If memory serves: enable the backup domain power regulator with HAL_PWREx_EnableBkUpReg()
Then unlock access to the backup RAM to read and write:
// Unlock access to backup RAM
void unlock_bkp_RAM(void)
{
__HAL_RCC_BKPRAM_CLK_ENABLE();
__DMB();
if (!LL_PWR_IsEnabledBkUpAccess())
{
HAL_PWR_EnableBkUpAccess();
__DMB();
}
}
If the battery is rechargeable, you may need to turn on/off the charger, by HAL_PWREx_EnableBatteryCharging and HAL_PWREx_DisableBatteryCharging.
The Cube FW_H7 software package has examples of backup RAM and RTC registers use, look at these.
Enjoy.
2023-02-22 08:59 PM
Ib don't use the 'H7 family but in other Hamilton for the backup SRAM to work under VBAT supply, a dedicated internal voltage regulator has to be switched on (in PWR module) Try to search for it in Reference Manual (RM).
JW
2023-02-23 02:00 PM
Did you refer to this?
Thanks,
Rego
2023-02-23 03:49 PM
Last time I did this on STM32H743-EVAL board, years ago.
If memory serves: enable the backup domain power regulator with HAL_PWREx_EnableBkUpReg()
Then unlock access to the backup RAM to read and write:
// Unlock access to backup RAM
void unlock_bkp_RAM(void)
{
__HAL_RCC_BKPRAM_CLK_ENABLE();
__DMB();
if (!LL_PWR_IsEnabledBkUpAccess())
{
HAL_PWR_EnableBkUpAccess();
__DMB();
}
}
If the battery is rechargeable, you may need to turn on/off the charger, by HAL_PWREx_EnableBatteryCharging and HAL_PWREx_DisableBatteryCharging.
The Cube FW_H7 software package has examples of backup RAM and RTC registers use, look at these.
Enjoy.
2023-02-25 02:05 PM
Thanks for your help, it finally works,,!!:thumbs_up:
Regards,
Rego