From dde9b7cc76ece24c753768c63fcdfa5bdbbd2cb3 Mon Sep 17 00:00:00 2001 From: taco Date: Wed, 3 Dec 2025 14:59:57 +1100 Subject: [PATCH 1/2] remove calls to sd_power_mode_set(NRF_POWER_MODE_LOWPWR); this is the default mode, there is no need to call it unless previously changing it. --- variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp | 2 -- variants/wio_wm1110/WioWM1110Board.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp b/variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp index c41a6bc0..561ed504 100644 --- a/variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp +++ b/variants/minewsemi_me25ls01/MinewsemiME25LS01Board.cpp @@ -11,8 +11,6 @@ void MinewsemiME25LS01Board::begin() { pinMode(PIN_VBAT_READ, INPUT); - sd_power_mode_set(NRF_POWER_MODE_LOWPWR); - #ifdef BUTTON_PIN pinMode(BUTTON_PIN, INPUT); pinMode(LED_PIN, OUTPUT); diff --git a/variants/wio_wm1110/WioWM1110Board.cpp b/variants/wio_wm1110/WioWM1110Board.cpp index ca3638b3..98e0d616 100644 --- a/variants/wio_wm1110/WioWM1110Board.cpp +++ b/variants/wio_wm1110/WioWM1110Board.cpp @@ -23,7 +23,6 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason) { void WioWM1110Board::begin() { startup_reason = BD_STARTUP_NORMAL; - sd_power_mode_set(NRF_POWER_MODE_LOWPWR); NRF_POWER->DCDCEN = 1; pinMode(BATTERY_PIN, INPUT); From e1d3da942be1a4ec98ec37c1a1741084bcf1819c Mon Sep 17 00:00:00 2001 From: taco Date: Wed, 3 Dec 2025 15:58:36 +1100 Subject: [PATCH 2/2] fix DC/DC enable for boards which currently have it. this fixes how the reg1 dc/dc converter is enabled on WisMesh Tag / T1000e / WM1110 and Xiao NRF52 --- variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp | 10 +++++++++- variants/t1000-e/T1000eBoard.cpp | 10 +++++++--- variants/wio_wm1110/WioWM1110Board.cpp | 9 ++++++++- variants/xiao_nrf52/XiaoNrf52Board.cpp | 10 +++++++++- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp b/variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp index 28f6f713..68638f0d 100644 --- a/variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp +++ b/variants/rak_wismesh_tag/RAKWismeshTagBoard.cpp @@ -21,7 +21,15 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason) { void RAKWismeshTagBoard::begin() { // for future use, sub-classes SHOULD call this from their begin() startup_reason = BD_STARTUP_NORMAL; - NRF_POWER->DCDCEN = 1; + + // Enable DC/DC converter for improved power efficiency + uint8_t sd_enabled = 0; + sd_softdevice_is_enabled(&sd_enabled); + if (sd_enabled) { + sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); + } else { + NRF_POWER->DCDCEN = 1; + } pinMode(PIN_VBAT_READ, INPUT); pinMode(PIN_USER_BTN, INPUT_PULLUP); diff --git a/variants/t1000-e/T1000eBoard.cpp b/variants/t1000-e/T1000eBoard.cpp index 4bcdf98a..a41abd92 100644 --- a/variants/t1000-e/T1000eBoard.cpp +++ b/variants/t1000-e/T1000eBoard.cpp @@ -9,10 +9,14 @@ void T1000eBoard::begin() { startup_reason = BD_STARTUP_NORMAL; btn_prev_state = HIGH; - sd_power_mode_set(NRF_POWER_MODE_LOWPWR); - // Enable DC/DC converter for improved power efficiency - NRF_POWER->DCDCEN = 1; + uint8_t sd_enabled = 0; + sd_softdevice_is_enabled(&sd_enabled); + if (sd_enabled) { + sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); + } else { + NRF_POWER->DCDCEN = 1; + } #ifdef BUTTON_PIN pinMode(BATTERY_PIN, INPUT); diff --git a/variants/wio_wm1110/WioWM1110Board.cpp b/variants/wio_wm1110/WioWM1110Board.cpp index 98e0d616..153d476c 100644 --- a/variants/wio_wm1110/WioWM1110Board.cpp +++ b/variants/wio_wm1110/WioWM1110Board.cpp @@ -23,7 +23,14 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason) { void WioWM1110Board::begin() { startup_reason = BD_STARTUP_NORMAL; - NRF_POWER->DCDCEN = 1; + // Enable DC/DC converter for improved power efficiency + uint8_t sd_enabled = 0; + sd_softdevice_is_enabled(&sd_enabled); + if (sd_enabled) { + sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); + } else { + NRF_POWER->DCDCEN = 1; + } pinMode(BATTERY_PIN, INPUT); pinMode(LED_GREEN, OUTPUT); diff --git a/variants/xiao_nrf52/XiaoNrf52Board.cpp b/variants/xiao_nrf52/XiaoNrf52Board.cpp index 396880ab..69218926 100644 --- a/variants/xiao_nrf52/XiaoNrf52Board.cpp +++ b/variants/xiao_nrf52/XiaoNrf52Board.cpp @@ -23,7 +23,15 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason) { void XiaoNrf52Board::begin() { // for future use, sub-classes SHOULD call this from their begin() startup_reason = BD_STARTUP_NORMAL; - NRF_POWER->DCDCEN = 1; + + // Enable DC/DC converter for improved power efficiency + uint8_t sd_enabled = 0; + sd_softdevice_is_enabled(&sd_enabled); + if (sd_enabled) { + sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); + } else { + NRF_POWER->DCDCEN = 1; + } pinMode(PIN_VBAT, INPUT); pinMode(VBAT_ENABLE, OUTPUT);