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

TIMER_TASKS_START increases power consumption when TWI is in use from 13uA to 450uA

Hi, i would like to implement a very low power counter and used the template from this post. I've modified the example and used TIMER2 in counter mode triggered by LPCOMP through PPI. This worked fine and results in 13uA for any number of counts. After this i've implemented a TWI sensor and the power consumption increases to 450uA, even when no sensor is connected to the DK.

I'm using a NRF52 DK and the Power Profiler Kit to measure the consumption. It makes no difference if i use TWI0 or TWI1. I've tested also in SPI Master mode on SPI1 without TWI1. It has the same effect. Changing from SPI1 to SPI2 solved the Problem with SPI. Unfortunatly i need to use SPI and TWI.

attached you will find the code for nRF5 SDK 11.0.0. timer_counter_mode_low_power_new.zip

In main() you may either comment out the line NRF_TIMER2->TASKS_START = 1; and keep the line I2CScanDEvices(); or vice versa to have a low consumption.

When you keep both lines active it results in the high consumption. Where does it come from? Do i need to start the timer in counter mode?

  • Hi,

    This is most likely due to erratum 89:

    ###Symptoms Static current consumption between 400 µA to 450 µA when using TWI in combination with GPIOTE.

    ###Conditions GPIOTE is configured in event mode TWI utilizes EasyDMA ###Consequences Current consumption higher than specified

    What the documentation doesn't mention is that the erratum affects both TWI instances (TWI0 and TWI1) and the SPI instances with shared resources (SPI0 and SPI1). Furthermore it doesn't mention that timers might possibly also cause the anomaly, not just the GPIOTE. The reason the documentation isn't more specific is that we haven't had the time yet to investigate and document which peripherals are affected.

    Unfortunately the workaround has not yet been implemented in the TWI driver or library. Since the library doesn't un-initialize the TWI after each transaction I think it is easiest to abandon the library and use the drivers directly. Then you can implement the workaround in nrf_drv_twi_init() and uninit() and make sure to initialize the TWI when not in use.

    This erratum is also found in the nRF52840 Engineering A, but not in nRF52810.

  • Hi Martin, thanks for the details on erratum 89. I've checked with the driver directly and called nrf_drv_twi_init() before each twi transfer and nrf_drv_twi_uninit() after each transfer. Unfortunatly power consumption stays the same. When i don't start the timer, the power consumption is very low and the counter is also working. Is the TASKS_START only required in Timer mode? Is there any disadvantage in not starting the timer in counter mode.

    1. You must start the timer with TASKS_START also in counter mode.
    2. Did you also modify the TWI drivers with the workaround suggested in the errata?
    3. Can you upload your modified code?
  • Hi,

    1. the counter even counts the signals when not started. it would save mi 8uA when not using TASK_START with the same effect in getting the counting value.
    2. Now i've added the errata and it works fine.
    3. would you like to have the code as zip or just as comment on how to implement this low power counter. The zip file i've added in my question contains the code without the errata, which is pretty simple to implement.

    thanks for the fast response and the professional support.

  • If you made it work with the workaround I suppose the case is solved? And hence no need to upload the code.

Related