This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

current increases by about 1.5 mA after a battery check.

Hi all.

Consumption current increases by about 1.5 mA after a battery check.

uint8_t battery_start(void) { // Configure ADC NRF_ADC->INTENSET = ADC_INTENSET_END_Msk; NRF_ADC->CONFIG = (ADC_CONFIG_RES_8bit << ADC_CONFIG_RES_Pos) | (ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling << ADC_CONFIG_INPSEL_Pos) | (ADC_CONFIG_REFSEL_VBG << ADC_CONFIG_REFSEL_Pos) | (ADC_CONFIG_PSEL_Disabled << ADC_CONFIG_PSEL_Pos) | (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos); NRF_ADC->EVENTS_END = 0; NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled;

NRF_ADC->EVENTS_END  = 0;    // Stop any running conversions.
NRF_ADC->TASKS_START = 1;

while (NRF_ADC->EVENTS_END == 0)
{

}
{
    uint8_t     adc_result;
    uint16_t    batt_lvl_in_milli_volts;
    uint32_t    err_code;

    NRF_ADC->EVENTS_END     = 0;
    adc_result              = NRF_ADC->RESULT;
    NRF_ADC->TASKS_STOP     = 1;

    batt_lvl_in_milli_volts = ADC_RESULT_IN_MILLI_VOLTS(adc_result) +
                              DIODE_FWD_VOLT_DROP_MILLIVOLTS;
	NRF_ADC->INTENSET = 0;
	NRF_ADC->INTENCLR   = 0x1;
	NRF_ADC->CONFIG     = 0;
	NRF_ADC->EVENTS_END = 0;
	NRF_ADC->TASKS_START = 0;
	NRF_ADC->ENABLE     = 0;

*this point return battery_level_in_percent(batt_lvl_in_milli_volts); } }

BR, Suzuki.

Parents Reply Children
No Data
Related