DS3231 - No Alarm when powered Off. Why?

I've got one. Give me few minutes....

I couldn't figure out how to clear the interrupt on this thing. Supposedly you just clear the bit in the status register (0x8F) but it wasn't working for some reason. The INT line was staying low. Probably something dumb I was doing.

Anyway, I got it to generate a low interrupt pulse with Vcc=3.3V every minute (seconds = 0). Then I pulled the plug on Vcc and I still got that interrupt.

So it works under battery power.

Good on Maxim for making their part in an intelligent fashion. Bad on Maxim for ambiguous or incomplete documentation. Their datasheets are actually pretty good overall.

jboyton:
So it works under battery power.

Are you sure? I never got it to work. I set BBSQW, INTCN, A1IE to 1, I setup alarm 1 every seconds. The arduino doesn't catch the interrupt when the RTC run on battery...

No, I'm not 100% sure. Just one test. Repeated several times.

I tried setting it to interrupt every second and the interrupt line went low after 1 second and stayed low. I couldn't reset it. So I reconfigured the alarm to go off when seconds = 0. With Vcc=3.3V it went low as expected. Then I restarted (with Vcc=3.3V) and then pulled the plug and set Vcc=Gnd as the zero seconds approached. The line went low even with Vcc=0.

I still don't understand why my code is failing to clear the interrupt. It's probably an error I'm making. I just don't see it.

edit: I don't know if it matters, but I left BBSQW=0.

Do you have a pullup on the line so there's a good High & Low?

Yes, there's a pullup to Vcc.

edit: Sometimes pictures are fun:

Interesting.

guix:
Are you sure? I never got it to work. I set BBSQW, INTCN, A1IE to 1, I setup alarm 1 every seconds. The arduino doesn't catch the interrupt when the RTC run on battery...

Every second is a dangerous test. It's too similar to the 1Hz setting. Every minute would be more convincing.

So it was a long time ago since I tried this... I've just tried again and here is what's happening for me:

With either INTCN 0 or 1, I noticed that with just VCC disconnected, the LED on the ZS042 module is blinking when the interrupt should have been triggered on the arduino. For example if I set SQW to 1HZ I would see the LED blink every 500ms...

How the module and its LED were powered ? I tried to disconnect the SDA and SCL, and magically the LED didn't blink anymore and the interrupt worked ( for SQW as well as for Alarms ). Or at least, the alarm work once, then I would need to reconnect VCC, SDA and SCL, to clear A1F so that the alarm can fire again..

So it is basically working for me, but only when I disconnect SDA and SCL from this module... Any idea why?

What is a ZS042?

That module:

Here is the schematic

Do you think the issue I described could be a problem with those pullups on the I2C lines ?

The schematic didn't come through from that Polish site, just a blue rectangle with "CBA.PL - Najlepszy darmowy hosting".

Can you post it in some other way?

Now you see it?

Yes, I see it now. I don't understand it. What is the AT24C02 for?

edit: Oh I see, it's an EEPROM. I forgot that the DS3231 doesn't have any RAM.

I have found this thread on forum: safe to remove power led from ds3231 clock module? - Sensors - Arduino Forum

What do you thing about it? I don't understand it. Because if i power off module led go low while for pdoriam user (see thread) RTC module don't stop working after power off.

I'm powering the module with D4 in series with a 220 ohm resistor (that line is also capped to gnd via a 0.1uF cap).
D4 is set to HIGH whenever I need to power up the clock.
In this case every time the module's INT/SQW pin goes low (by setting an alarm) it fires a low level interrupt on D2 to wake up the micro-controller and do whatever it needs to. After that I set D4 to LOW and power off the module.
I have the module's INT/SQW pin pulled up to 5V with a 10k resistor.
Everything works smoothly except that the power led on the module remains lit after setting D4 to LOW, albeit very dimly.

I'm missing something?

@matte00, do you have the same module?

It sounds like the DS3231 is getting power from the I2C pins. Maybe you're not supposed to power it down while it's still connected to a live interface. Or perhaps the EEPROM chip is the culprit.

I've actually been testing with a DS3234, the SPI version of the chip. Aside from the interface (and onboard RAM) it is functionally identical, with the same registers. At least according to the datasheets. But maybe there is a subtle difference.

I had a similar problem with an OLED display that I wanted to power down. The only way I could do it was to drive all of the interface pins low. Otherwise current would flow through SCK, MOSI, RST, D/C and power the display. It made it impossible to power it down in a system with multiple SPI devices.

The ZS-042 module has (IMHO) a flaw. SQW has a pullup to Vcc. So if it is running on battery (i.e. Vcc = 0), that pullup becomes a pull down. I wanted to use SQW for something in stand-alone mode and had to cut a trace to make it work. It shouldn't make any difference in this case, because all those outputs are open drain.

On the Chronodot, they were (IMHO) smarter and left that line uncommitted.

I'm not sure if that pertains to the above, but I thought I should point it out.

jboyton:
It sounds like the DS3231 is getting power from the I2C pins. Maybe you're not supposed to power it down while it's still connected to a live interface.

No, the designers didn't make that mistake, thankfully. But maybe it's leaking through the EEPROM?

I'll bet you're right on both counts.

I've just been using the bare chip on an SMD to DIP breakout board so I can easily manipulate the circuitry.

I figured out why I couldn't clear the interrupt. It was something dumb (wrong SPI mode). Now I have it interrupting the processor every second whereupon it powers up the RTC, reads the time, waits 100ms and clears the interrupt, and then powers the RTC down again. It's distinguishable from the 1Hz square wave since the interrupt is only low ~100ms.

I'm convinced it works -- at least a bare DS3234 does.