DS1302 Clock not getting time

I have the Nuelectronics SD shield plugged directly in a Mega 256 board. I am using Mr Sparks program to set and read time and date (see below). I can see pulses on pins 5, 6, and 7 on J1E, so I believe the chip is alive. I have connections from the SDI port to Digital pins 50-53 on the Mega board. On the serial monitor, I get “2000-00-00 00:00:00”.
There are no complier errors. I am guessing it may be a connection problem, but don’t know what else to try. Any suggestions?
Thanks,
Steve

/*
Example sketch for interfacing with the DS1302 timekeeping chip.


Copyright (c) 2009, Matt Sparks
All rights reserved.

http://quadpoint.org/projects/arduino-ds1302
*/
#include <stdio.h>
#include <string.h>
#include <DS1302.h>

/* Set the appropriate digital I/O pin connections */
uint8_t CE_PIN   = 5;
uint8_t IO_PIN   = 6;
uint8_t SCLK_PIN = 7;

/* Create buffers */
char buf[50];
char day[10];
const int LED = 10;

/* Create a DS1302 object */
DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN);

void print_time()
{
  /* Get the current time and date from the chip */
  Time t = rtc.time();
 digitalWrite(LED, HIGH);

  /* Name the day of the week */
  memset(day, 0, sizeof(day));         /* clear day buffer */
  switch (t.day) {
    case 1:
      strcpy(day, "Sunday");
      break;
    case 2:
      strcpy(day, "Monday");
      break;
    case 3:
      strcpy(day, "Tuesday");
      break;
    case 4:
      strcpy(day, "Wednesday");
      break;
    case 5:
      strcpy(day, "Thursday");
      break;
    case 6:
      strcpy(day, "Friday");
      break;
    case 7:
      strcpy(day, "Saturday");
      break;
  }

  /* Format the time and date and insert into the temporary buffer */
  snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
           day,
           t.yr, t.mon, t.date,
           t.hr, t.min, t.sec);

  /* Print the formatted string to serial so we can see the time */
  Serial.println(buf);
}

void setup()
{
  Serial.begin(9600);

  /* Initialize a new chip by turning off write protection and clearing the
     clock halt flag. These methods needn't always be called. See the DS1302
     datasheet for details. */
   rtc.write_protect(false);
   rtc.halt(false);

   pinMode(LED, OUTPUT);
  
   
  /* Make a new time object to set the date and time */
  /*   Tuesday, May 19, 2009 at 21:16:37.            */
  Time t(2009, 5, 19, 21, 16, 37, 3);

  /* Set the time and date on the chip */
  rtc.time(t); 
  // digitalWrite(LED, HIGH);
  
}

/* Loop and print the time every second */
void loop()
{
  print_time();
  delay(500);
  digitalWrite(LED, LOW);
  delay(500);
 }

It is confusing for me. I would like more links to the things you are using, and please be more careful with typing.

Your board is a Arduino Mega 2560 ? You are using this code ? https://github.com/msparks/arduino-ds1302 Is there information for that SD nuelectronics shield ? the www.nuelectronics.com doesn't seem to exist anymore. Do you mean the SPI bus ? That bus is not for the DS1302. Do you use a breakout board for the DS1303 ? Which one ? Is a battery installed ? How is it connected ?

The DS1302 has weird timing. That is why I don't like the msparks code. It doesn't take care about that timing. The DS1302 uses three wires. It can be any wires. In the sketch 5, 6, 7 are used. Did you connect those to the DS1302 ?

You could try this one to test the DS1302, http://playground.arduino.cc/Main/DS1302

Thanks for the response. Yes, the Mega 2560 rev 3. The Nuelectronics official name was “Real-Time Data-log & IO Shield for Arduino V1.0” dated Apr 30, 2010. And this shield is plugged directly (on top) of the Mega board. I cannot find Nuelectronics any longer either. Yes, I am trying the Sparks code as it appeared to be the easiest to debug.
The SPI connections mentioned in my original post was for testing the SD card, and the hardware, software, and interfacing works fine, but it doesn’t do anything with time functions.
I don’t use a breakout board as the shield plugs into the Mega 2560 board. I can see clock pulses on J1 pin 7, CE pulses on J1 pin 5, and pulses on J1 pin 6. Yes, it has a battery. Is there a way I can send you a photo?

I will explore the link that you provided and post the results. I appreciate your input!
Steve

It seems like a wiring problem. Or a defective crystal. There are many problems on this forum for the DS1307 (RTC with I2C interface) with bad crystals.

When writing a post, you see "Additional Options...", that is to upload a photo.

I had a really good reply, but the system barfed with 3 photos, so just sending 1 photo.
The short version- I think the crystal is good because the clock pulses look fine.
I tried that program that you pointed to, had to change the Sclk, IO, and CE pins for my board (I used pins 7, 6, and 5 instead of 6, 7,and 8). But I tried it both ways, no joy.
If you could suggest a better battery backed clock and SD board, I am not opposed to buying something that works.
Thanks,
Steve

According to the photo, it is just the chip, the crystal and the battery. There is not a lot that can go wrong.

What happened with that sketch ? All zero's for the time and date ?

The DS1307 clock modules from Sparkfun and Adafruit should work. They don't use the cheapest components, but components that are reliable. http://www.adafruit.com/products/264 https://www.sparkfun.com/products/99

I just ordered one from Adafruit, so unless someone has a flash of insight, we can shut this one down. I appreciate your help!

Best, Steve