Odd behavior of PCF8523 on a Mega

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
drwgriffin
 
Posts: 4
Joined: Mon Dec 29, 2014 4:12 pm

Odd behavior of PCF8523 on a Mega

Post by drwgriffin »

I have connected a PCF8523 Real Time Clock to a Mega using SDA/SCL (pins 20/21). I have seen some very odd behavior. It appears to keep perfect time, in that the year, month, day (kind of), minutes and seconds are correct.... However, the hours are sometimes correct, sometimes shifted by 8 hours, or just bizarre (32!?!). This appears to occur based on the output directly from the library call using the RTC_PCF8523::now() call. I am using Arduino IDE 1.8.5 on a Mac and using the RTClib by Adafruit Version 1.2.0 (a fork of Jeelab's lib). My Mega is a clone.

I have sent the output directly to the serial monitor without any manipulation and the numbers seem to track as follows...

Serial Print Actual Correct shift
2018/4/5 (Thursday) 19:34:26 2018/4/5 (Thursday) 7:34 PM yes
2018/4/5 (Thursday) 31:6:46 2018/4/6 (Friday) at 7:06AM no ?
2018/4/6 (Friday) 12:4:58 2018/4/6 (Friday) at 8:04AM no -8
2018/4/6 (Friday) 9:33:44 2018/4/6 (Friday) at 5:33PM no -8
2018/4/6 (Friday) 32:6:34 2018/4/6 (Friday) at 8:06 PM no ?
2018/4/6 (Friday) 21:5:20 2018/4/6(Friday) at 9:05 PM yes


Any help would be most appreciated.

Minor update - I modified the library to send out the raw data from the read and then checked the raw binary out to make sure there was not any spurious bits messing with the BCD conversion. Everything looked "normal" in that when it was 11 AM the raw output was still showing 11b and thus converted to 3AM, i.e., given the incorrect time with an occasional 8 hour offset. Also, I tested this same RTC module using an SparkFun RedBoard (UNO equivalent) with a different library (PCF8523 Arduino library by Alfredo Prado 2014) and the behavior was the same. Is my chip partially defective?

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”