1

I am trying to use a DS1307 (from Sparkfun, BOB-12708) with an Arduino Leonardo. I have connected the SDA, SCL, GND, and 5V pins from the RTC to the Arduino. However, with a CC3000 WiFi shield on the Arduino, the I2C bus hangs. Specifically, Wire.endtransmission() hangs, called by rtc.isrunning(). I have confirmed that it works properly on the same Arduino without the WiFi shield. I am using the ds1307 RTClib example for testing it.

4
  • Which CC3000 breakout exactly? This may be related to the fact that the CC3000 employs interrupts; they could be interrupting the I2C transaction. Post the code that combines the CC3000 and the RTC. Apr 30, 2016 at 0:27
  • It's the CC3000 shield. Apr 30, 2016 at 2:58
  • Adafruit and Sparkfun both produce CC3000 shields, among others. Which one is yours? Apr 30, 2016 at 3:31
  • I have the one from Adafruit: adafruit.com/product/1491 Apr 30, 2016 at 15:05

1 Answer 1

1

It could be that the CC3000 interrupts are affecting the Wire library's behaviour since the latter is interrupt-driven itself. Try disabling the CC3000 IRQ before calling rtc.isrunning() or any other RTC functions. First #include "ccspi.h" in your sketch. Then place WlanInterruptDisable() before any RTClib function call, and then WlanInterruptEnable() after the RTC function returns.

Even if this works, it may affect the functionality of the CC3000, since it increases the chances of missed interrupts. You can search for DS1307 libraries that employ SoftwareI2C instead such as this one. They should be better able to recover from the CC3000 interrupts.

14
  • As I've said in my OP, it doesn't work even with just the RTC example. Would CC3000 interrupts be messing with things even if the library isn't included? Apr 30, 2016 at 3:00
  • No, it wouldnt. Somehow, I thought you meant that you used the examples together with the CC3000 code. How are you powering the CC3000? Directly from the Arduino? Apr 30, 2016 at 3:31
  • The CC3000 is a shield, so yes it is directly powered from the Arduino which is powered by USB for testing. Apr 30, 2016 at 15:04
  • Powering the CC3000 via USB can cause unreliable behaviour since USB can only supply so much current. Try connecting the shield to the Arduino with jumper cables and powering the shield separately with a 1A source, while connecting all the GNDs together. Apr 30, 2016 at 16:31
  • I'm pretty sure a USB to wall adapter can supply a lot more current, correct? Might that work? I could probably also rig something up if it doesn't. Apr 30, 2016 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.