DS3234 RTC and Uno problems

I wired up an Uno to Sparkfun's DS3234 breakout board and am seeing strange results. i wired it up as follows:

GND – GND
VCC – 3.3v
SQW – GND and pulled up to 3.3V
CLK – 13
MISO – 12
MOSI – 11
SS – 8

I've tried to run both sparkfun's example code and maniacbug's example from here: GitHub - maniacbug/RTClib: A fork of Jeelab's fantastic RTC library

It sets the time, but then gets corrupted:

maniacbug's example output:
RTClib/examples/ds3234/
RTC is NOT running!
Setting time to... Dec 19 2011 22:07:39
Dec 31 2165 23:60:60
since midnight 1/1/1970 = 1890322364s = 21878d
now + 7d + 30s: Dec 02 2029 17:33:14

since midnight 1/1/1970 = 2313941504s = 26781d
now + 7d + 30s: May 06 2043 17:32:14

Dec 31 2165 23:60:60
since midnight 1/1/1970 = 1890322364s = 21878d
now + 7d + 30s: Dec 02 2029 17:33:14

sparkfun's output after I set it with SetTimeDate(19,12,11,21,30,00)
0/0/0 0:0:20
0/0/0 0:1:21
0/0/0 0:0:22
0/0/0 0:1:23
0/0/0 0:0:24
0/0/0 0:1:25
0/0/0 0:0:26
0/0/0 0:1:27
0/0/0 0:0:28
0/0/0 0:1:29
0/0/0 0:0:30
0/0/0 0:1:31
0/0/0 0:0:32
0/0/0 0:1:33

A lot of others are reporting similar problems, but I haven't seen solutions posted. Any one seen this and fixed it?

Thanks,
Dan

I don't have one to test, however looking at the data sheet, it doesn't say that INT/SQW should be grounded. It says either leave it hanging if you're not using it, or put a pull-up to VCC on it.

What level are your inputs? If they're coming straight from a 5V Uno, then they are out of spec. Per the data sheet, logic 1 should be Vcc+0.3V max.

I have left SQW hanging as well as tying it to GND and pulling it up to 3.3V.

I did not use a level shifter, but others are reporting wiring the DS3234 directly to the Uno such as here: http://www.l8ter.com/?p=375

PS. I also tried running VCC at 5V and got the same bad results.

For the sparkfun code to work, all you have to do is change

SPI.setDataMode(SPI_MODE1);

into

SPI.setDataMode(SPI_MODE3);

Afterwards it worked for me.

However still haven't figured out the maniacbug code. I'm getting the below read as well from my code.

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


//create a SPI instance
RTC_DS3234 RTC(8);

void setup()  {
  
  SPI.begin();
  RTC.begin();

//set the time to now

  RTC.adjust(DateTime(__DATE__, __TIME__));
  SPI.setDataMode(SPI_MODE0);
  Serial.begin(9600);
  
}

void loop()  {
  
  const int len = 32;
  static char buf[len];
  DateTime now = RTC.now();
  Serial.println(now.toString(buf,len));
  delay(1000);
  
}

My output is below:

Dec 31 2165 23:60:60
Dec 31 2165 23:60:60
Dec 31 2165 23:60:60

Just figured it out - use shorter wires and you should be all good. I'm getting the correct read after using 4-5cm wires.