Skip to content

Commit fb557b2

Browse files
authored
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
1 parent eefbe6b commit fb557b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/boards/boards.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void board_init(void) {
111111
// #define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_3V3
112112
// in board.h when using that power configuration.
113113
#ifdef UICR_REGOUT0_VALUE
114-
if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) != (UICR_REGOUT0_VALUE << UICR_REGOUT0_VOUT_Pos)){
114+
if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) == (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos)){
115115
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
116116
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
117117
NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |

0 commit comments

Comments
 (0)