Hi,
I am developing an application on top of low power node example with nrf sdk for mesh. Idea behind the application is that, after provisioning and model publication state is set, the node should read data from i2c sensor and send the sensor data and go back to idle state. In idle state, soc is consuming only around 70ua. After a single read write and read from i2c, nrf52832 is contantly consuming around 400ua and its not returning back to idle state. I initialize and deinitialize the I2C peripheral before and after reading from I2C sensor.
I am doubting that CPU is not going to idle and something is running in the background. I am attaching my routine for initializing, deinitializing and reading data from sensor for your reference. Can someone please help me resolve this issue?
P.S The sensor only consumes a very little current of around 1ua in idle state. So ruling out the possibility of sensor being the reason for higher current consumption
//Initialization code void twi_init (void) { ret_code_t err_code; NRF_LOG_INFO("Initializing I2C!!!\r"); err_code = nrf_drv_twi_init(&m_twi, &twi_config, twi_handler, NULL); nrf_delay_ms(20); APP_ERROR_CHECK(err_code); NRF_LOG_INFO("Initialized I2C!!!\r"); NRF_LOG_INFO("Enabling I2C!!!\r"); nrf_drv_twi_enable(&m_twi); NRF_LOG_INFO("Enabled I2C!!!\r\n"); } //Deinitialization code void twi_deinit(void) { NRF_LOG_INFO("Disabling I2C!!!\r"); nrf_drv_twi_disable(&m_twi); NRF_LOG_INFO("Disabled I2C!!!\r"); NRF_LOG_INFO("Deinitializing I2C!!!\r"); nrf_drv_twi_uninit(&m_twi); NRF_LOG_INFO("Deinitialized I2C!!!\r\n"); } //Reading data from sensor /* Read 1 byte from the specified address - skip 3 bits dedicated for fractional part of temperature. */ ret_code_t err_code; uint8_t reg[1] = {0xFD}; err_code = nrf_drv_twi_tx(&m_twi, 0x44, reg, sizeof(reg), false); APP_ERROR_CHECK(err_code); while (m_tx_done == false); nrf_delay_ms(10); uint8_t rxData[6] = {0}; err_code = nrf_drv_twi_rx(&m_twi, 0x44, rxData, sizeof(rxData)); APP_ERROR_CHECK(err_code); while(m_rx_done==false); nrf_delay_ms(10);