On a NRF52832 based beacon I use to sensors, a SHT3 temperature and humidity sensor and a KX022 accelerometer.
I'm using the twi_manager library as it is used in the example.
With the SHT3 everything is fine, the overall power consumption is ok.
As soon as I initialize the KX022 sensor exactly the same way, the power consumption stays at ~3.7 mA and is not going to the expected average of 4 uA and it seems that there is a reason why it is not going to sleep mode. The accel device itself has a standby power consumption of 0.9 uA.
In Keil using the NVIC there are no pending interrupts.
The code segments I use:
static void twi_config()
{
uint32_t err_code;
nrf_drv_twi_config_t const config = {
.scl = ARDUINO_SCL_PIN,
.sda = ARDUINO_SDA_PIN,
.frequency = NRF_DRV_TWI_FREQ_100K,
.interrupt_priority = APP_IRQ_PRIORITY_LOWEST,
.clear_bus_init = false
};
err_code = nrf_twi_mngr_init(&m_nrf_twi_mngr, &config);
APP_ERROR_CHECK(err_code);
}
static void sensor_init()
{
APP_ERROR_CHECK(nrf_twi_mngr_perform(&m_nrf_twi_mngr, NULL, kx022_init_transfers,
KX022_INIT_TRANSFER_COUNT, NULL));
}
with
static uint8_t config_1[2] = {KX022_1020_REG_CNTL1, 0x40 }; // KX022_1020_STANDBY | KX022_1020_HIGH_RESOLUTION
static uint8_t config_2[2] = {KX022_1020_REG_ODCNTL, 0x02 }; // KX022_1020_OUTPUT_RATE_50_HZ
nrf_twi_mngr_transfer_t const kx022_init_transfers[KX022_INIT_TRANSFER_COUNT] =
{
NRF_TWI_MNGR_WRITE(KX022_ADDR, config_1, 2, 0),
NRF_TWI_MNGR_WRITE(KX022_ADDR, config_2, 2, 0)
}
In the current setup, I don't read any values, etc.
The initialization commands are taken from Kionix Getting Started, on page 2, first two steps from 1.
Any ideas on how to proceed or to further debug why it's not going to sleep mode?