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

nRF24LE1 Supply voltage measurement

Hi, i try to understand how to use mode for supply voltage measurement. But i have a problem and i get always 1.225 volt

   hal_adc_set_input_channel(HAL_INP_VDD2_3);
  hal_adc_set_reference(HAL_ADC_REF_INT);
  hal_adc_set_input_mode(HAL_ADC_SINGLE);
  hal_adc_set_conversion_mode(HAL_ADC_SINGLE_STEP);
  hal_adc_set_resolution(HAL_ADC_RES_8BIT);
  hal_adc_set_data_just(HAL_ADC_JUST_RIGHT);
		
		while (1)	
		{	
					hal_adc_start();                                // Start the ADC
    while( hal_adc_busy() )                         // Wait for the ADC to finish a conversion
    {
		}
		adc_mesurment=hal_adc_read_LSB();
		
		answer=adc_mesurment;
		voltage = 312.32 / answer; // Calculate  312.32 = 1.22 * 256 
		sprintf(uarttxbuffer,"voltage is %.3f volt\r\n",voltage);

I connect nrf with 3volt, 3,3volt, 4volt, but always i get 1.225 volt. Thanks...

Related