File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ 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+ // for some reason bellow condition is true even though debugger show 3.0V
115+ // pyocd> rw 0x10001304
116+ // 10001304: fffffffc
117+ // it leads to infinite boot loop. Let wait for NVM to be ready first.
118+ NRF_NVMC -> CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos ;
119+ while (NRF_NVMC -> READY == NVMC_READY_READY_Busy ){}
114120 if ((NRF_UICR -> REGOUT0 & UICR_REGOUT0_VOUT_Msk ) == (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos )){
115121 NRF_NVMC -> CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos ;
116122 while (NRF_NVMC -> READY == NVMC_READY_READY_Busy ){}
@@ -119,8 +125,10 @@ void board_init(void) {
119125
120126 NRF_NVMC -> CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos ;
121127 while (NRF_NVMC -> READY == NVMC_READY_READY_Busy ){}
122-
123- NVIC_SystemReset ();
128+ // to avoid infinity boot loop reset only if REGOUT0 was set correctly
129+ if ((NRF_UICR -> REGOUT0 & UICR_REGOUT0_VOUT_Msk ) == (UICR_REGOUT0_VALUE << UICR_REGOUT0_VOUT_Pos )){
130+ NVIC_SystemReset ();
131+ }
124132 }
125133#endif
126134
You can’t perform that action at this time.
0 commit comments