I am having a problem with interrupts, more specifically with the ISR. I am working with a DS3231 RTC module with an Arduino UNO R3. The program intent is to drive a motor with a relay three times during the day. I am using the alarm function on the RTC to trigger the motor activity at the appropriate time. I am able to program the RTC alarm registers with no issues and the alarm will trigger at the correct time The alarm signal (INT/SQW) is connected to Arduino pin 2 and the interrupt is enabled with FALLING mode
My original test for the ISR was a simple “Serial.print” command, which worked as intended. I modified the ISR to be able to write to the RTC using the wire library. When the alarm triggered and the ISR called, it started to execute the print statement I left in but hung up. I read in another forum on interrupts that the ISR should be very short, also that there might be issues with wire library commands in the ISR. I had the ISR call another routine which did get called but hung up in the same manor.
I am noticing that the interrupt pin on the RTC is still active (low) so I am assuming that it still sees the interrupt and that is causing problems. I have tried adding noInterrupts as the first statement in the ISR but that has not improved anything, It appears that any command/statement issues in the ISR works fine until I want the write to the RTC, then things hang, no more code execution.
I know this is a long description, I just wanted to get as much information out as I could. I am not Shure how to clear the interrupt as it appears to me too be at least part of the issue. I appreciate any help or suggestion.