DA14531 Trim value issue when waking up from hibernation with no ram retained

ID: LPCBARESDK-682

Status: Fixed

First reported: 6.0.14.1114

Fixed in: 6.0.16.1143

Description

Applicable to DA14531, when booting from Flash or OTP after hibernation with no RAM retained.

The trim values are not correctly copied from OTP into the BANDGAP_REG, CLK_RC32M_REG, CLK_RC32K_REG and the DEBUGGER_ENABLE field of the SYS_CTRL_REG. This can lead to unpredictable outcome as the device copy garbage from the RAM during the boot.

Workaround

The described behavior can be fixed in the SystemInit() function by modifying the condition which decides whether or not to apply the stored trim values.

SystemInit() in system_DA14531.c l.78 should change from:

if ((GetBits16(HIBERN_CTRL_REG, HIBERNATION_ENABLE) == 1) &&
    (GetBits16(SYS_CTRL_REG, REMAP_ADR0) > 1))

to:

if ((GetBits16(HIBERN_CTRL_REG, HIBERNATION_ENABLE) == 1) && (GetWord16(RESET_STAT_REG) == 0))

Testing the presence of the RESET_STAT_REG will make sure that the value are not re-applied from the system RAM if the booter did not first copied them from the OTP first.