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

Can I measure battery level without any external components nrf51

I want to undestand this. I can't see any examples with it. In the example ble_app_proximity I always received 100% level. If it possible, can anybody give a ADC config example for it? Thanks.

Parents
  • Tnanks. But I still have question- how to init ADC in SDK9? As I understand, I should setting in function

    nrf_adc_input_select()
    

    transfer to it

    NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD
    

    is it correct?

    function nrf_adc_input_select()

    __STATIC_INLINE void nrf_adc_input_select(nrf_adc_config_input_t input)
    {
    NRF_ADC->CONFIG =
        ((uint32_t)input << ADC_CONFIG_PSEL_Pos) | (NRF_ADC->CONFIG & ~ADC_CONFIG_PSEL_Msk);
    
    if (input != NRF_ADC_CONFIG_INPUT_DISABLED)
    {
        NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos;
    }
    else
    {
        NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos;
    }
    

    }

  • in my same example on SDK9 I have next code

    /**
    
    • @brief ADC initialization. */ void adc_config(void) { const nrf_adc_config_t nrf_adc_config = NRF_ADC_CONFIG_DEFAULT;

      // Initialize and configure ADC nrf_adc_configure( (nrf_adc_config_t *)&nrf_adc_config); nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_2); nrf_adc_int_enable(ADC_INTENSET_END_Enabled << ADC_INTENSET_END_Pos); NVIC_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_HIGH); NVIC_EnableIRQ(ADC_IRQn); }

    As we see, it is no measure internal batt level by code:

    nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_2);
    
Reply
  • in my same example on SDK9 I have next code

    /**
    
    • @brief ADC initialization. */ void adc_config(void) { const nrf_adc_config_t nrf_adc_config = NRF_ADC_CONFIG_DEFAULT;

      // Initialize and configure ADC nrf_adc_configure( (nrf_adc_config_t *)&nrf_adc_config); nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_2); nrf_adc_int_enable(ADC_INTENSET_END_Enabled << ADC_INTENSET_END_Pos); NVIC_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_HIGH); NVIC_EnableIRQ(ADC_IRQn); }

    As we see, it is no measure internal batt level by code:

    nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_2);
    
Children
No Data
Related