9 years, 6 months ago.

nrf51822-mkit power usage and I2C

My setup: nRF51822-mKit + an I2C device + BLE API with a standard BLE device application

When commenting this line out:

/ / I2C* i2c = new I2C(I2C_SDA0, I2C_SCL0);

Power consumption between advertising approx 2uA. After removing these slashes, the current consumption between advertising stays at 1mA. Is something within the I2C preventing the nRF51822 from going to sleep? Or is it needed/possible to shut down the i2c before sleep?

Thanks for you inputs, Jonas

seems to work when disabling/enabling the peripheral with the ...->ENABLE = (TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos); when entering/leaving the periodic callback.

posted by Jonas Gartmann 31 Oct 2014

HI Jonas, thanks for sharing. Good to know how much difference it makes to enable/disable peripheral on nordic mcu. So if I2C is enabled, it draws almost 1mA, if disabled 2uA?

posted by Martin Kojtal 31 Oct 2014

Hi Martin, Yes exaclty. I wrote my own I2C API using the hal with additional enable() disable() public memberfunctions. But I'm not sure if it's already solved in the mbed library today.

posted by Jonas Gartmann 26 Jan 2015

Hi Jonas, would you mind sharing your I2C subclass with the enable/disable functions? I've tried implementing it myself but it does not seem to have any effect.

posted by Prashant Vaibhav 04 May 2015

1 Answer

8 years, 5 months ago.

Just thought I would share, I found that even though the nRF8122 lib only appears to use TWI1 for i2c/twi. I had to disable both TWI1 and TWI0 to get power to drop into the uA range.

That is...

if ( bEnable ) { NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos; NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos; } else { NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; }

OK fine... but do I need to reinitialize I2C, after enabling disabling or I can initialize I2C once and enable disable it when ever I require...??

posted by Shirish Jadav 28 Sep 2016