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

The current is over 5.7mA on nRF52832 for running I2C

Hello, I use EV-board PCA10040 and run I2C demo on path nRF5_SDK_11.0.0_89a8197\examples\peripheral\twi_sensor\pca10040. I measured the current over 5.7mA .if modifing the demo and transfering data one time only. after transfer finished , the current change to 0.04mA from 5.7mA. the I2C driver seem have some issue for transfering data continuly. even through I try to modify the transfering data interval to 1000ms from 100ms. The current still keep over 5.7mA. But the doc nRF52832_PS_v1.0 specify the current is about 50uA when runing I2C. how to reduce the current for runing i2c? Thanks.

  • The example is not power optimized. If we take a look at the while loop in main:

    while(true)
    {
        nrf_delay_ms(100);
        /* Start transaction with a slave with the specified address. */
        do
        {
            __WFE();
        }while(m_xfer_done == false);
        err_code = nrf_drv_twi_tx(&m_twi_mma_7660, MMA7660_ADDR, &reg, sizeof(reg), true);
        APP_ERROR_CHECK(err_code);
        m_xfer_done = false;
    }
    

    We see that the CPU is not sleeping unless the transfer is not done within the delay of 100ms. During the delay (nrf_delay_ms(..)) the CPU will be running and the current draw will be over 5.7mA.

    You can change the code to use for example app_timer to do TWI transactions regulary instead of using delay. This way the CPU can sleep between transactions. See here for app_timer tutorial.

Related