File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,26 @@ void getMacAddr(uint8_t *dmac)
7474
7575static void initBrownout ()
7676{
77- auto vccthresh = POWER_POFCON_THRESHOLD_V24;
77+ // POF protection prevents flash memory writes when VDD voltage is 2.7V or less to avoid memory corruption
78+ // In this setting voltage is checked both against VDD and VDDH so particular board
79+ // wiring does not matter.
80+ // It must be set to value greater than 2.5V because 2.5V is minimum voltage that can be supplied at VDDH
81+ // and it borders at cutoff voltage for li-ion battery protectors.
82+ // Originally it was set at 2.4V and it did cause a lot of flash memory corruptions when battery was around 2.5-2.6V
83+
84+ // NiceNano!2 board have decent LDO which goes down to 2V
85+ // In the future - boards with crappy LDO can be set to prevent memory corruption at higher voltage - like 3V
86+ // using custom variant definition like #define LDO_3V_CUTOFF but this voltage detection must be done
87+ // using sd_power_pof_thresholdvddh_set function and POWER_POFCON_THRESHOLDVDDH_V30 flag.
88+ // You also need to be sure those boards supply voltage at VDDH (and not VDD and VDDH together) for it to work.
89+
90+
91+ auto vddthresh = POWER_POFCON_THRESHOLD_V27;
7892
7993 auto err_code = sd_power_pof_enable (POWER_POFCON_POF_Enabled);
8094 assert (err_code == NRF_SUCCESS);
8195
82- err_code = sd_power_pof_threshold_set (vccthresh );
96+ err_code = sd_power_pof_threshold_set (vddthresh );
8397 assert (err_code == NRF_SUCCESS);
8498
8599 // We don't bother with setting up brownout if soft device is disabled - because during production we always use softdevice
You can’t perform that action at this time.
0 commit comments