Skip to main content
Hp.14
Associate II
October 19, 2020
Question

Detect I2C device has stopped working

  • October 19, 2020
  • 4 replies
  • 2156 views

Using STM32L4 with DS3231. Using LL interrupts to communicate with device.

Is there any way using interrupts to detect the device has stopped working. stopped working in the sense that that device is not ACK ng or has lost Vcc. not as in device functionality.

was unable to get NACK interrupt .. it was being enabled though.

This topic has been closed for replies.

4 replies

TDK
October 19, 2020

Well there's no real way to detect if a remote IC has lost power unless you're tied into that power rail somehow. If you are, you could use an ADC threshold.

Seems like you answered your own question. The NACKIE bit and corresponding NVIC interrupt will enable interrupts when a NACK happens.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Hp.14
Hp.14Author
Associate II
October 19, 2020

had enabled the NACKIE bit interrupt. my understanding is if the device doesnt respond it is considered a NACK.

however was unable to catch interrupt. tested this removing Vcc to device

LL_I2C_HandleTransfer(device_instance->ds3231_i2c,
					device_instance->device_address, LL_I2C_ADDRSLAVE_7BIT, 1,
					LL_I2C_MODE_SOFTEND, LL_I2C_GENERATE_START_WRITE);

Tesla DeLorean
Guru
October 19, 2020

Use a time out, and propagate errors in your I2C driver stack and usages so you can identify when a device stops responding.

As most lack an async-reset you might have to attempt clocking devices out of errant states.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Hp.14
Hp.14Author
Associate II
October 19, 2020

thank you,

Please elaborate

"async-reset you might have to attempt clocking devices out of errant state"

how is this process carried out