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.| DS1307 | DS3231 | |
|---|---|---|
| Manufacturer | Analog Devices | Analog Devices |
| What it is | I2C real-time clock with 56 bytes of battery-backed NVRAM | Extremely accurate I2C real-time clock with integrated TCXO and crystal |
| Registers | 8 | 19 |
| Buses | I2C | I2C |
| I²C addresses | 0x68 | 0x68 |
| Shared registers | 7 | 7 |
| Unique registers | 1 | 12 |
Same name, different behaviour
These registers exist on both parts but are not interchangeable. This is where a driver ported between them breaks quietly.
| Register | DS1307 | DS3231 |
|---|---|---|
| CONTROL | 0x07 · 8-bit · reset 0x03 | 0x0E · 8-bit · reset 0x1C |
Only on the DS1307
| Addr | Register | Description |
|---|---|---|
| 0x05 | MONTH | Month in BCD, 01-12 |
Only on the DS3231
| Addr | Register | Description |
|---|---|---|
| 0x10 | AGING_OFFSET | Aging offset, two's complement, applied to the oscillator capacitance |
| 0x0A | ALARM1_DAY_DATE | Alarm 1 day or date, selected by DY/DT |
| 0x09 | ALARM1_HOURS | Alarm 1 hours, BCD, with the A1M3 mask in bit 7 |
| 0x08 | ALARM1_MINUTES | Alarm 1 minutes, BCD, with the A1M2 mask in bit 7 |
| 0x07 | ALARM1_SECONDS | Alarm 1 seconds, BCD, with the A1M1 mask in bit 7 |
| 0x0D | ALARM2_DAY_DATE | Alarm 2 day or date, selected by DY/DT |
| 0x0C | ALARM2_HOURS | Alarm 2 hours, BCD, with the A2M3 mask in bit 7 |
| 0x0B | ALARM2_MINUTES | Alarm 2 minutes, BCD, with the A2M2 mask in bit 7 |
| 0x05 | MONTH_CENTURY | Month in BCD, plus the century flag |
| 0x0F | STATUS | Oscillator stop flag, 32 kHz output enable and alarm flags |
| 0x12 | TEMP_LSB | Temperature, fractional part in bits [7:6], 0.25 C per LSB |
| 0x11 | TEMP_MSB | Temperature, integer part, two's complement |
Get either as C
regforge gen DS1307 --out ./src --driver --tests
regforge gen DS3231 --out ./src --driver --tests