nRF52840 DFU Reset Reason Detection Issue

Problem:

  • Reset reason logic works correctly when programming via SWD
  • After DFU programming, reset reasons are detected incorrectly
  • Even after unplugging/reconnecting the battery post-DFU, the logic fails
  • DFU resets are being misclassified as "button press" instead of "system reset"

void analyze_wakeup_reason(void) {
  int32_t reset_reason = NRF_POWER->RESETREAS;
  NRF_POWER->RESETREAS = NRF_POWER->RESETREAS;
  
  if (reset_reason == 0x00040000 || reset_reason == 0x00000000) {
    // Full reset (battery change)
    wakeUpCheck = true;
    batresetResion = true;
  } else {
    // Button press wakeup - BUT DFU resets incorrectly end up here!
  }
}

What I've observed:

  • SWD programming: Reset reasons detected correctly
  • DFU programming: All resets (including post-DFU soft resets) are misclassified as button presses
  • The issue persists even after power cycling the device

Question:

  1. Does DFU leave different register states than SWD programming?

Thank you

Parents Reply Children
No Data
Related