SAADC: Switching Channels or reading simultaneously

Hi there,

I was following the tutorial here https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-6-analog-to-digital-converter-adc/topic/exercise-3-interfacing-with-adc-using-nrfx-drivers-and-timer-ppi/ and it worked perfectly. 

However, for my use case, I need to measure a signal at channel 0 not often (say once every minute) and another signal continuously with a high frequency at channel 1. E.g. measure VDD at channel 0 and some signal from a sensor on channel 1. 

I am a bit lost, since I didn't find any documentation/thread on dev zone on how to switch between two channels and just calling 'nrfx_saadc_advanced_mode_set again' didn't seem to work. I tried to measure them simultaneously (not my use case, but at least a somewhat dirty solution) by using:
nrfx_saadc_advanced_mode_set(BIT(0) | BIT(1),
NRF_SAADC_RESOLUTION_12BIT,
&saadc_adv_config,
saadc_event_handler);)

but this screwed with the values, when compared to measuring each channel alone.

Is there anywhere more information on how to use this driver? I was unable to find sth on the internet regarding this and https://docs.nordicsemi.com/bundle/ncs-2.6.2/page/nrfx/drivers/saadc/driver.html isn't exactly hinting on any of that.

If not, could you please give me some tips, how I would do that?  

(I used v2.6.2, the vs code extension, and currently a nrf532833 dev kit)

Best regards

Ludwig

  • Hello Ludwig,

    Have you configured channel before setting the advance mode?

    ''However, for my use case, I need to measure a signal at channel 0 not often (say once every minute) and another signal continuously with a high frequency at channel 1. E.g. measure VDD at channel 0 and some signal from a sensor on channel 1. ''

    I have added a previous case link where it is described about implementing different channels sampling at different frequencies. It's not that straight forward though. Two workarounds were mentioned:

    a) Sampling all the channels at the same time at high frequency and then discarding the samples that we don't need for slow channel.

    b) Reconfiguring the SAADC module every time you want to sample the slow channel, and add the slow channel to the list.

    (+) SAADC PPI trigger channels separately - Nordic Q&A - Nordic DevZone - Nordic DevZone

Related