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

Why there is no easy API for analog input of nRF52 (SAADC)?

I am once again frustrated with nRF5 API's. Getting a value from analog input pin is that simple with Arduino API's:

int sensorValue = analogRead(A0);

That's all you mostly need. But guess how much code you need with Nordic Semiconductor's SAADC API to achieve the same result? The main program of the SAADC example code provided with SDK12.0.0 has 163 lines (comments included).

What's the point, where is the common sense? Of course, SAADC is much more than just a single conversion, but could you please provide also the most simple and most needed APIs!

I am now struggling to get the SAADC to work for just measuring battery voltage, and again, I don't know what goes wrong in all those settings...

Parents
  • Hi Jarmo

    Thanks for your feedback. I agree calling this a "simple" example is a bit misleading. The idea behind the example is good in my opinion; to illustrate how you can use the PPI and a timer to achieve very efficient and reliable ADC sampling, but this is definitely not the easiest way to use the SAADC peripheral.

    I had a crack at making a simpler example, which you can download here: saadc_simpler.zip

    It's still close to a 100 lines, with comments and all, but it should be considerably easier to follow the flow of the program.

    If you are still having issues with your code feel free to attach it here, and I will have a look at it.

    Best regards
    Torbjørn

Reply
  • Hi Jarmo

    Thanks for your feedback. I agree calling this a "simple" example is a bit misleading. The idea behind the example is good in my opinion; to illustrate how you can use the PPI and a timer to achieve very efficient and reliable ADC sampling, but this is definitely not the easiest way to use the SAADC peripheral.

    I had a crack at making a simpler example, which you can download here: saadc_simpler.zip

    It's still close to a 100 lines, with comments and all, but it should be considerably easier to follow the flow of the program.

    If you are still having issues with your code feel free to attach it here, and I will have a look at it.

    Best regards
    Torbjørn

Children
Related