RegForge

Comparisons / DS1307 vs DS3231

DS1307 vs DS3231

Register-level differences, generated from both maps.

They cannot share an I²C bus by default. Both answer on 0x68. Re-strap one, use a multiplexer, or put them on separate buses.
DS1307DS3231
ManufacturerAnalog DevicesAnalog Devices
What it isI2C real-time clock with 56 bytes of battery-backed NVRAMExtremely accurate I2C real-time clock with integrated TCXO and crystal
Registers819
BusesI2CI2C
I²C addresses0x680x68
Shared registers77
Unique registers112

Same name, different behaviour

These registers exist on both parts but are not interchangeable. This is where a driver ported between them breaks quietly.

RegisterDS1307DS3231
CONTROL0x07 · 8-bit · reset 0x030x0E · 8-bit · reset 0x1C

Only on the DS1307

AddrRegisterDescription
0x05MONTHMonth in BCD, 01-12

Full DS1307 register map

Only on the DS3231

AddrRegisterDescription
0x10AGING_OFFSETAging offset, two's complement, applied to the oscillator capacitance
0x0AALARM1_DAY_DATEAlarm 1 day or date, selected by DY/DT
0x09ALARM1_HOURSAlarm 1 hours, BCD, with the A1M3 mask in bit 7
0x08ALARM1_MINUTESAlarm 1 minutes, BCD, with the A1M2 mask in bit 7
0x07ALARM1_SECONDSAlarm 1 seconds, BCD, with the A1M1 mask in bit 7
0x0DALARM2_DAY_DATEAlarm 2 day or date, selected by DY/DT
0x0CALARM2_HOURSAlarm 2 hours, BCD, with the A2M3 mask in bit 7
0x0BALARM2_MINUTESAlarm 2 minutes, BCD, with the A2M2 mask in bit 7
0x05MONTH_CENTURYMonth in BCD, plus the century flag
0x0FSTATUSOscillator stop flag, 32 kHz output enable and alarm flags
0x12TEMP_LSBTemperature, fractional part in bits [7:6], 0.25 C per LSB
0x11TEMP_MSBTemperature, integer part, two's complement

Full DS3231 register map

Get either as C

regforge gen DS1307 --out ./src --driver --tests
regforge gen DS3231 --out ./src --driver --tests