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

why proximity example shows always 100 battery

Hello,

I am trying to make battery service in my application so i refer the proximity example in SDK 9 and i flashed into my kit it showing always 100percent in the nordic app what needs to be done inorder t monitor the exact battery voltage interms of percentage in nordiac app ? i am new to this field so any sugeestion will be useful for me

Thank you

Parents
  • Look at the code. It probably says like this:

    static void adc_configure(void)
    {
        ...
        nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_DISABLED);
        ...
    }
    

    Change adc input pin to NRF_ADC_CONFIG_INPUT_0 ~ NRF_ADC_CONFIG_INPUT_7 properly and test again.

  • i did not see any lines like that in the ADC configure function

    /**@brief Function for configuring ADC to do battery level conversion.
     */
    static void adc_configure(void)
    {
        uint32_t err_code;
        nrf_adc_config_t adc_config = NRF_ADC_CONFIG_DEFAULT;
    
        // Configure ADC
        adc_config.reference  = NRF_ADC_CONFIG_REF_VBG;
        adc_config.resolution = NRF_ADC_CONFIG_RES_8BIT;
        adc_config.scaling    = NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD;
        nrf_adc_configure(&adc_config);
    
        // Enable ADC interrupt
        nrf_adc_int_enable(ADC_INTENSET_END_Msk);
        err_code = sd_nvic_ClearPendingIRQ(ADC_IRQn);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_nvic_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_LOW);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_nvic_EnableIRQ(ADC_IRQn);
        APP_ERROR_CHECK(err_code);
    }
    
Reply
  • i did not see any lines like that in the ADC configure function

    /**@brief Function for configuring ADC to do battery level conversion.
     */
    static void adc_configure(void)
    {
        uint32_t err_code;
        nrf_adc_config_t adc_config = NRF_ADC_CONFIG_DEFAULT;
    
        // Configure ADC
        adc_config.reference  = NRF_ADC_CONFIG_REF_VBG;
        adc_config.resolution = NRF_ADC_CONFIG_RES_8BIT;
        adc_config.scaling    = NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD;
        nrf_adc_configure(&adc_config);
    
        // Enable ADC interrupt
        nrf_adc_int_enable(ADC_INTENSET_END_Msk);
        err_code = sd_nvic_ClearPendingIRQ(ADC_IRQn);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_nvic_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_LOW);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_nvic_EnableIRQ(ADC_IRQn);
        APP_ERROR_CHECK(err_code);
    }
    
Children
No Data
Related