Browse Source
Merge pull request #683 from taedryn/t114-power-consumption
Improving T114 power consumption
pull/693/head
ripplebiz
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
44 additions and
0 deletions
-
src/helpers/nrf52/T114Board.cpp
-
src/helpers/nrf52/T114Board.h
|
|
|
@ -26,6 +26,45 @@ void T114Board::begin() { |
|
|
|
|
|
|
|
pinMode(PIN_VBAT_READ, INPUT); |
|
|
|
|
|
|
|
// Enable SoftDevice low-power mode
|
|
|
|
sd_power_mode_set(NRF_POWER_MODE_LOWPWR); |
|
|
|
|
|
|
|
// Enable DC/DC converter for better efficiency (REG1 stage)
|
|
|
|
NRF_POWER->DCDCEN = 1; |
|
|
|
|
|
|
|
// Power down unused communication peripherals
|
|
|
|
// UART1 - Not used on T114
|
|
|
|
NRF_UARTE1->ENABLE = 0; |
|
|
|
|
|
|
|
// SPIM2/SPIS2 - Not used (SPI is on SPIM0)
|
|
|
|
NRF_SPIM2->ENABLE = 0; |
|
|
|
NRF_SPIS2->ENABLE = 0; |
|
|
|
|
|
|
|
// TWI1 (I2C1) - Not used (I2C is on TWI0)
|
|
|
|
NRF_TWIM1->ENABLE = 0; |
|
|
|
NRF_TWIS1->ENABLE = 0; |
|
|
|
|
|
|
|
// PWM modules - Not used for standard T114 functions
|
|
|
|
NRF_PWM1->ENABLE = 0; |
|
|
|
NRF_PWM2->ENABLE = 0; |
|
|
|
NRF_PWM3->ENABLE = 0; |
|
|
|
|
|
|
|
// PDM (Digital Microphone Interface) - Not used
|
|
|
|
NRF_PDM->ENABLE = 0; |
|
|
|
|
|
|
|
// I2S - Not used
|
|
|
|
NRF_I2S->ENABLE = 0; |
|
|
|
|
|
|
|
// QSPI - Not used (no external flash)
|
|
|
|
NRF_QSPI->ENABLE = 0; |
|
|
|
|
|
|
|
// Disable unused analog peripherals
|
|
|
|
// SAADC channels - only keep what's needed for battery monitoring
|
|
|
|
NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements
|
|
|
|
|
|
|
|
// COMP - Comparator not used
|
|
|
|
NRF_COMP->ENABLE = 0; |
|
|
|
|
|
|
|
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL) |
|
|
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL); |
|
|
|
#endif |
|
|
|
|
|
|
|
@ -40,6 +40,9 @@ public: |
|
|
|
|
|
|
|
uint16_t getBattMilliVolts() override { |
|
|
|
int adcvalue = 0; |
|
|
|
|
|
|
|
NRF_SAADC->ENABLE = 1; |
|
|
|
|
|
|
|
analogReadResolution(12); |
|
|
|
analogReference(AR_INTERNAL_3_0); |
|
|
|
pinMode(PIN_BAT_CTL, OUTPUT); // battery adc can be read only ctrl pin 6 set to high
|
|
|
|
@ -49,6 +52,8 @@ public: |
|
|
|
adcvalue = analogRead(PIN_VBAT_READ); |
|
|
|
digitalWrite(6, 0); |
|
|
|
|
|
|
|
NRF_SAADC->ENABLE = 0; |
|
|
|
|
|
|
|
return (uint16_t)((float)adcvalue * MV_LSB * 4.9); |
|
|
|
} |
|
|
|
|
|
|
|
|