From e98c1f697d6eea8d4b07e0a68dce8ae261b49cfe Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 4 Dec 2023 15:30:13 +0000 Subject: [PATCH] Add ESPR_DCDC_HV_ENABLE for better control of nRF52840 vreg --- README_BuildProcess.md | 4 +++- targets/nrf5x/bluetooth.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README_BuildProcess.md b/README_BuildProcess.md index 1cfcc7b217..323c151a18 100644 --- a/README_BuildProcess.md +++ b/README_BuildProcess.md @@ -130,7 +130,9 @@ This is a partial list of definitions that can be added in a `BOARD.py` file's ` * `USE_TAB_COMPLETE=0` - Don't include tab completion (default is yes unless SAVE_ON_FLASH is defined) * `USE_DEBUGGER=0` - Don't include the debugger (default is yes unless SAVE_ON_FLASH is defined) * `USE_NETWORK_JS=0` - Don't include JS networking lib used for handling AT commands (default is yes if networking is enabled) -* `ESPR_DCDC_ENABLE` - On NRF52 use the built-in DCDC converter (requires external hardware) +* `ESPR_DCDC_ENABLE=1` - On NRF52 use the built-in DCDC converter (requires external hardware) +* `ESPR_DCDC_HV_ENABLE=1` - On NRF52840 use the built-in high-voltage (REG0) DCDC converter (requires external hardware) +* `ESPR_REGOUT0_1_8V=1` - On NRF52830/40 set the REG0 VCC voltage to 1.8v (the default is 3.3v) * `ESPR_LSE_ENABLE` - On NRF52 use an external 32kHz Low Speed External crystal on D0/D1 * `ESPR_NO_LOADING_SCREEN` - Bangle.js, don't show a 'loading' screen when loading a new app * `ESPR_BOOTLOADER_SPIFLASH` - Allow bootloader to flash direct from a file in SPI flash storage diff --git a/targets/nrf5x/bluetooth.c b/targets/nrf5x/bluetooth.c index c6133c5c9a..9f50ba5f5f 100644 --- a/targets/nrf5x/bluetooth.c +++ b/targets/nrf5x/bluetooth.c @@ -2619,6 +2619,10 @@ static void ble_stack_init() { err_code = sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); APP_ERROR_CHECK(err_code); #endif +#if defined(ESPR_DCDC_HV_ENABLE) + err_code = sd_power_dcdc0_mode_set(NRF_POWER_DCDC_ENABLE); + APP_ERROR_CHECK(err_code); +#endif #ifdef DEBUG // disable watchdog timer in debug mode, so we can use GDB NRF_WDT->CONFIG &= ~8;