6 years, 1 month ago.

Why i cant R/W?

My RTC from sparkfun (same model) works well with Arduino. But I can`t seem to get it to work with Mbed I get error on R/W operations both read and write.

The i2c cables are linked from p28 and p27 for Data and Clock respectively. Any help appreciated it.

Copy from Terminal:

seconds set are 24 min set are 13 hour set are 13 day set are 04 date set are 20 month set are 06 year set are 12 Last R/W operation failed! seconds read are 24 min read are 13 hour read are 13 day read are 04 date read are 20 month read are 06 year read are 12 Last R/W operation failed! Value written to register 0x20 39 Last R/W operation failed! Value read from register 0x20 00

Question relating to:

This is a class for using the DS1307 Real Time Clock chip from Dallas Semiconductor. This class uses mbeds i2c class to talk to the chip. I have tested this … clock, ds1307, I2C, RTC

1 Answer

6 years, 1 month ago.

Are the pull-ups installed on SDA and SCL?

Some resistors from those lines to 5v? No. I thought it already had them on the rtc board. Never used them on arduino. Is it different on mbed? Sorry I just got it today.

posted by Julio Ryuuzaki 23 Dec 2014

The pull-up resistors are definitely needed on LPC1768 mbed. They should be around 4K7 each and pull-up voltage should be 3V3 instead on 5V. Not sure which RTC board you use. It could have them onboard in which case you dont need additional ones. Also make sure that you have common ground.

posted by Wim Huiskamp 23 Dec 2014

Thank you Wim, I am using exactly the board that the OP Philip posted on the original code.


Ive tried with 220, 330, 1k, 2k, 4k and still dont get any response. I find it very strange since this RTC breakout works just fine without anything in Arduino. I am using the p9,p10 for DAT and CLK and also change to 28, 27, and nothing also made sure its set to address 0x68. But I have no idea what am I doing wrong.

Thank you so much for taking the time to respond.

After playing around, I finally have it working using 4.2kΩ on a 5.0v line. Also managed to plug in a OLED on i2c. Also, the address also was 0xD0 for this RTC module.

posted by Julio Ryuuzaki 25 Dec 2014