This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I2C communicate cause reset

Hi,

I'm working on a nRF52832 project with adc and ble function involved. An external RTC is also included, communicating with MCU via I2C. Everything goes well until I tried to turn off the INT signal before putting system into sleep mode. System seems crashed and reset while writting in INT ENABLE register of RTC.

However, the same code works properly in another project which involves adc, ble, spi as well as the RTC(I2C).

Uninit function shown as follows:

static void int_unset()
{
uint8_t buf;
//clear UIE bit
read_register(Control2, &buf, 1);
buf &= ~bit5;
write_register(Control2, buf);
}

//this funtion is put inside "sleep_mode_enter()"  function

void rtc_uninit()
{
int_unset();  //<---if I comment this line, it works
while(nrf_drv_twi_is_busy(&m_twi));
nrf_drv_twi_uninit(&m_twi);
nrf_drv_gpiote_in_uninit(CLK_IN);
nrf_drv_gpiote_in_uninit(INT_IN);
nrf_drv_gpiote_in_uninit(RESET_IN);
}

Please let me know if lack of any information. Appreciate your help.

Thanks

Related