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

Are TWI manager implemented low power features?

My environment is: SDK14.1 + SD132 V5.0 + NRF52832

2 sensors(MPU9250 + LPS22HB) 1 battery gas meter (LTC2942) are mounted on TWI ( +1mA)

SPI to spi flash. (+1mA) and UART for shell. (+1mA)

I used both manager. After putting all the sensors above in low power mode. I got still ~4mA (CPU load = 0%). I use debugging to check the peripherals. TWI are both "ENABLE" constantly. Having a rough check with the source codes, it seems like TWI the is not putting the peripheral in power down mode when the transactions are finished.

Having check with other threads, all suggested using TWI0->ENABLE = 0; to turn the peripheral off.

My questions are:

  1. Is there any APIs (functions) that already provided the low power/power down with TWI manager that I missed?

  2. Is it safe to useTWI0->ENABLE = 0; together with managers? (Like if i modify the manager to disable the peripheral after transaction is finished, and enable it before transaction is started)

Or am I wrong with the concept of these manager or the way i used low power in peripherals

  • Just had a brief look at functions: nrf_spi_mngr_uninit and nrf_twi_mngr_uninit they seem to disable SPI and TWI peripherals respectively.

  • Thanks for you info. I had look at them, for these uninits in managers, yes they do turn off both. My concern is if I need to share the TWI, then I should not uninit the manager in every end of operation like reading data from one sensor. I am running a RTOS with it. Sensors are reading with different updating frequency in different task. That is why i am using managers to share the hardware resources. Am I right on here, I am not very sure.

  • If there are still some transactions waiting in the queue you shall not uninit transaction manager. There are two functions indicating if there is still some data to send: nrf_twi_mngr_is_idle and nrf_spi_mngr_is_idle. If they are returning true you can uninit particular manager, but you need to initialize it again once you want to send new data.

  • Excuse me, but this answer is just not enough.

    Of course the developer can do it himself, but this is why you implemented an SDK and on top of it managers - so the developer will not have to implement stuff like enabling and disabling peripherals, debug it, maintain it and so on. 


  • I do not understand how your comment relates to the content of this question.

    The SDK is provided without any warranty, and you as a developer is always responsible to modify, test, and make sure the SDK examples and components work as expected in your product. We do our best to provide an SDK that work as described, and which include helpful modules that customers can use to avoid rewriting every piece of software in their product.