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

SAADC Configuration

Hi All,

I am developing one project and there we are using ADC (i.e., SAADC in nRF). I have designed the hardware where I am using Capacitor ( C14, 2.2µF) which is connected to Analog pin and my requirement is I have to read the voltage level.

Here I am attaching details and image,

The voltage level of the input capacitor C14, 2.2µF / 400V to the Step-Down controller must be monitored. A voltage divider is used across the capacitor from R2, 3M3, and R3, 24k. The tapped voltage is measured at pin port P0.04 / AIN2 of the nRF52840. The expected voltage at the input of the controller is between 2.35V and 0V. The voltage at the capacitor must not fall below the value of 100V.

This is my requirement can anyone help how to configure SAADC with respect to my requirement.

Thanks in advance

Rohit R

  • Hello Rohit R,

    Rohit Rajapure said:
    - I do not want to use timer or PPI channels, I need just a normal operation of SAADC operation.

    Understood. All I can do here is to emphasize my recommendation of the timer + PPI combination, due to all the aforementioned advantages of this approach - but at the same time I do not know all the requirements and constraints of your project, so you may very well ignore this unsolicited recommendation, of course.

    Rohit Rajapure said:
    My requirement for SAADC previously was read single sample so I have configured and in attached code I am able to get that. But in my final project, requirement case is increased, means in 1 case I need single sample and in 2 case I need multiple samples (as in my first statement). So I want keeping same configuration how I can achieve my both requirement (case 1 and case 2).

    To avoid any confusion for future forum-goers readings this thread; I can not recommend the following approach for periodic sampling, but the following is how you may go about using inserted delay in combination with nrfx_saadc_sample_convert to achieve the functionality described above:

    Change the contents of your main while-loop to be a for-loop that calls nrfx_saadc_sample_convert for the required number of samples ( either 1 or multiple ), then delay the next execution of the for-loop by around 6 ms.

    Please keep in mind that delay is not an accurate timing mechanism - the delay function will just calculate the rough number of NOP cycles it will take to delay the given time, and queue them for execution. If the execution of these NOP cycles are in any way interrupted - such as by the SoftDevice - then the delay will be extended by the total time of the interruption.
    The approach above could also quickly be made less power consuming by the addition of a timer and nrf_pwr_mngmt_run.

    Please try the above, and let me know if it achieves the functionality you seek to implement.

    Best regards,
    Karl

  • Hi Karl,

    Thanks for the response,

    I will check and get back to you.

    Thanks and Regards

    Rohit R

  • Rohit Rajapure said:
    Thanks for the response,

    No problem at all, Rohit!

    Rohit Rajapure said:
    I will check and get back to you.

    Great, I look forward to hearing if this fulfills your applications requirements!

    Best regards,
    Karl 

Related