cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H753 eval board. Cannot write to backup RAM

Pavel A.
Evangelist III

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

1 ACCEPTED SOLUTION

Accepted Solutions

PWR and BKPRAM clocks are enabled in RCC?

I don't Cube nor 'H7.

JW

View solution in original post

3 REPLIES 3
Pavel A.
Evangelist III

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
}

PWR and BKPRAM clocks are enabled in RCC?

I don't Cube nor 'H7.

JW

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