@Riva OMG Thank you so much for your reply!
Riva:
Also I think BBSQW needs setting to 1 to enable square wave output when battery powered.
This was IT !! Gosh, can't believe it! I was stuck at this problem for so long! Excellent work at spotting this; it was quite unclear to me from the datasheet!
To others who see this thread, the JChristensen library did not have a function to set the BBSQW pin so I wrote this one:
/*
Sets/resets the BBSQW pin in the control register
*/
byte DS3232RTC::setBBSQW(bool state)
{
//Get original contents
byte t = readRTC(RTC_CONTROL);
if (state)
//Set bit 6 i.e. the BBSQW
t |= (1 << BBSQW);
else
t &= ~(1 << BBSQW);
return (writeRTC(RTC_CONTROL, t));
}
Riva:
Was the INTCN, A1IE & A2IE bits also set in the control register (0x0E) to enable the Alarm match to also trigger the interrupt?
Yes these bits were also set.
Finally, following @jremington's suggestion of the pull-up resistor to Vcc on SQW, and setting the BBSQW bit on the RTC, interrupts are generated as desired even after switching off Vcc!
Once again thank you so much, all of you! You guys are love! <3
P.S. Super-psyched!
![]()