Skip to content

Commit

Permalink
Fix against unwanted wakeup by USB VBUS power on/off signal
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Dec 9, 2024
1 parent f27e467 commit fae093c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ static void check_dfu_mode(void) {
bool dfu_start = _ota_dfu || serial_only_dfu || uf2_dfu ||
(((*dbl_reset_mem) == DFU_DBL_RESET_MAGIC) && reason_reset_pin);

if ((NRF_POWER->RESETREAS & POWER_RESETREAS_VBUS_Msk) && dfu_skip) {
NRF_POWER->RESETREAS |= POWER_RESETREAS_VBUS_Msk;
NRF_POWER->SYSTEMOFF = 1;
}

// Clear GPREGRET if it is our values
if (dfu_start || dfu_skip) NRF_POWER->GPREGRET = 0;

Expand Down

0 comments on commit fae093c

Please sign in to comment.