Are TWI manager implemented low power features?

aircheese gravatar image

asked 2018-01-12 14:51:35 +0100

updated 2018-01-12 15:00:19 +0100

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

edit retag flag offensive close delete report spam


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.

Jakub Rzeszutko ( 2018-01-12 15:04:59 +0100 )editconvert to answer

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.

aircheese ( 2018-01-12 15:23:03 +0100 )editconvert to answer

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.

Jakub Rzeszutko ( 2018-01-15 07:39:48 +0100 )editconvert to answer