Skip to content

Commit

Permalink
set REGOUT0 only when value is erased to default
Browse files Browse the repository at this point in the history
this fixes reboot loop when REGOUT0 is explicitly set to different value that cannot be rewritten by clearing bits in flash
  • Loading branch information
fanoush authored Nov 16, 2024
1 parent eefbe6b commit fb557b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/boards/boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) |
Expand Down

0 comments on commit fb557b2

Please sign in to comment.