2020-10-19 04:16 AM
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.
2020-10-19 06:22 AM
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.
2020-10-19 06:26 AM
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.
2020-10-19 07:05 AM
thank you,
Please elaborate
"async-reset you might have to attempt clocking devices out of errant state"
how is this process carried out
2020-10-19 07:09 AM
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);