Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SAADC UNINIT problem

Hello,

I have been developing a project and have run into an issue that I have been unable to resolve in the past two days. The code I have is in every way similar to other examples I have seen, but still I am not unable to find a solution. I am using SDK15.2 and an nRF52 DK.

Here is my code:

main.c

The objective is to make a reading of one ADC pin every 60s and disable the SAADC between readings.

I have tested different methods:

- As the code stands right now (uninit the SAADC inside the event handler), the SAADC will make the first conversion and will print the same value every time a new sample is requested.

- If I change the uninit to be made on the main loop for example, the event handler will trigger two times at each sample request, and print the correct value the first time and a 0 after that.

Any idea what I am doing wrong?

Related