Skip to content

Commit 4785240

Browse files
authored
Merge pull request #683 from taedryn/t114-power-consumption
Improving T114 power consumption
2 parents 4d6e33b + 19978d6 commit 4785240

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/helpers/nrf52/T114Board.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,45 @@ void T114Board::begin() {
2626

2727
pinMode(PIN_VBAT_READ, INPUT);
2828

29+
// Enable SoftDevice low-power mode
30+
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
31+
32+
// Enable DC/DC converter for better efficiency (REG1 stage)
33+
NRF_POWER->DCDCEN = 1;
34+
35+
// Power down unused communication peripherals
36+
// UART1 - Not used on T114
37+
NRF_UARTE1->ENABLE = 0;
38+
39+
// SPIM2/SPIS2 - Not used (SPI is on SPIM0)
40+
NRF_SPIM2->ENABLE = 0;
41+
NRF_SPIS2->ENABLE = 0;
42+
43+
// TWI1 (I2C1) - Not used (I2C is on TWI0)
44+
NRF_TWIM1->ENABLE = 0;
45+
NRF_TWIS1->ENABLE = 0;
46+
47+
// PWM modules - Not used for standard T114 functions
48+
NRF_PWM1->ENABLE = 0;
49+
NRF_PWM2->ENABLE = 0;
50+
NRF_PWM3->ENABLE = 0;
51+
52+
// PDM (Digital Microphone Interface) - Not used
53+
NRF_PDM->ENABLE = 0;
54+
55+
// I2S - Not used
56+
NRF_I2S->ENABLE = 0;
57+
58+
// QSPI - Not used (no external flash)
59+
NRF_QSPI->ENABLE = 0;
60+
61+
// Disable unused analog peripherals
62+
// SAADC channels - only keep what's needed for battery monitoring
63+
NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements
64+
65+
// COMP - Comparator not used
66+
NRF_COMP->ENABLE = 0;
67+
2968
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
3069
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
3170
#endif

src/helpers/nrf52/T114Board.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class T114Board : public mesh::MainBoard {
4040

4141
uint16_t getBattMilliVolts() override {
4242
int adcvalue = 0;
43+
44+
NRF_SAADC->ENABLE = 1;
45+
4346
analogReadResolution(12);
4447
analogReference(AR_INTERNAL_3_0);
4548
pinMode(PIN_BAT_CTL, OUTPUT); // battery adc can be read only ctrl pin 6 set to high
@@ -49,6 +52,8 @@ class T114Board : public mesh::MainBoard {
4952
adcvalue = analogRead(PIN_VBAT_READ);
5053
digitalWrite(6, 0);
5154

55+
NRF_SAADC->ENABLE = 0;
56+
5257
return (uint16_t)((float)adcvalue * MV_LSB * 4.9);
5358
}
5459

0 commit comments

Comments
 (0)