DS1307 - Mega2560 - Using SCL(21)SDA(20) -Clock Does Not Set

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
mustang65
 
Posts: 54
Joined: Sat Jan 26, 2013 9:29 pm

DS1307 - Mega2560 - Using SCL(21)SDA(20) -Clock Does Not Set

Post by mustang65 »

I am finally getting to add the DS1307 to the MEGA 2560 and I am using the SLA/SDA pins on the MEGA board, with no luck. There may be one issue regarding the way the ckt board was mounted to the pin header, but I have 5vdc and grd on the ckt boards pins. The message I get when I run any of the "time set" sketches is pretty much the same , no update. When I run TimeRTCSet from the time library I receive the message "UNABLE TO SYNC WITH THE RTC" (See attached Photo) and it starts counting off the seconds. I tried using a logic probe on SDA and when it was updating I did get a hit. That is the best I can do for checking the data being uploaded. The TX on the MEGA flashes each second. I also enclosed pictures of the wiring.
Any thoughts
Don

SKETCH:

Code: Select all

/*
 * TimeRTCSet.pde
 * example code illustrating Time library with Real Time Clock.
 *
 * RTC clock is set in response to serial port time message 
 * A Processing example sketch to set the time is included in the download
 * On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone)
 */

#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t


void setup()  {
  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if (timeStatus() != BANNED) 
     Serial.println("Unable to sync with the RTC");
  else
     Serial.println("RTC has set the system time");      
}

void loop()
{
  if (Serial.available()) {
    time_t t = processSyncMessage();
    if (t != 0) {
      RTC.set(t);   // set the RTC and the system time to the received value
      setTime(t);          
    }
  }
  digitalClockDisplay();  
  delay(1000);
}

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

/*  code to process time sync messages from the serial port   */
#define TIME_HEADER  "T"   // Header tag for serial time sync message

unsigned long processSyncMessage() {
  unsigned long pctime = 0L;
  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 

  if(Serial.find(TIME_HEADER)) {
     pctime = Serial.parseInt();
     return pctime;
     if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013)
       pctime = 0L; // return 0 to indicate that the time is not valid
     }
  }
  return pctime;
Attachments
Error message from TimeRTCSet.jpg
Error message from TimeRTCSet.jpg (37.08 KiB) Viewed 1839 times
RTC DS1307 - MEGA 2560 - Wiring.jpg
RTC DS1307 - MEGA 2560 - Wiring.jpg (78.06 KiB) Viewed 1839 times
RTC DS1307 Mount Issue.jpg
RTC DS1307 Mount Issue.jpg (25.08 KiB) Viewed 1839 times
Last edited by adafruit_support_bill on Wed Aug 07, 2013 5:08 am, edited 1 time in total.
Reason: Please use the 'code' button when submitting code

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 - Mega2560 - Using SCL(21)SDA(20) -Clock Does Not Set

Post by adafruit_support_bill »

The connections look correct. But the photos are not clear enough to see the soldering on the breakout board. Can you get a clearer shot of the soldering?

User avatar
mustang65
 
Posts: 54
Joined: Sat Jan 26, 2013 9:29 pm

Re: DS1307 - Mega2560 - Using SCL(21)SDA(20) -Clock Does Not Set

Post by mustang65 »

I am enclosing a better photo of the DS1307. If you look at the SCL & SDA solder points, they may be a cold solder connection.
Your thoughts,
Thanks again,

Don
Attachments
DS1307 - solder points.jpg
DS1307 - solder points.jpg (12.65 KiB) Viewed 1793 times

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 - Mega2560 - Using SCL(21)SDA(20) -Clock Does Not Set

Post by adafruit_support_bill »

Can't see much detail. But a cold joint is not difficult to fix. Have a look at this guide for tips on recognizing and fixing common soldering problems: http://learn.adafruit.com/adafruit-guid ... n-problems

User avatar
mustang65
 
Posts: 54
Joined: Sat Jan 26, 2013 9:29 pm

Re: DS1307 - Mega2560 - Using SCL(21)SDA(20) -Clock Does Not Set

Post by mustang65 »

I desoldered the header connection, resoldered the connections and it is now a working product. I can continue with my project now....
Thank you very much
Don

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

Return to “Clock Kits (discontinued)”