Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52832, TWI and low power

Hello. I've got issue with TWI and power down mode. I modificated "ble_app_bps" example, prepared own service and characteristic and I added BME280 sensor. And almost everything works fine. Almost.... After read sensor via TWI (perdiodically, one time on 5 sec), nrf52832 doesn't go to sleep. PCA100040 takes high constant current (about 6mA) + tx peaks (measure by PCA63511). NRF_LOG is disabled. Please help, I can't find my mistake :/

Main loop:

while(1)
{
    if (NRF_LOG_PROCESS() == false)
    {
		power_manage();
    }
		
}

Timer handler:

static void sensor_timeout_handler(void * p_context)
{
	UNUSED_PARAMETER(p_context);

	twi_config();

	t = bme280_read_temp();
	p = bme280_read_pressure();
	h = bme280_read_humidity();

	nrf_drv_twi_disable(&m_twi_master);
	
	nrf_drv_twi_uninit(&m_twi_master);
	
	*(volatile uint32_t *)0x40003FFC = 0;
	*(volatile uint32_t *)0x40003FFC;
	*(volatile uint32_t *)0x40003FFC = 1;

}

Related