Problem with STM32H743 backup ram access with 16 Bit
We use the STM32H743BI.
We have a problem with writing the Backup-RAM if the mapped variables size is not multiple of 32 Bit.
According to the reference manual (rev. 7) the backup RAM is accessible in 32-bit, 16-bit or 8-bit data mode. (RM0433 Rev 7, page 264, Backup RAM).
We have mapped a struct with several elements on the start address of the backup RAM (0x38800000). Each element has data size of 16Bit.
Struct:
struct tBackupRamDataStruct
{
UINT16 ui16Test1;
UINT16 ui16Test2;
UINT16 ui16Test3;
UINT16 ui16Test4;
};Code:
int main(void)
{
static volatile struct tBackupRamDataStruct
tBackupRamDataStruct __attribute__((at(0x38800000)));
… // Init controller and pheripherals
while(1)
{
if (ui16UpdateData)
{
ui16UpdateData = 0;
tBackupRamDataStruct.ui16Test1 ++;
tBackupRamDataStruct.ui16Test2 ++;
tBackupRamDataStruct.ui16Test3 ++;
tBackupRamDataStruct.ui16Test4 ++;
}
if (ui16ResetRequest)
{
ui16ResetRequest = 0;
__NVIC_SystemReset(); // Execute System Reset
}
}
}If the data are written like in my code example and then a reset is executed everything is OK. But if I comment line „tBackupRamDataStruct.ui16Test3++;“ and execute a system reset the data of ui16Test1 and ui16Test2 are correct but the data of ui16Test4 is not correct. There is the same problem if I comment line „tBackupRamDataStruct.ui16Test3++;“.
If I change the data type of struct elements to 32 Bit everything works fine.
There is no difference between a software system reset and a power on reset.
