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

"Right way" to oversample+burst multiple SAADC input pins.

Context: nrf52840DK, s140, SDK 17.0.2

Hi,

I need to oversample a few ADC pins with burst enabled at roughly the same time periodically: e.g. oversampling 4 separate inputs, every 10 seconds.

I've been doing my best to follow the advice on this forum to oversample multiple ADC pins. Currently I am trying to initialise one channel at a time to oversample it. Essentially I am initialising channel 0 with a different channel config for each input pin, converting my buffer, then sampling, and then once the oversampled value has been retrieved the channel is uninitialised.

I've found that I am only able to init the channel immediately after init-ing the ADC, and then the call to uninit is successful, but then when I come back to re-init a channel it fails at the NRFX_ASSERT(channel < NRF_SAADC_CHANNEL_COUNT). Or if I don't init the channel immediately after init-ing the ADC (only init it when I want to take my first sample) it never triggers the callback function.

It seems like I am unable to dynamically init & uninit ADC channels so that I can oversample and use the ADC on more than one input. This was mentioned by Kenneth in response this post from 2 years ago as something nordic was looking into fixing.

I'm assuming that this is a solved issue and that I am just doing something wrong, so would it be possible to get a simple example of this working with an explanation of the correct function call order to achieve oversampling on multiple separate inputs?

I'm not trying to do anything too complicated, I just want to oversample (with burst) a couple of different inputs and then use those values to update some BLE characteristic values.

Thank you in advance for any assistance,

Kalina

Parents Reply Children
No Data
Related