Rising power consumption after days of operation

We are using a BM833 chip on out PCB. There, we may or may not (config-dependant) interact with a sensor via I2C. We observed (statistically), that using the I2C communication seems to cause a significant rise in power consumtion after some days of permanently running the system that initially draws 5-10uA, after a certain time rises to draw 250-300uA.
Is there a known issue repeatedly using I2C? If yes, how can that be detected and circumvented?
Code to init, called once on start:

/**
 * @brief TWI initialization.
 */
void twim_init (void)
{
    ret_code_t err_code;

    //scl was 7, sda was 5
    const nrfx_twim_config_t twim_config = {
       .scl                = __i2cmscl,
       .sda                = __i2cmsda,
       .frequency          = NRF_TWIM_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH
    };

    err_code = nrfx_twim_init(&m_twi, &twim_config, twim_handler, NULL);
    APP_ERROR_CHECK(err_code);

    nrfx_twim_enable(&m_twi);
    NRF_LOG_INFO("I2C Master inited and enabled.");
}
 

Code to "talk", called for querying registers of the sensor:

// Function to write a DPS registers value
void i2c_reg8_write(uint8_t devIndex, uint8_t regIndex, uint8_t value)
{
    ret_code_t err_code;
    myTrans.retry=5;
    m_xfer_done = false;
    m_sample[0]=regIndex;
    m_sample[1]=value;

    err_code = nrfx_twim_tx(&m_twi, devIndex, m_sample, 2, true);
    while (!m_xfer_done && myTrans.retry--)
    {
          __WFE();
    }
    APP_ERROR_CHECK(err_code);
    return;
}

// Function to read a DPS registers value
uint8_t i2c_reg8_read(uint8_t devIndex, uint8_t regIndex)
{
    ret_code_t err_code;
    myTrans.retry=5;
    m_xfer_done = false;
    m_sample[0]=regIndex;

    err_code = nrfx_twim_tx(&m_twi, devIndex, &regIndex, 1, true);
    while (!m_xfer_done && myTrans.retry--)
    {
          __WFE();
    }
    if (NRF_SUCCESS == err_code)
    {
      myTrans.retry=5;
      m_xfer_done = false;
      err_code = nrfx_twim_rx(&m_twi, devIndex, m_sample, 2);
      while (!m_xfer_done && myTrans.retry--)
      {
          __WFE();
      }
    }
    APP_ERROR_CHECK(err_code);
    return m_sample[0];
}

void i2c_reg16_write(uint8_t devIndex, uint8_t regIndex, uint16_t value)
{
    ret_code_t err_code;
    myTrans.retry=5;
    m_xfer_done = false;
    m_sample[0]=regIndex;
    m_sample[1]=value&0xff;
    m_sample[2]=value>>8;
    
    err_code = nrfx_twim_tx(&m_twi, devIndex, m_sample, 3, true);
    while (!m_xfer_done  && myTrans.retry--)
    {
          __WFE();
    }
    APP_ERROR_CHECK(err_code);
    return;
}

uint16_t i2c_reg16_read(uint8_t devIndex, uint8_t regIndex)
{
    ret_code_t err_code;
    myTrans.retry=5;
    m_xfer_done = false;
    m_sample[0]=regIndex;

    err_code = nrfx_twim_tx(&m_twi, devIndex, &regIndex, 1, true);
    while (!m_xfer_done && myTrans.retry--)
    {
          __WFE();
    }
    if (NRF_SUCCESS == err_code)
    {
      myTrans.retry=5;
      m_xfer_done = false;
      err_code = nrfx_twim_rx(&m_twi, devIndex, m_sample, 2);
      while (!m_xfer_done && myTrans.retry--)
      {
          __WFE();
      }
    }
    APP_ERROR_CHECK(err_code);
    uint16_t res=m_sample[0];
    res=res<<8|m_sample[1];
    return res;
}

Hope to have provided necessary info.

Best regards,

Richard

Related