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

SAADC power on/off

My environment: DK 10040, nRF52832, SD 6.1.1, SDK 15.2, SES 3.52

When does the SAADC use power?  And when does it stop using power?  

I searched the 52832 specification and DevZone but could not find a clear explanation.  My best guess is that power consumption begins when the START task is triggered and it will continue to draw power until the buffer is filled and the END event occurs. Is this correct?  I found a couple posts that suggest you need to issue the STOP command and disable the SAADC but I do not see this happening in the driver even when low power is enabled.

My guess is based on the low power mode in the driver (nrfx_saadc) which seems to follow this sequence:

  1. Configure saadc and channels
  2. Enable saadc
  3. Start a timer
  4. Timer expires and triggers START task
  5. SAADC IRQ receives STARTED event and triggers SAMPLE task
  6. SAADC IRQ receives END event
  7. Data is ready for use
  8. Timer repeats this loop...

Assuming this is correct, I wonder if we can eliminate the CPU interrupt for the STARTED event and instead use the PPI to trigger the SAMPLE task when the STARTED event occurs. This approach would eliminate one CPU interrupt and it would make the timing of the SAMPLE task more deterministic. The new sequence would be:

  1. Configure saadc and channels
  2. Enable saadc
  3. Start a timer
  4. Timer expires
  5. PPI triggers START task
  6. SAADC sends the STARTED event
  7. PPI triggers the SAMPLE task
  8. SAADC sends the END event
  9. IRQ handles the END event
  10. Timer repeats this loop...

I coded this up and it seems to work fine. I plan to measure power as soon as I get the required tools.  Do you see any concerns with this approach? Are there other ways to save power?

Currently I use a timer with frequency 31250Hz.  Would I save a lot of power if I use RTC instead?   Thanks!

  • Hi,

     

    When does the SAADC use power?  And when does it stop using power?  

    The SAADC shall use power only when active. The problem here, is that there's other things active in your system requiring the HFCLK (the TIMER peripheral), thus you get approx. 0.5 mA sleep current.

    Currently I use a timer with frequency 31250Hz.  Would I save a lot of power if I use RTC instead?   Thanks!

     This will cause the sleep current to be high, as the TIMER peripheral will keep the HFCLK running. The problem here is that the RTC can provide an event every 16.384 kHz (half of its input source), so if you require a sampling rate of >32k/2, then you'll have to use a high speed TIMER peripheral.

    Kind regards,

    Håkon

  • Today I have the PPK so I measured power consumption of the SAADC when the TIMER was NOT in use. I confirmed the power consumption begins when the START task is  triggered and it will continue indefinitely until the SAMPLE task or STOP task is triggered.  Note that power consumption does not change when the SAADC is configured, or channels configured, or by enabling the SAADC (i.e. calling nrf_saadc_enable).  This confirms what I suspected so I think I am going in the right direction by using the PPI to trigger the SAMPLE task instead of the interrupt handler.   

    Next I measured power when the device was connected to a BLE central.  When the TIMER was disabled and system was sleeping I measured 0.6ua.  When the TIMER was enabled  I measured about 410ua.  Based on this result it seems I could save significant power (400ua) by using RTC instead of TIMER as long as my sample interval was 16k or less.  This result was surprising because the documentation says the SoftDevice uses the RTC0 and TIMER0.  Therefore I assumed the SoftDevice would always need the HFCLK but clearly this is incorrect.

  • Hi,

     

    mchartier said:
    This result was surprising because the documentation says the SoftDevice uses the RTC0 and TIMER0.  Therefore I assumed the SoftDevice would always need the HFCLK but clearly this is incorrect.

    The SoftDevice will, for power consumption reasons, only start the external HFCLK when its needed. The external HFCLK will then only be on prior to any radio communication, so in most applications, it will mostly be sourced by the HFINT (64M RC oscillator).

    Cheers,

    Håkon

  • After replacing the TIMER with RTC and replacing all CPU interrupts with PPI the average power is down from 1100ua to 750ua. This is sampling a single pin at 200hz while BLE is connected and notifications sending every 20ms.  Very good IMO.  However, when I go to sample two pins I ran into this issue which brings the power consumption back up to 1.4ma.  I hope someone can find a workaround to the other issue, or suggest a better way to design the application to get 32x oversample with two pins. 

Related