hi,everyone。I want to ask how nrf52832 collection two consecutive road of ADC, I tried a lot of kinds of methods ,i use saadc project。thanks。
hi,everyone。I want to ask how nrf52832 collection two consecutive road of ADC, I tried a lot of kinds of methods ,i use saadc project。thanks。
Hi,
You can easily add a second channel to the SAADC example in the SDK. To add analog input to SAADC channel 1, add the following lines in saadc_init()
:
nrf_saadc_channel_config_t channel_config =
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN1);
err_code = nrf_drv_saadc_channel_init(1, &channel_config);
APP_ERROR_CHECK(err_code);
You should also make sure that SAMPLES_IN_BUFFER
is set to a multiple of the number of active channels.
The SAADC will be in scan mode when more than one channel is enabled. The samples will be placed in the buffer in this order: [channel 0, channel 1, channel 0, channel 1, ..].
Best regards,
Jørgen
Hi,
You can easily add a second channel to the SAADC example in the SDK. To add analog input to SAADC channel 1, add the following lines in saadc_init()
:
nrf_saadc_channel_config_t channel_config =
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN1);
err_code = nrf_drv_saadc_channel_init(1, &channel_config);
APP_ERROR_CHECK(err_code);
You should also make sure that SAMPLES_IN_BUFFER
is set to a multiple of the number of active channels.
The SAADC will be in scan mode when more than one channel is enabled. The samples will be placed in the buffer in this order: [channel 0, channel 1, channel 0, channel 1, ..].
Best regards,
Jørgen
ok,thank you very much.i will have a try.