diff --git a/core/embed/sys/tamper/inc/sys/tamper.h b/core/embed/sys/tamper/inc/sys/tamper.h index 118aed2847d..ac40e046f22 100644 --- a/core/embed/sys/tamper/inc/sys/tamper.h +++ b/core/embed/sys/tamper/inc/sys/tamper.h @@ -27,7 +27,7 @@ // as well as external tamper input if it's available on the device // Initializes the tamper detection -void tamper_init(void); +bool tamper_init(void); // Get status of external tamper inputs uint8_t tamper_external_read(void); diff --git a/core/embed/sys/tamper/stm32u5/tamper.c b/core/embed/sys/tamper/stm32u5/tamper.c index bca2954dd8f..43dd6abac9e 100644 --- a/core/embed/sys/tamper/stm32u5/tamper.c +++ b/core/embed/sys/tamper/stm32u5/tamper.c @@ -96,13 +96,17 @@ HAL_StatusTypeDef clk_init(uint32_t source) { return HAL_OK; } -void tamper_init(void) { +bool tamper_init(void) { #ifdef USE_LSE - clk_init(RCC_RTCCLKSOURCE_LSE); + HAL_StatusTypeDef res = clk_init(RCC_RTCCLKSOURCE_LSE); #else - clk_init(RCC_RTCCLKSOURCE_LSI); + HAL_StatusTypeDef res = clk_init(RCC_RTCCLKSOURCE_LSI); #endif + if (res != HAL_OK) { + return false; + } + // Enable RTC peripheral (tampers are part of it) __HAL_RCC_RTC_ENABLE(); __HAL_RCC_RTCAPB_CLK_ENABLE(); @@ -163,6 +167,8 @@ void tamper_init(void) { // Enable TAMP interrupt at NVIC controller NVIC_SetPriority(TAMP_IRQn, IRQ_PRI_HIGHEST); NVIC_EnableIRQ(TAMP_IRQn); + + return true; } uint8_t tamper_external_read(void) {