Hi,
We are using following HW and peripherals:
- nRF52840
- I2C
- ADC
- RTC1
- RTC2
- PWM
- GPIO
- SWI.
We are using following 3rd party libraries:
- nRF5 SDK v17.1.0
- FreeRTOS tickless idle provided by SDK with FPU errata fix
All our drivers (for example ADC, I2C) are make use of nRF5 SDK interface.
Our project is split into 3 tasks. Every 1 second MCU wakes up, communicates over I2C, does some other stuff, and performes measurements via ADC then goes back to sleep.
We are using ADC in interrupt mode, burst mode disabled, 4 channels scan mode at 14bit resolution and starting ADC conversion 7 additional times from ADC EOC interrupt.. First time ADC conversion is triggered is from within RTC2 interrupt.
RTC1 is used for RTOS.
RTC2 is running continuously with 1 second period and 3 other compare events activated. Compare registers are being updated in real-time. They are connected via PPI where one compare is used to trigger GPIOE set task, another to trigger ADC conversion start task and the 3rd to trigger GPIOE clear task.
Some of the tasks are notified/triggered from SWI interrupt. Which in itself is triggered from RTC2 interrupt.
ADC and RTC2 interrupts have priority 2.
SoftDevice and FreeRTOS kernel related interrupts are assigned priority 3.
All other application interrupts (including SWI, I2C, GPIOE,...) are assigned priority 6 or 7.
Issue:
What we have noticed is that occasionally (aperiodic) there is a static ~400uA current draw between two ADC conversion triggers (1 second apart). Sometimes this current draw lasts for 2, 3 or even 4 ADC conversion triggers (4 seconds). However it is always initiated at the time ADC measurement is started and it disappears when next ADC measurement is started again.
We werent able to find a configuration/setup to consistently reproduce this issue.
What is most worrisome is that by seemingly random modifications to the code this issue is sometimes less noticeable and sometimes more. It seems that issue emerges when certain timing contraints are violated possibly related to IRQs.
This 400uA current draw is suspiciously similar to errata [241].
We are preety sure that this issue is related to ADC because we have found a fix and it involves modifying ADC behavior.
Fix:
Instead of using interrupt driven ```nrfx_saadc_sample()``` ADC sampling we use a blocking sampling function ```nrf_drv_saadc_sample_convert()```. ADC conversion is then started from RTC2 interrupt and blocked until finished.
This post is not meant so much as a request for help. I am aware that this post probably does not contain enough information for your engineers to reproduce/hunt down the issue. This is meant more as a help to other engineers that may have encountered the same issue and hopefully reduce their efforts in solving this.
This issue cost me 10 days.