Go Down

Topic: Strange issue with I2C and RTC on Arduino Due (Read 226 times) previous topic - next topic

IgorFlipTheSwitch

Hi everybody!

I got myself a Diymore DS3231 RTC, plugged in CR2032 battery, and hooked it up to pins 20 and 21. When I ran a DS3231 sample, I got 2165-165-165 date and 165:165:85 time. I read several threads here, figured that it means that RTC is not communicating with the Due. Following thread recommendations, I tried removing RTC battery, adding plug-in power supply for the Due, and updated wire.cpp library, but nothing worked. I2C scanner was showing three devices though which I don't get:

>Scanning...
>I2C device found at address 0x57  !
>I2C device found at address 0x5F  !
>I2C device found at address 0x68  !
>done

I have an SD card hooked up to SPI, but nothing else besides RTC. Finally I plugged the RTC into SCL1 and SDA1. Now I2C scanner shows no devices found, but the RTC works fine, shows and keeps correct time:

>2018/10/24 (Wednesday) 19:46:10
> since midnight 1/1/1970 = 1540410370s = 17828d
> now + 7d + 30s: 2018/11/1 8:16:16

I am really confused by this behavior. Any thoughts on what is going on here? Thanks! Igor

ard_newbie

If your RTC module works fine with SDA1/SCL1 (no pull-ups on the DUE) and not with SDA/SCL (pull-ups on the DUE), that means that the RTC has its own pull-up resistors:

https://forum.sparkfun.com/viewtopic.php?t=40332

IgorFlipTheSwitch

I see. That makes sense. I updated "Wire" to "Wire1" in I2C scanner code, and now I2C scanner detects devices at three addresses and RTC still works (still on SDA1/SCL1). Can you explain why there are three I2C addresses and not one? I thought RTC uses a single I2C address.

>Scanning...
>I2C device found at address 0x57  !
>I2C device found at address 0x5F  !
>I2C device found at address 0x68  !
>done

Thanks for the help!
Igor

ard_newbie


Go Up