From 22f132c935fd92d694e8cdddde5912f520dccb6f Mon Sep 17 00:00:00 2001 From: cepetr Date: Mon, 13 Jan 2025 19:08:16 +0100 Subject: [PATCH] fix(core): fix suspending to STOP2 mode [no changelog] --- core/embed/sys/powerctl/stm32u5/powerctl_suspend.c | 9 ++++++++- core/site_scons/models/T3W1/trezor_t3w1_revA0.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/embed/sys/powerctl/stm32u5/powerctl_suspend.c b/core/embed/sys/powerctl/stm32u5/powerctl_suspend.c index d3d0cdf40d..72188d94f6 100644 --- a/core/embed/sys/powerctl/stm32u5/powerctl_suspend.c +++ b/core/embed/sys/powerctl/stm32u5/powerctl_suspend.c @@ -95,9 +95,16 @@ void powerctl_suspend(void) { // immediately after exiting STOP2 mode. irq_key_t irq_key = irq_lock(); - // Enter STOP2 mode + // The PWR clock is disabled after system initialization. + // Re-enable it before writing to PWR registers. + __HAL_RCC_PWR_CLK_ENABLE(); + + // Enter STOP2 low-power mode HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI); + // Disable PWR clock after use + __HAL_RCC_PWR_CLK_DISABLE(); + // Recover system clock SystemInit(); diff --git a/core/site_scons/models/T3W1/trezor_t3w1_revA0.py b/core/site_scons/models/T3W1/trezor_t3w1_revA0.py index 92697f412d..b247b6bafe 100644 --- a/core/site_scons/models/T3W1/trezor_t3w1_revA0.py +++ b/core/site_scons/models/T3W1/trezor_t3w1_revA0.py @@ -129,6 +129,7 @@ def configure( ] features_available.append("usb") paths += ["embed/io/usb/inc"] + defines += [("USE_USB", "1")] defines += [ "FRAMEBUFFER",