Electronic – Two wire vs. three wire serial interface for RTC

atmegaclocki2crtcspi

I'm looking to choose an RTC for a project I have in mind.

I have the following options (linked to datasheet):

  1. DS1307
  2. DS1302

The main difference seems to be the communication protocol. The DS1307 seems to use something called "two-wire serial interface" whereas the DS1302 uses something called the "3-wire interface".

I would like to use one of these chips to keep time on my ATMega microcontroller (probably ATmega8).

So how are these two different, and how would I hook them up?

Best Answer

The main difference between SPI (3-wire interface) and I2C (2-wire interface) is, that you have to send an address when using I2C. So it won't be as fast as SPI because you have to send more data.

When using SPI you will need an extra pin for the chip enable signal. This will be required for each slave. So it's faster, but you need more output pins.

I would prefer I2C because speed doesn't matter in this scenario.

The ATMega microcontroller has hardware peripherals for both methods so it's up to you