1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-08 09:58:46 +00:00

fix(core): let LDO selection to sattle before BREN bit is being set [no changelog]

This commit is contained in:
kopecdav 2025-04-30 13:12:27 +02:00 committed by kopecdav
parent c9984fabb2
commit ab8aeaa102

View File

@ -99,12 +99,17 @@ bool powerctl_hibernate(void) {
return false; return false;
} }
// TEMPORARY FIX: // TEMPORARY FIX:
// Enable Backup domain retentaion in VBAT mode before entering the // Enable Backup domain retentaion in VBAT mode before entering the
// hiberbation. BREN bit can be accessed only in LDO mode. // hiberbation. BREN bit can be accessed only in LDO mode.
__HAL_RCC_PWR_CLK_ENABLE(); __HAL_RCC_PWR_CLK_ENABLE();
PWR->CR3 &= ~PWR_CR3_REGSEL; // Select LDO mode
// Switch to LDO regulator
CLEAR_BIT(PWR->CR3, PWR_CR3_REGSEL);
// Wait until system switch on new regulator
while (HAL_IS_BIT_SET(PWR->SVMSR, PWR_SVMSR_REGS))
;
// Enable backup domain retention
PWR->BDCR1 |= PWR_BDCR1_BREN; PWR->BDCR1 |= PWR_BDCR1_BREN;
if (!npm1300_enter_shipmode()) { if (!npm1300_enter_shipmode()) {