Enable and Disable ADC peripheral of nRF52840 to save power in nRF connect SDK

Is it possible to enable and disable the ADC peripheral of nRF52840 to save power in nRF connect SDK? In our application, we use ADC to get battery voltage samples after every 1 hour. I was thinking if it would be useful to enable and disable ADC peripherals during inactive use to save power. If Yes, how to do it in nRF connect SDK? I am not able to find any API. 

  • Hi,

    Are you using the Zephyr ADC APIs, or are you using the NRFX SAADC driver API? The Zephyr API does not have any functions to uninit the SAADC, but the NRFX driver does have a uninit function. Are you experiencing high current consumption? Optimally, the Zephyr driver should not have high current consumption between sampling, but this depends a bit on your configuration.

    Best regards,
    Jørgen

  • I am using Zephyr ADC APIs. Does that means the Zephyr driver does that automatically? Like ADC does not draw any power when we are not sampling any data? 

  • As far as I can see in the driver implementation, the Zephyr API will only sample the enabled channels once when the read function is called, which will make the SAADC peripheral go into the IDLE state once the sampling is completed. While in the IDLE state, the SAADC peripheral should consume relatively low current (few uA range). If you want to use more advanced features, the nrfx API can be used.

  • Hi  ,

    Thanks for sharing this info.

    Now I have below conclusion and I want you to review it.

    1. To have the full control of the hardware like sleep mode in peripherials and easyDMA, etc, we should use nrfx drivers.

    2. If the answer for 1. is yes, Zephyr RTOS APIs useful for resource controls like thread, semaphores, etc.

    3. Does Nordic have any plan to implment NRFX specific APIs for Zephyr underlayer implementation in the case of Zephyr RTOS decided to introduced lower power sleep mode apis for each peripherals.

    Thanks

  • Robotics Gun said:
    1. To have the full control of the hardware like sleep mode in peripherials and easyDMA, etc, we should use nrfx drivers.

    Yes, nrfx will give you full control of the peripheral, and might be required for some use cases (high sample rate/hard requirements on sample interval). The Zephyr ADC driver should be implemented in a way to reduce power usage when the peripheral is not in use. I would recommend you to have a look at the ADC lesson in nRF Connect SDK Intermediate course on DevAcademy to learn more about this.

    Robotics Gun said:
    2. If the answer for 1. is yes, Zephyr RTOS APIs useful for resource controls like thread, semaphores, etc.

    Yes, you can still use the RTOS functions from Zephyr and use nrfx drivers for controlling the peripherals.

    Robotics Gun said:
    3. Does Nordic have any plan to implment NRFX specific APIs for Zephyr underlayer implementation in the case of Zephyr RTOS decided to introduced lower power sleep mode apis for each peripherals.

    Not sure I understand exactly what you are asking here. Zephyr already implements a Device Power Management module, which can be used to control the power state of peripherals. Most of the Zephyr drivers implements support for device power management. If you chose to use the nrfx drivers, you will lose this support and needs to handle power management for the peripheral(s) yourself.

Related