2019-10-02 04:50 PM
I call HAL_PWR_EnableBkUpAccess() but writes to backup RAM (4K in battery backed domain) won't stick. Data always remains 0. No error or fault on write.
What else can be missing??
RTC backup registers write test on same board is successful (means, tamper not active).
But what is notable, it is successfull even without enabling backup domain access! (HAL_PWR_EnableBkUpAccess)
The board is STM32H753 Eval-2.
Attached is example project for Atollic. Anyone wants to look?
Regards,
-- pa
Solved! Go to Solution.
2019-10-02 11:56 PM
2019-10-02 05:00 PM
This is the code basically.
#define BACKUP_RAM_BASE 0x38800000 // from RM
struct BK_test_s {
uint16_t x1;
uint16_t x2;
uint32_t w1;
};
void batt_ram_test(void)
{
__HAL_RCC_BACKUPRESET_RELEASE();
__DSB();
__DMB();
__HAL_RCC_BKPRAM_CLK_ENABLE(); /**** this was missing ***/
HAL_PWR_EnableBkUpAccess();
__DSB();
volatile struct BK_test_s *bp = (struct BK_test_s *)(BACKUP_RAM_BASE + 32);
bp->x1 = 0x42;
bp->w1 = 0xAABBCCDD;
__DSB();
__DMB();
while (bp->x1 != 0x42) {}
printf("Backup memory checked\n"); // NEVER REACHED
}
2019-10-02 11:56 PM
PWR and BKPRAM clocks are enabled in RCC?
I don't Cube nor 'H7.
JW
2019-10-03 01:39 PM
Yep. It was clock in RCC. Thank you Jan.
__HAL_RCC_BKPRAM_CLK_ENABLE() was missing.
> I don't Cube nor 'H7
And hate Eclipse :)
Interesting, the backup domain access is enabled after reset.
Check for the PWR bit set by HAL_PWR_EnableBkUpAccess shows it is already set.
If this isn't artifact of the debugger, this contradicts the manual.
-- pa