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

ADC init problem

I have a question about ADC configuration。 If an ADC input is multiplexed in different ADC channels ,  is the ADC data still dependable?

for example, the init code is as below:

void user_saadc_init(void)
{
ret_code_t err_code;
nrf_saadc_channel_config_t channel_config0 =NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);
nrf_saadc_channel_config_t channel_config1 =NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(NRF_SAADC_INPUT_AIN0,NRF_SAADC_INPUT_AIN1);
channel_config1.gain=NRF_SAADC_GAIN1_6;
nrf_saadc_channel_config_t channel_config2 =NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(NRF_SAADC_INPUT_AIN0,NRF_SAADC_INPUT_AIN1);
channel_config2.gain=NRF_SAADC_GAIN1_3;
err_code = nrf_drv_saadc_init(NULL, saadc_callback);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_saadc_channel_init(0, &channel_config0);
err_code = nrf_drv_saadc_channel_init(1, &channel_config1);
err_code = nrf_drv_saadc_channel_init(2, &channel_config2);
APP_ERROR_CHECK(err_code);

}

NRF_SAADC_INPUT_AIN0  is multiplexed。The only  difference between channel_config1 and channel_config2 is gain. In this case , does every channel work well?

Parents Reply Children
Related