PCF8563 Current Consumption

Hi guys,

I'm using the library posted in the playground for PCF8563 RTC

As I'm using this for a low power application, I notice that whenever I use any function provided by the library that only performs write without requesting any data bytes from the RTC, the current consumption (the ATMega328P itself) would go up pretty high 3-4 mA and it stays there. For example, setAlarm and clearAlarm functions. The only differences I notice with these 2 function compared to the rest like formatDate and formatTime is the write and request for data sequence.

I think, there's something in the Wire and TWI library that is causing this although I'm not very sure.
Any guys came across this problem before?

Can you be more explicit:

What is your code exactly (ie post your code in code tags). Are you putting the processor into sleep mode (3-4mA is not "high"
consumption for a 328!).

My intuition would be that something is leaving one of the I2C bus lines pulled low, which it shouldn't. What value pull-up
resistors do you have on the bus? What's the supply voltage?

Hi Mark,

Yes, I'm putting the processor into sleep mode. It usually goes down to about 0.1 uA without the RTC.

I'm using a 4K7 pull-up for both data and clock.
It's weird because it only happens (higher consumption) when certain call function of the PCF8563 is being used like for example:

rtc.setAlarm(minute, 99, 99, 99);
digitalWrite(vperiPin, LOW);   
attachInterrupt(1, alarm, FALLING);

Then the MCU will be pushed to sleep soon after that. The vperiPin is used to power the I2C pull-up. So, I turn them off when not using them.
When I used functions like formatDate or formatTime, the current stays low.

If I were to comment out the setAlarm line, then the current goes low again. The current resulting from the attachInterrupt function is negligible.

Hi Mark,

My intuition would be that something is leaving one of the I2C bus lines pulled low, which it shouldn't.

I just did some measurement on the data and clock lines. As the pull-up are being powered by a digital pin (vperiPin) on the Arduino, the measurement looks weird to me:

  • With the setAlarm function enabled, both SDA & SCL are around 25 mV and also 25 mV on the other end of the pull-up resistor (on vperiPin which is already being set as low. This is when the current measured is higher (few mA).
  • With the setAlarm function commented, both SDA & SCL are around 0.6 V and also 0.6V on the other end of the pull-up resistor (vperiPin is also set low in this case). This is when the current measured is low (uA range).

Ah, that's quite likely the problem - sleep mode is pulling the SDA and SCL lines low, causing the RTC input circuits to operate.

I would leave the pull-ups connected to Vcc and make sure the SDA and SCL pins are set as INPUTs during sleep.