Hello, I use an I2C device to wake up a nrf52 microcontroler. If I just use the init function
static ret_code_t twi_master_init(void)
{
ret_code_t ret;
const nrf_drv_twi_config_t config =
{
.scl = 6,
.sda = 5,
.frequency = NRF_TWI_FREQ_400K,
.interrupt_priority = APP_IRQ_PRIORITY_LOW
};
do
{
ret = nrf_drv_twi_init(&m_twi_master, &config, NULL);
if(NRF_SUCCESS != ret)
{
break;
}
nrf_drv_twi_enable(&m_twi_master);
}while(0);
return ret;
}
and then
int main(void)
{
softdevice_init();
scheduler_init();
twi_master_init();
sd_power_system_off();
}
the system has a 0.1mA (or less, but that's not the point today) sleep current.
But if I add a line (to disable the TWI peripheral, and it's the same when I programm a data transfer)
int main(void)
{
softdevice_init();
scheduler_init();
twi_master_init();
nrf_drv_twi_uninit(&m_twi_master);
sd_power_system_off();
}
the system current is 0.6mA. I've checked the SCL and SDA lines for pull ups issues, but there are at a high level (there are 10k pull ups outsde the nrf52), so that I don't think it's the case. I've added
NRF_TWI0->ENABLE=TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;
To force the peripheral off, but nothing better happens. Iv'e set the Pins SDA and SCL as input, outputs or float, but nothing more happens too. I've added those lines too :
nrf_twi_task_set(m_twi_master.p_reg,NRF_TWI_TASKS_STOP);
while(!nrf_twi_event_check(m_twi_master.p_reg,NRF_TWI_EVENTS_STOPPED ));
But again, nothing. There must be something I've missed, but I don't know what...