I2C with Wifi101 shield

I am having difficulty with a DS1307 real time clock when used with the Wifi101 shield on an Arduino Mega 2560. The RTC works fine without the shield and does not work with the shield. As far as I know, the Wifi101 does not use I2C so I am stumped.

The SDA and SCL signals look OK using an o'scope except that the time coming from the RTC is way off. Sometimes the rtc.isrunning() function indicates true, sometimes false.

Any ideas?

Any luck with finding a solution for this? I am having same problem with the RTC from Adafruit. Works until I mounted the Wifi 101, checked battery and it was fine. Removed the Wifi 101, hooked back up the Uno alone and the RTC works fine.

Uno Rev 3
Arduino Software 1.6.5.
DS1307 Real Time Clock Breakout Board Kit from Adafruit
RTC SDA connect to Uno analog pin 4, SCL connected to analog pin 5
Tested battery
Power by 5v from Uno hooked to USB only then added power supply to Uno.

Here is what I did using the code provided by Adafruit, hooked RTC to Uno, it functions with no problem.

Mounted the Wifi 101 to the Uno and hooked RTC to Wifi 101 A4 and A5. 5v from Wifi 101 5v header. Ground from Wifi 101 ground

RTC did not work.

Checked battery it was fine, plugged power adapter into Uno, checked all connections, still nothing.

Hooked up I2C FRAM breakout board from Adafruit to Wifi101 A4 and A5, loaded Adafruit code only, I2C FRAM functions with no problem.

It just appears to be some issue with the RTC while on the Wifi 101

This is the code used from Adafruit:

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

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

RTC_DS1307 RTC;

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

if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// 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();

Serial.print(" since 1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");

// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now.unixtime() + 7 * 86400L + 30);

Serial.print(" now + 7d + 30s: ");
Serial.print(future.year(), DEC);
Serial.print('/');
Serial.print(future.month(), DEC);
Serial.print('/');
Serial.print(future.day(), DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(':');
Serial.print(future.minute(), DEC);
Serial.print(':');
Serial.print(future.second(), DEC);
Serial.println();

Serial.println();
delay(3000);
}

I think the I2C of the DS1307 is a flaky design. With the Wifi101 shield, the isrunning() function of the RTClib indicates that the rtc is NOT running. If I try to probe the SDA pin with the o'scope, the isrunning() function result magically changes to IS running. The I2C timing is pretty relaxed so I can't understand.

The rtc seems to be transmitting on the I2C. Problem is, it seems to be spitting out garbage.

Thanks!

I have pretty much given up hope of using it with the Wifi 101. I am able to read and write to an I2C Fram from Adafruit on the same pins A4 and A5 with no problem, however just cannot get the RTC to function as needed with the 101. As I read the schematic and as I understand pins A4 and A5 are pass through only so I assume the issue is with the interaction between the Uno and Wifi 101. I realize the 1307 is a bit flaky but would have also assumed it would function just as well using the 101.

I'll keep checking back and if I find something, I'll post here. Thanks again!

I just tried hooking up a L3DG20H gyro to the I2C bus with the Wifi101 shield. The gyro seems to work fine both with and without the wifi shield in place. Sure looks like a problem with the DS1307 rtc.

The funny thing is that the waveforms on the I2C lines seems to look the same to and from the DS1307 with and without the shield in place except that the DS1307 spews bad data with the shield in place.

I found strange things happening with the I2C bus using the Wifi101 shield when I zoomed in on the time scale. Attached is a picture of I2C waveforms with and without the shield in place on a Mega2560.

The upper trace is SDA and the lower trace is SCL. The Mega should be transmitting a "1" bit. Without the shield, the rise time is obviously controlled by the pullup resistor. With the shield, there appears to be active pullup coming from the shield. The rise times go from around 700 ns to 5 ns when the shield is in place compared to when it is removed. Also, there is a positive glitch about 50 ns wide on SCL that could be interpreted by the slave device as a separate SCL pulse.

Short of clipping pins, does anyone have any idea how to disable this "feature" on the Wifi shield?

Postscript: You definitely do not want to clip pins. The Wifi shield uses I2C. Clipping the SDA/SCL pins on the shield will render the shield useless.

WIFI_Shield_I2C.pdf (59.1 KB)

Here is what I have found out. The DS1307 real time clock does not work with the Wifi101 shield in place. The DS3231 works fine.

It seems the I2C line has active pull-up when the Wifi101 is attached, sort of like a Schmitt trigger effect that the DS1307 does not like.

@charliesixpack did you ever find out what the exact issue was or how to bypass the pull up? Did you just use a Logic Level Converter?