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

how to reduce power after enable twi?

nRF51822

S130

SDK11.0

The power consumption immediately going up high to 1MAH once I enable TWI using this code: 

  NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos;

Our product requires the power consumption under 0.5MAH at working time. Please help me out here.

I used the twi_hw_master.c from SDK / components/drivers_nrf/twi_master/depreated/twi_hw_master.c

Thanks,
 

Parents Reply Children
  • Hi, you need to stop the transaction after the data is sent, you do not need to uninitialize the TWI driver. This simple example shows how to transmit a single byte, and then stop the transaction. The current will be 1mA during the transaction, and drop down to normal idle current afterwards.

    int main(void)
    {
        NRF_TWI0->PSELSCL = 2;
        NRF_TWI0->PSELSDA = 1;
        NRF_TWI0->FREQUENCY = 0x01980000;
        NRF_TWI0->ADDRESS = 0x54;
        NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos;
        NRF_TWI0->TASKS_STARTTX = 1;
        NRF_TWI0->TXD = 0xA1;
        nrf_delay_ms(1000);
        NRF_TWI0->TASKS_STOP =1;
        while (true)
        {
            __WFE();
        }
    }

Related