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

NRF52840 SAADC High Current with FreeRTOS SDK15.2

Hello,

I am need to add voltage sampling functionality to existing FreeRTOS framework on a low-power BLE device. When I enable BLE, I get 3mA of current, which stays there permanently . I have read all sorts of posts and guides for low power SAADC with a multi-channel setup but cannot seem to figure out the culprit... I only need to sample this once every 2-5min so the original approach was to my intent is to enable ADC, sample and disable it completely. However, for some reason I cannot turn it off. My code is attached below, wls_adc_start_sample() is triggered by the main task. It runs like it's supposed to, the interrupt gets triggered and I can read correct values. The only issue is extremely high current, which I am having trouble resolving...

Any insight on what I might be doing wrong is highly apprciated.

Thanks!

Parents
  • Just to understand if this is related to FreeRTOS and/or BLE solely, what happens if you disable BLE and keep the SAADC functionality exercised ? does the power consumption stays high?

    If the answer to the above is yes, then most likely it is something that keeps the chip awake even though your app is (assuming) sleeping  in tickless idle sleep. Possibly some interrupt is being pended and not serviced, you can check that in you read NVIC->ISPR register.

  • Hi Susheel, your advice to check NVIC->ISPR was spot on. I saw that the FPU interrupt was active, this is becasue the data collected from ADC was converted to voltage using floating point math, I didn't connect the issue with that until I check the NVIC register. I used the solution from this thread to fix it. Specifically, I enabled the FPU interrupt handler. I added the following to my initialization code:

    I also added the interrupt that clears FPU exceptions (apparently I'm throwing an exception although when I redo the calculations they are sound ... need to investigate further):

    With this code, I'm getting proper functionality and the current draw is low, as expected. Thanks again!

  • Checked the exact FPU flags and am getting the IXC - Inexact cumulative exception bit. This seems to imply that the result is "inexact" and needs to be rounded. The rounding is what throws the exception. I guessing this is because at some point of the calculation I get a repeating decimal. 

Reply
  • Checked the exact FPU flags and am getting the IXC - Inexact cumulative exception bit. This seems to imply that the result is "inexact" and needs to be rounded. The rounding is what throws the exception. I guessing this is because at some point of the calculation I get a repeating decimal. 

Children
No Data