Solved
Writing to Backup SRAM on STM32H7S78-DK
I am trying to use the backup SRAM but get a hard fault when writing to the memory. I have unlocked the backup domain, enabled the backup regulator, and enabled the clock. What other step am I missing?
// unlock backup domain
HAL_PWR_EnableBkUpAccess();
// enable the backup SRAM
if (HAL_OK != HAL_PWREx_EnableBkUpReg())
{
Error_Handler();
}
__HAL_RCC_BKPRAM_CLK_ENABLE();
// lock the backup domain
HAL_PWR_DisableBkUpAccess();
// Test read and write to backup SRAM
uint32_t magicNumber = 0xAA55;
uint32_t *pBackupSram = (uint32_t *)(0x38800000);
*pBackupSram = magicNumber;
if (magicNumber != *pBackupSram)
{
Error_Handler();
}
*pBackupSram = 0;
if (0 != *pBackupSram)
{
Error_Handler();
}
