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

NRF52832 ADC sampling mode

my ADC work in this mode :timer+PPI+SAADC   the ADC is 12bit

I init ADC like these code

void saadc_init(void)
{
    ret_code_t err_code;
	
    nrf_saadc_channel_config_t channel0_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);// PIN and Channel config

    err_code = nrf_drv_saadc_init(NULL, saadc_callback);// add callback funtion
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(0, &channel0_config);//init channel
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0],SAMPLES_IN_BUFFER);//set convert buffer
    APP_ERROR_CHECK(err_code);
    
    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1],SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);
}

sample every data 15us,and 16 data per channel

I only init one channel,and use the switch funtion to switch channel.the code like these

void ADC_swc(uint8_t channel)
{
	switch(channel)
	{
		case 0:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN0,NRF_SAADC_INPUT_DISABLED);break;
		case 1:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN1,NRF_SAADC_INPUT_DISABLED);break;
		case 2:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN2,NRF_SAADC_INPUT_DISABLED);break;
		case 3:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN3,NRF_SAADC_INPUT_DISABLED);break;
		case 4:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN4,NRF_SAADC_INPUT_DISABLED);break;
		case 5:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN5,NRF_SAADC_INPUT_DISABLED);break;
		case 6:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN6,NRF_SAADC_INPUT_DISABLED);break;
		case 7:nrf_saadc_channel_input_set(0,NRF_SAADC_INPUT_AIN7,NRF_SAADC_INPUT_DISABLED);break;
		default:;break;
	}
}

I found if I connect VCC to the ADC channel 1,

(1) the channel1 only first 8 data about 3600 but the later 8 data about 700,

(2) the channel2  is the later 8 data about 3600,first 8 data about 700.

question:I am not connect VCC to channel2,why channel2 have 3600

if I connect VCC to the ADC channel2,I also found the same phenomenon between channel 2 and channel 3

Parents Reply Children
Related