I2C Communication Failure During RTC Interrupt Handling on nRF5340


In our custom board, nrf5340-nrf7002 ,using external RTC ECS-RTC-SOP8-5101A RTC module, which is connected via the I2C bus.

We have configured the RTC's /INT pin (P1.01) to trigger an interrupt on the nRF5340 when an alarm event occurs. While the interrupt is successfully triggered and acknowledged by our GPIO callback, we encounter the following issues during the interrupt handling process:

  1. I2C Read/Write Failures:

    • When attempting to clear the alarm flag in the RTC's status register (address 0x1E) during the interrupt callback, the I2C communication fails, leading to the following error messages:
    • Due to the failure in clearing the interrupt flag, the RTC interrupt continues to trigger repeatedly, causing the system to become unstable.

Failed to set register 0x1E for reading
Failed to read STATUS register
Failed to write register 0x1E

We attempted to move the I2C communication out of the interrupt context using a work queue/ semaphore, but the issue persisted.

Could you please provide guidance or suggestions on how to resolve the following:

  • Ensuring reliable I2C communication during interrupt handling.
  • Correctly clearing the interrupt flag on the RTC to prevent continuous triggering.
  • Any known issues or recommended practices specific to using the nRF5340 with external RTCs like the ECS-RTC-SOP8-5101A.
  • We using 4,7k ohm resister in HW side.

we going to use this RTC alarm interrupt to wakeup our device from SYSTEMOFF. Please provide ur suggestion for this development.

Here I share the zip file of my project. 

 7853.Ext_RTC.zip

  • Hi Lavanya,

    Could you tell which error you receive when you got this "Failed to read STATUS register"  please print the value of rtc_read_register()

    Please be aware that if the chip is wake up from SYSTEMOFF, it will reset and booting up. You may want to design your application to handle this. Meaning that the chip is waking up from the RTC it will boot up. So the first thing you want to do with the RTC is to read the status and clear the flag. 

    Please use a logic analyzer to monitor the I2C lines to see if there is any issue there. 

Related