Jump to content
Sign in to follow this  
arteq

PCF8563 - random time

Recommended Posts

I solder on spare pcb a pcf8563 acording to diagram:

 

1_2(37).jpg

 

PCF is connected to I2c 3 (PD_0 and PD_1). Tiva-C is flashed with code:

#include <Wire.h>
#include <RTClib.h>

RTC_PCF8563 RTC;

void setup () {
Serial.begin(57600);
Wire.setModule(3);
Wire.begin();
RTC.begin();

// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}

void loop () {
DateTime now = RTC.now();

Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();

delay(3000);
}

In terminal I got:

2013/12/29 17:45:31
2013/12/29 17:45:34
2032/11/17 5:37:13
2013/12/29 17:45:40
2013/12/29 17:45:43
2052/1/17 5:46:13
2013/12/29 17:45:49
2052/11/17 5:52:13
2052/11/17 5:55:52
2052/19/17 5:58:52
2013/12/29 17:46:1
2013/12/29 17:46:4
2012/1/17 6:7:13
2013/12/29 17:46:10
2012/11/17 6:13:13
2012/11/17 6:16:12
2013/12/29 17:46:19
2013/12/29 17:46:22
2032/1/17 6:25:13
2032/9/17 6:28:32
2013/12/29 17:46:31
2013/12/29 17:46:34
2032/11/17 6:37:13
2013/12/29 17:46:40
2052/1/17 6:43:13
2013/12/29 17:46:46

What is the cause of such problems? PCF not keep proper time.

 

The same PCB works on Arduino and the same code and libraries.

Share this post


Link to post
Share on other sites

You aren't providing the library so it's difficult to help you. See Information to Provide When Asking for Help.

 

The Stellaris now Tiva C Series runs at 80 MHz vs. 16 MHz for the Arduino.

 

So I guess you need to add some delay(10) between sending the command to the PCF5863 and reading the answer from the PCF8563, so it has enough time to proceed with the request and prepare the data.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...