From fb557b2af98ea73d052a11474fd7d12e9ddba9ec Mon Sep 17 00:00:00 2001 From: fanoush Date: Sat, 16 Nov 2024 10:28:42 +0100 Subject: [PATCH] set REGOUT0 only when value is erased to default this fixes reboot loop when REGOUT0 is explicitly set to different value that cannot be rewritten by clearing bits in flash --- src/boards/boards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boards/boards.c b/src/boards/boards.c index ea1f4b32..9eaf7b07 100644 --- a/src/boards/boards.c +++ b/src/boards/boards.c @@ -111,7 +111,7 @@ void board_init(void) { // #define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_3V3 // in board.h when using that power configuration. #ifdef UICR_REGOUT0_VALUE - if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) != (UICR_REGOUT0_VALUE << UICR_REGOUT0_VOUT_Pos)){ + if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) == (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos)){ NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |