---
type: Analog Component
title: "DS3231 — Extremely Accurate I^{2}C-Integrated RTC/TCXO/Crystal"
description: "Extremely Accurate I^{2}C-Integrated RTC/TCXO/Crystal"
resource: "https://www.analog.com/en/products/ds3231.html"
tags: ["datasheet"]
status: draft
sources:
  - id: "datasheet"
    resource: "https://www.analog.com/media/en/technical-documentation/data-sheets/ds3231.pdf"
    title: "DS3231 data sheet"
    author: "team:analog-devices"
    last_modified: "3/15"
tables:
  - file: "ds3231/tables/table-01-p2-spec.csv"
    title: "Recommended Operating Conditions"
    page: 2
  - file: "ds3231/tables/table-02-p2-spec.csv"
    title: "Electrical Characteristics"
    page: 2
  - file: "ds3231/tables/table-03-p3-spec.csv"
    title: "Electrical Characteristics (V_{CC} = 0V, V_{BAT} = 2.3V to 5.5V)"
    page: 3
  - file: "ds3231/tables/table-04-p4-spec.csv"
    title: "AC Electrical Characteristics"
    page: 4
  - file: "ds3231/tables/table-05-p4-spec.csv"
    title: "Power-Switch Characteristics"
    page: 4
  - file: "ds3231/tables/table-06-p9-pin.csv"
    title: "Pin Description"
    page: 9
  - file: "ds3231/tables/table-07-p10-data.csv"
    title: "Table 1. Power Control"
    page: 10
  - file: "ds3231/tables/table-08-p12-register.csv"
    title: "Table 2. Alarm Mask Bits"
    page: 12
  - file: "ds3231/tables/table-09-p13-register.csv"
    title: "Control Register (0Eh)"
    page: 13
  - file: "ds3231/tables/table-10-p13-data.csv"
    title: "SQUARE-WAVE OUTPUT FREQUENCY"
    page: 13
  - file: "ds3231/tables/table-11-p14-register.csv"
    title: "Status Register (0Fh)"
    page: 14
  - file: "ds3231/tables/table-13-p15-register.csv"
    title: "Temperature Register (Upper Byte) (11h)"
    page: 15
  - file: "ds3231/tables/table-14-p15-register.csv"
    title: "Temperature Register (Lower Byte) (12h)"
    page: 15
  - file: "ds3231/tables/table-15-p18-data.csv"
    title: "Ordering Information"
    page: 18
  - file: "ds3231/tables/table-16-p18-data.csv"
    title: "Package Information"
    page: 18
  - file: "ds3231/tables/table-17-p19-data.csv"
    title: "Revision History"
    page: 19
  - file: "ds3231/tables/table-00-p2-abs_max.csv"
    title: "Absolute Maximum Ratings"
    page: 2
  - file: "ds3231/tables/table-12-p14-register.csv"
    title: "Aging Offset (10h)"
    page: 14
figures:
  - file: "ds3231/figures/ds3231-fig001.png"
    caption: "Figure 1. Timekeeping Registers"
    type: "figure"
    page: 11
  - file: "ds3231/figures/ds3231-eqx01.png"
    caption: "Equation as printed (p. 16)"
    type: equation
    page: 16
  - file: "ds3231/figures/ds3231-f000.png"
    caption: ""
    type: "application_circuit"
    page: 1
  - file: "ds3231/figures/ds3231-f002.png"
    caption: ""
    type: "timing_diagram"
    page: 5
  - file: "ds3231/figures/ds3231-f003.png"
    caption: ""
    type: "timing_diagram"
    page: 5
  - file: "ds3231/figures/ds3231-f004.png"
    caption: ""
    type: "timing_diagram"
    page: 6
  - file: "ds3231/figures/ds3231-f006.png"
    caption: ""
    type: "block_diagram"
    page: 8
  - file: "ds3231/figures/ds3231-f007.png"
    caption: "Figure 2. I^{2}C Data Transfer Overview"
    type: "timing_diagram"
    page: 16
  - file: "ds3231/figures/ds3231-f008.png"
    caption: "Figure 3. Data Write-Slave Receiver Mode"
    type: "timing_diagram"
    page: 16
  - file: "ds3231/figures/ds3231-f009.png"
    caption: "Figure 4. Data Read-Slave Transmitter Mode"
    type: "timing_diagram"
    page: 16
  - file: "ds3231/figures/ds3231-f010.png"
    caption: "Figure 5. Data Write/Read (Write Pointer, Then Read)-Slave Receive and Transmit"
    type: "timing_diagram"
    page: 17
  - file: "ds3231/figures/ds3231-f011.png"
    caption: ""
    type: "pinout"
    page: 18
  - file: "ds3231/figures/ds3231-f012.png"
    caption: "STANDBY SUPPLY CURRENT vs. SUPPLY VOLTAGE"
    type: "characteristic_curve"
    page: 7
  - file: "ds3231/figures/ds3231-f013.png"
    caption: "SUPPLY CURRENT vs. SUPPLY VOLTAGE"
    type: "characteristic_curve"
    page: 7
  - file: "ds3231/figures/ds3231-f014.png"
    caption: "SUPPLY CURRENT vs. TEMPERATURE"
    type: "characteristic_curve"
    page: 7
  - file: "ds3231/figures/ds3231-f015.png"
    caption: ""
    type: "characteristic_curve"
    page: 7
  - file: "ds3231/figures/ds3231-f016.png"
    caption: "DELTA TIME AND FREQUENCY vs. TEMPERATURE"
    type: "characteristic_curve"
    page: 7
curves:
  - file: "ds3231/curves/curve-014.csv"
    caption: "curve-014.csv"
    figure: "ds3231/figures/ds3231-f015.png"
    page: 7
    x_unit: "°C"
    y_unit: "AGING = -128"
  - file: "ds3231/curves/delta-time-and-frequency-vs-temperature.csv"
    caption: "DELTA TIME AND FREQUENCY vs. TEMPERATURE"
    figure: "ds3231/figures/ds3231-f016.png"
    page: 7
    x_unit: "°C"
    y_unit: "ppm"
  - file: "ds3231/curves/standby-supply-current-vs-supply-voltage.csv"
    caption: "STANDBY SUPPLY CURRENT vs. SUPPLY VOLTAGE"
    figure: "ds3231/figures/ds3231-f012.png"
    page: 7
    x_unit: "V"
    y_unit: "µA"
    conditions: "BSY = 0, SCL = SDA = VCC"
  - file: "ds3231/curves/supply-current-vs-supply-voltage.csv"
    caption: "SUPPLY CURRENT vs. SUPPLY VOLTAGE"
    figure: "ds3231/figures/ds3231-f013.png"
    page: 7
    x_unit: "V"
    y_unit: "µA"
    conditions: "VCC = 0V, BSY = 0, SDA = SCL = VBAT OR VCC"
  - file: "ds3231/curves/supply-current-vs-temperature.csv"
    caption: "SUPPLY CURRENT vs. TEMPERATURE"
    figure: "ds3231/figures/ds3231-f014.png"
    page: 7
    x_unit: "°C"
    y_unit: "µA"
    conditions: "VCC = 0, EN32kHz = 1, BSY = 0, SDA = SCL = VBAT OR GND"
agentforge:
  part_number: "DS3231"
  datasheet_revision: "10"
  repairs: 1
  reading_order: "structure-tree"
---

# DS3231 — Extremely Accurate I^{2}C-Integrated RTC/TCXO/Crystal

*Datasheet: [DS3231 data sheet (PDF)](https://www.analog.com/media/en/technical-documentation/data-sheets/ds3231.pdf)*

### General Description

The  DS3231  is  a  low-cost,  extremely  accurate  I^{2}C real-time  clock  (RTC)  with  an  integrated  temperaturecompensated  crystal  oscillator (TCXO)  and  crystal. The  device  incorporates  a  battery  input,  and  maintains accurate  timekeeping  when  main  power  to  the  device is  interrupted.  The  integration  of  the  crystal  resonator enhances the  long-term  accuracy  of  the  device  as  well as reduces the piece-part count in a manufacturing line. The  DS3231  is  available  in  commercial  and  industrial temperature  ranges,  and  is  offered  in  a  16-pin,  300-mil SO package.

The RTC maintains seconds, minutes, hours, day, date, month, and year information. The date at the end of the month  is  automatically  adjusted  for  months  with  fewer than  31  days,  including  corrections  for  leap  year.  The clock  operates  in  either  the  24-hour  or  12-hour  format with an A̅M̅/PM indicator. Two programmable time-of-day alarms  and  a  programmable  square-wave  output  are provided.  Address  and  data  are  transferred  serially through an I^{2}C bidirectional bus.

A  precision  temperature-compensated  voltage  reference and  comparator  circuit  monitors  the  status  of  V_{CC} to detect  power  failures,  to  provide  a  reset  output,  and  to automatically switch to the backup supply when necessary. Additionally,  the R̅S̅T̅ pin  is  monitored  as  a  pushbutton input for generating a µP reset.

### Benefits and Features

- Highly Accurate RTC Completely Manages All Timekeeping Functions
  - Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year, with Leap-Year Compensation Valid Up to 2100
  - Accuracy ±2ppm from 0°C to +40°C
  - Accuracy ±3.5ppm from -40°C to +85°C
  - Digital Temp Sensor Output: ±3°C Accuracy
  - Register for Aging Trim
  - R̅S̅T̅ Output/Pushbutton Reset Debounce Input
  - Two Time-of-Day Alarms
  - Programmable Square-Wave Output Signal
- Simple Serial Interface Connects to Most Microcontrollers
  - Fast (400kHz) I^{2}C Interface
- Battery-Backup Input for Continuous Timekeeping
  - Low Power Operation Extends Battery-Backup Run Time
  - 3.3V Operation
- Operating Temperature Ranges: Commercial (0°C to +70°C) and Industrial (-40°C to +85°C)
- Underwriters Laboratories®  (UL) Recognized

### Applications

- Servers
- Telematics
- Utility Power Meters
- GPS

Ordering Information and Pin Configuration appear at end of data sheet.

### Typical Operating Circuit

![application circuit (p. 1)](ds3231/figures/ds3231-f000.png)

Underwriters Laboratories is a registered certification mark of Underwriters Laboratories Inc.

### Absolute Maximum Ratings

- **Absolute Maximum Ratings** — [table-00-p2-abs_max.csv](ds3231/tables/table-00-p2-abs_max.csv), p. 2

| PARAMETER | RATING |
|---|---|
| Voltage Range on Any Pin Relative to   Ground | -0.3V to +6.0V |
| Junction-to-Ambient Thermal Resistance   (θ_{JA}) (Note 1) | 73°C/W |
| Junction-to-Case Thermal Resistance   (θ¸_{JC}) (Note 1) | 23°C/W |
| **Operating   Temperature Range** |  |
| DS3231S | 0°C to +70°C |
| DS3231SN | -40°C to +85°C |
| Junction Temperature | +125°C |
| Storage Temperature Range | -40°C to +85°C |
| Lead Temperature (soldering, 10s) | +260°C |
| Soldering Temperature (reflow, 2 times   max) (see the Handling, PCB Layout, and Assembly section) | +260°C |

- **Note 1:** Package thermal resistances were obtained using the method described in JEDEC specification JESD51-7, using a four-layer board. For detailed information on package thermal considerations, refer to www.maximintegrated.com/thermal-tutorial .

Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. These are stress ratings only, and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

### Recommended Operating Conditions

(T_{A} = T_{MIN} to T_{MAX} , unless otherwise noted.) (Notes 2, 3)

**Recommended Operating Conditions** ([table-01-p2-spec.csv](ds3231/tables/table-01-p2-spec.csv), p. 2)

| PARAMETER | SYMBOL | CONDITIONS | MIN | TYP | MAX | UNITS |
|---|---|---|---|---|---|---|
| Supply Voltage | V_{CC} |  | 2.3 | 3.3 | 5.5 | V |
| Supply Voltage | V_{BAT} |  | 2.3 | 3.0 | 5.5 | V |
| Logic 1 Input SDA, SCL | V_{IH} |  | 0.7 x V_{CC} |  | V_{CC} + 0.3 | V |
| Logic 0 Input SDA, SCL | V_{IL} |  | -0.3 |  | 0.3 x V_{CC} | V |

### Electrical Characteristics

(V_{CC} = 2.3V to 5.5V, V_{CC} = Active Supply (see Table 1), T_{A} = T_{MIN} to T_{MAX} , unless otherwise noted.) (Typical values are at V_{CC} = 3.3V, V_{BAT} = 3.0V, and T_{A} = +25°C, unless otherwise noted.) (Notes 2, 3)

**Electrical Characteristics** ([table-02-p2-spec.csv](ds3231/tables/table-02-p2-spec.csv), p. 2)

| PARAMETER | SYMBOL | CONDITIONS | MIN | TYP | MAX | UNITS |
|---|---|---|---|---|---|---|
| Active Supply Current | I_{CCA} | (Notes 4, 5), V_{CC} = 3.63V |  |  | 200 | µA |
| Active Supply Current | I_{CCA} | (Notes 4, 5), V_{CC} = 5.5V |  |  | 300 | µA |
| Standby Supply Current | I_{CCS} | I^{2}C bus inactive, 32kHz output on, SQW output off (Note 5), V_{CC} = 3.63V |  |  | 110 | µA |
| Standby Supply Current | I_{CCS} | I^{2}C bus inactive, 32kHz output on, SQW output off (Note 5), V_{CC} = 5.5V |  |  | 170 | µA |
| Temperature Conversion Current | I_{CCSCONV} | I^{2}C bus inactive, 32kHz output on, SQW output off, V_{CC} = 3.63V |  |  | 575 | µA |
| Temperature Conversion Current | I_{CCSCONV} | I^{2}C bus inactive, 32kHz output on, SQW output off, V_{CC} = 5.5V |  |  | 650 | µA |
| Power-Fail Voltage | V_{PF} |  | 2.45 | 2.575 | 2.70 | V |
| Logic 0 Output, 32kHz, I̅N̅T̅/SQW, SDA | V_{OL} | I_{OL} = 3mA |  |  | 0.4 | V |
| Logic 0 Output, R̅S̅T̅ | V_{OL} | I_{OL} = 1mA |  |  | 0.4 | V |
| Output Leakage Current 32kHz, I̅N̅T̅/SQW, SDA | I_{LO} | Output high impedance | -1 | 0 | +1 | µA |
| Input Leakage SCL | I_{LI} |  | -1 |  | +1 | µA |
| R̅S̅T̅ Pin I/O Leakage | I_{OL} | R̅S̅T̅ high impedance (Note 6) | -200 |  | +10 | µA |
| V_{BAT} Leakage Current (V_{CC} Active) | I_{BATLKG} |  |  | 25 | 100 | nA |
| Output Frequency | f_{OUT} | V_{CC} = 3.3V or V_{BAT} = 3.3V |  | 32.768 |  | kHz |
| Frequency Stability vs. Temperature (Commercial) | Δf/f_{OUT} | V_{CC} = 3.3V or V_{BAT} = 3.3V, aging offset = 00h; 0°C to +40°C |  |  | ±2 | ppm |
| Frequency Stability vs. Temperature (Commercial) | Δf/f_{OUT} | V_{CC} = 3.3V or V_{BAT} = 3.3V, aging offset = 00h; >40°C to +70°C |  |  | ±3.5 | ppm |
| Frequency Stability vs. Temperature (Industrial) | Δf/f_{OUT} | V_{CC} = 3.3V or V_{BAT} = 3.3V, aging offset = 00h; -40°C to <0°C |  |  | ±3.5 | ppm |
| Frequency Stability vs. Temperature (Industrial) | Δf/f_{OUT} | V_{CC} = 3.3V or V_{BAT} = 3.3V, aging offset = 00h; 0°C to +40°C |  |  | ±2 | ppm |
| Frequency Stability vs. Temperature (Industrial) | Δf/f_{OUT} | V_{CC} = 3.3V or V_{BAT} = 3.3V, aging offset = 00h; >40°C to +85°C |  |  | ±3.5 | ppm |
| Frequency Stability vs. Voltage | Δf/V |  |  |  | 1 | ppm/V |
| Trim Register Frequency Sensitivity per LSB | Δf/LSB | Specified at: -40°C |  | 0.7 |  | ppm |
| Trim Register Frequency Sensitivity per LSB | Δf/LSB | Specified at: +25°C |  | 0.1 |  | ppm |
| Trim Register Frequency Sensitivity per LSB | Δf/LSB | Specified at: +70°C |  | 0.4 |  | ppm |
| Trim Register Frequency Sensitivity per LSB | Δf/LSB | Specified at: +85°C |  | 0.8 |  | ppm |
| Temperature Accuracy | Temp | V_{CC} = 3.3V or V_{BAT} = 3.3V | -3 |  | +3 | °C |
| Crystal Aging | Δf/f_{O} | After reflow, not production tested; First year |  | ±1.0 |  | ppm |
| Crystal Aging | Δf/f_{O} | After reflow, not production tested; 0–10 years |  | ±5.0 |  | ppm |

### Electrical Characteristics

( V_{CC} = 0V, V_{BAT} = 2.3V to 5.5V , T_{A} = T_{MIN} to T_{MAX} , unless otherwise noted.) (Note 2)

**Electrical Characteristics (V_{CC} = 0V, V_{BAT} = 2.3V to 5.5V)** ([table-03-p3-spec.csv](ds3231/tables/table-03-p3-spec.csv), p. 3)

| PARAMETER | SYMBOL | CONDITIONS | MIN | TYP | MAX | UNITS |
|---|---|---|---|---|---|---|
| Active Battery Current | I_{BATA} | E̅O̅S̅C̅ = 0, BBSQW = 0, SCL = 400kHz (Note 5), V_{BAT} = 3.63V |  |  | 70 | µA |
| Active Battery Current | I_{BATA} | E̅O̅S̅C̅ = 0, BBSQW = 0, SCL = 400kHz (Note 5), V_{BAT} = 5.5V |  |  | 150 | µA |
| Timekeeping Battery Current | I_{BATT} | E̅O̅S̅C̅ = 0, BBSQW = 0, EN32kHz = 1, SCL = SDA = 0V or SCL = SDA = V_{BAT} (Note 5), V_{BAT} = 3.63V |  | 0.84 | 3.0 | µA |
| Timekeeping Battery Current | I_{BATT} | E̅O̅S̅C̅ = 0, BBSQW = 0, EN32kHz = 1, SCL = SDA = 0V or SCL = SDA = V_{BAT} (Note 5), V_{BAT} = 5.5V |  | 1.0 | 3.5 | µA |
| Temperature Conversion Current | I_{BATTC} | E̅O̅S̅C̅ = 0, BBSQW = 0, SCL = SDA = 0V or SCL = SDA = V_{BAT}, V_{BAT} = 3.63V |  |  | 575 | µA |
| Temperature Conversion Current | I_{BATTC} | E̅O̅S̅C̅ = 0, BBSQW = 0, SCL = SDA = 0V or SCL = SDA = V_{BAT}, V_{BAT} = 5.5V |  |  | 650 | µA |
| Data-Retention Current | I_{BATTDR} | E̅O̅S̅C̅ = 1, SCL = SDA = 0V, +25°C |  |  | 100 | nA |

### AC Electrical Characteristics

(V_{CC} = V_{CC(MIN)} to V_{CC(MAX)} or V_{BAT} = V_{BAT(MIN)} to V_{BAT(MAX)} , V_{BAT} > V_{CC} , T_{A} = T_{MIN} to T_{MAX} , unless otherwise noted.) (Note 2)

**AC Electrical Characteristics** ([table-04-p4-spec.csv](ds3231/tables/table-04-p4-spec.csv), p. 4)

| PARAMETER | SYMBOL | CONDITIONS | MIN | TYP | MAX | UNITS |
|---|---|---|---|---|---|---|
| SCL Clock Frequency | f_{SCL} | Fast mode | 100 |  | 400 | kHz |
| SCL Clock Frequency | f_{SCL} | Standard mode | 0 |  | 100 | kHz |
| Bus Free Time Between STOP and START Conditions | t_{BUF} | Fast mode | 1.3 |  |  | µs |
| Bus Free Time Between STOP and START Conditions | t_{BUF} | Standard mode | 4.7 |  |  | µs |
| Hold Time (Repeated) START Condition (Note 7) | t_{HD:STA} | Fast mode | 0.6 |  |  | µs |
| Hold Time (Repeated) START Condition (Note 7) | t_{HD:STA} | Standard mode | 4.0 |  |  | µs |
| Low Period of SCL Clock | t_{LOW} | Fast mode | 1.3 |  |  | µs |
| Low Period of SCL Clock | t_{LOW} | Standard mode | 4.7 |  |  | µs |
| High Period of SCL Clock | t_{HIGH} | Fast mode | 0.6 |  |  | µs |
| High Period of SCL Clock | t_{HIGH} | Standard mode | 4.0 |  |  | µs |
| Data Hold Time (Notes 8, 9) | t_{HD:DAT} | Fast mode | 0 |  | 0.9 | µs |
| Data Hold Time (Notes 8, 9) | t_{HD:DAT} | Standard mode | 0 |  | 0.9 | µs |
| Data Setup Time (Note 10) | t_{SU:DAT} | Fast mode | 100 |  |  | ns |
| Data Setup Time (Note 10) | t_{SU:DAT} | Standard mode | 250 |  |  | ns |
| START Setup Time | t_{SU:STA} | Fast mode | 0.6 |  |  | µs |
| START Setup Time | t_{SU:STA} | Standard mode | 4.7 |  |  | µs |
| Rise Time of Both SDA and SCL Signals (Note 11) | t_{R} | Fast mode | 20 + 0.1C_{B} |  | 300 | ns |
| Rise Time of Both SDA and SCL Signals (Note 11) | t_{R} | Standard mode | 20 + 0.1C_{B} |  | 1000 | ns |
| Fall Time of Both SDA and SCL Signals (Note 11) | t_{F} | Fast mode | 20 + 0.1C_{B} |  | 300 | ns |
| Fall Time of Both SDA and SCL Signals (Note 11) | t_{F} | Standard mode | 20 + 0.1C_{B} |  | 300 | ns |
| Setup Time for STOP Condition | t_{SU:STO} | Fast mode | 0.6 |  |  | µs |
| Setup Time for STOP Condition | t_{SU:STO} | Standard mode | 4.7 |  |  | µs |
| Capacitive Load for Each Bus Line | C_{B} | (Note 11) |  |  | 400 | pF |
| Capacitance for SDA, SCL | C_{I/O} |  |  | 10 |  | pF |
| Pulse Width of Spikes That Must Be Suppressed by the Input Filter | t_{SP} |  |  | 30 |  | ns |
| Pushbutton Debounce | PB_{DB} |  |  | 250 |  | ms |
| Reset Active Time | t_{RST} |  |  | 250 |  | ms |
| Oscillator Stop Flag (OSF) Delay | t_{OSF} | (Note 12) |  | 100 |  | ms |
| Temperature Conversion Time | t_{CONV} |  |  | 125 | 200 | ms |

### Power-Switch Characteristics

(T_{A} = T_{MIN} to T_{MAX} )

**Power-Switch Characteristics** ([table-05-p4-spec.csv](ds3231/tables/table-05-p4-spec.csv), p. 4)

| PARAMETER | SYMBOL | CONDITIONS | MIN | TYP | MAX | UNITS |
|---|---|---|---|---|---|---|
| V_{CC} Fall Time; V_{PF(MAX)} to V_{PF(MIN)} | t_{VCCF} |  | 300 |  |  | µs |
| V_{CC} Rise Time; V_{PF(MIN)} to V_{PF(MAX)} | t_{VCCR} |  | 0 |  |  | µs |
| Recovery at Power-Up | t_{REC} | (Note 13) |  | 250 | 300 | ms |

### Pushbutton Reset Timing

![timing diagram (p. 5)](ds3231/figures/ds3231-f002.png)

### Power-Switch Timing

![timing diagram (p. 5)](ds3231/figures/ds3231-f003.png)

### Data Transfer on I^{2}C Serial Bus

![timing diagram (p. 6)](ds3231/figures/ds3231-f004.png)

### WARNING: Negative undershoots below -0.3V while the part is in battery-backed mode may cause loss of data.

- **Note 2:** Limits at -40°C are guaranteed by design and not production tested.
- **Note 3:** All voltages are referenced to ground.
- **Note 4:** I_{CCA} -SCL clocking at max frequency = 400kHz.
- **Note 5:** Current is the averaged input current, which includes the temperature conversion current.
- **Note 6:** The R̅S̅T̅ pin has an internal 50kΩ (nominal) pullup resistor to V_{CC}.
- **Note 7:** After this period, the first clock pulse is generated.
- **Note 8:** A device must internally provide a hold time of at least 300ns for the SDA signal (referred to the V_{IH(MIN)} of the SCL signal) to bridge the undefined region of the falling edge of SCL.
- **Note 9:** The maximum t_{HD:DAT} needs only to be met if the device does not stretch the low period (t_{LOW} ) of the SCL signal.
- **Note 10:** A fast-mode device can be used in a standard-mode system, but the requirement t_{SU:DAT} ≥ 250ns must then be met. This is automatically the case if the device does not stretch the low period of the SCL signal. If such a device does stretch the low period of the SCL signal, it must output the next data bit to the SDA line t_{R(MAX)} + t_{SU:DAT} = 1000 + 250 = 1250ns before the SCL line is released.
- **Note 11:** C_{B}-total capacitance of one bus line in pF.
- **Note 12:** The parameter t_{OSF} is the period of time the oscillator must be stopped for the OSF flag to be set over the voltage range of 0.0V ≤ V_{CC} ≤ V_{CC(MAX)} and 2.3V ≤ V_{BAT} ≤ 3.4V.
- **Note 13:** This delay applies only if the oscillator is enabled and running. If the E̅O̅S̅C̅ bit is a 1, t_{REC} is bypassed and R̅S̅T̅ immedi­ately goes high. The state of R̅S̅T̅ does not affect the I^{2}C interface, RTC, or TCXO.

### Typical Operating Characteristics

(V_{CC} = +3.3V, T_{A} = +25°C, unless otherwise noted.)

![STANDBY SUPPLY CURRENT vs. SUPPLY VOLTAGE](ds3231/figures/ds3231-f012.png)

*STANDBY SUPPLY CURRENT vs. SUPPLY VOLTAGE*

Digitized data: [standby-supply-current-vs-supply-voltage.csv](ds3231/curves/standby-supply-current-vs-supply-voltage.csv) (x: V; y: µA) — values read off the printed plot by the digitizer, not published data.

![SUPPLY CURRENT vs. TEMPERATURE](ds3231/figures/ds3231-f014.png)

*SUPPLY CURRENT vs. TEMPERATURE*

Digitized data: [supply-current-vs-temperature.csv](ds3231/curves/supply-current-vs-temperature.csv) (x: °C; y: µA) — values read off the printed plot by the digitizer, not published data.

![SUPPLY CURRENT vs. SUPPLY VOLTAGE](ds3231/figures/ds3231-f013.png)

*SUPPLY CURRENT vs. SUPPLY VOLTAGE*

Digitized data: [supply-current-vs-supply-voltage.csv](ds3231/curves/supply-current-vs-supply-voltage.csv) (x: V; y: µA) — values read off the printed plot by the digitizer, not published data.

![characteristic curve (p. 7)](ds3231/figures/ds3231-f015.png)

Digitized data: [curve-014.csv](ds3231/curves/curve-014.csv) (x: °C; y: AGING = -128) — values read off the printed plot by the digitizer, not published data.

![DELTA TIME AND FREQUENCY vs. TEMPERATURE](ds3231/figures/ds3231-f016.png)

*DELTA TIME AND FREQUENCY vs. TEMPERATURE*

Digitized data: [delta-time-and-frequency-vs-temperature.csv](ds3231/curves/delta-time-and-frequency-vs-temperature.csv) (x: °C; y: ppm) — values read off the printed plot by the digitizer, not published data.

### Block Diagram

![block diagram (p. 8)](ds3231/figures/ds3231-f006.png)


### Pin Description

**Pin Description** ([table-06-p9-pin.csv](ds3231/tables/table-06-p9-pin.csv), p. 9)

| PIN | NAME | FUNCTION |
|---|---|---|
| 1 | 32kHz | 32kHz Output. This open-drain pin requires an external pullup resistor. When enabled, the output operates on either power supply. It may be left open if not used. |
| 2 | V_{CC} | DC Power Pin for Primary Power Supply. This pin should be decoupled using a 0.1µF to 1.0µF capacitor. If not used, connect to ground. |
| 3 | I̅N̅T̅/SQW | Active-Low Interrupt or Square-Wave Output. This open-drain pin requires an external pullup resistor connected to a supply at 5.5V or less. This multifunction pin is determined by the state of the INTCN bit in the Control Register (0Eh). When INTCN is set to logic 0, this pin outputs a square wave and its frequency is determined by RS2 and RS1 bits. When INTCN is set to logic 1, then a match between the timekeeping registers and either of the alarm registers activates the I̅N̅T̅/SQW pin (if the alarm is enabled). Because the INTCN bit is set to logic 1 when power is first applied, the pin defaults to an interrupt output with alarms disabled. The pullup voltage can be up to 5.5V, regardless of the voltage on V_{CC}. If not used, this pin can be left unconnected. |
| 4 | R̅S̅T̅ | Active-Low Reset. This pin is an open-drain input/output. It indicates the status of V_{CC} relative to the V_{PF} specification. As V_{CC} falls below V_{PF}, the R̅S̅T̅ pin is driven low. When V_{CC} exceeds V_{PF}, for t_{RST}, the R̅S̅T̅ pin is pulled high by the internal pullup resistor. The active-low, open-drain output is combined with a debounced pushbutton input function. This pin can be activated by a pushbutton reset request. It has an internal 50kΩ nominal value pullup resistor to V_{CC}. No external pullup resistors should be connected. If the oscillator is disabled, t_{REC} is bypassed and R̅S̅T̅ immediately goes high. |
| 5–12 | N.C. | No Connection. Must be connected to ground. |
| 13 | GND | Ground |
| 14 | V_{BAT} | Backup Power-Supply Input. When using the device with the V_{BAT} input as the primary power source, this pin should be decoupled using a 0.1µF to 1.0µF low-leakage capacitor. When using the device with the V_{BAT} input as the backup power source, the capacitor is not required. If V_{BAT} is not used, connect to ground. The device is UL recognized to ensure against reverse charging when used with a primary lithium battery. Go to www.maximintegrated.com/qa/info/ul. |
| 15 | SDA | Serial Data Input/Output. This pin is the data input/output for the I^{2}C serial interface. This open-drain pin requires an external pullup resistor. The pullup voltage can be up to 5.5V, regardless of the voltage on V_{CC}. |
| 16 | SCL | Serial Clock Input. This pin is the clock input for the I^{2}C serial interface and is used to synchronize data movement on the serial interface. Up to 5.5V can be used for this pin, regardless of the voltage on V_{CC}. |

### Detailed Description

The  DS3231  is  a  serial  RTC  driven  by  a  temperaturecompensated 32kHz crystal oscillator. The TCXO provides a stable and accurate reference clock, and maintains the RTC to within ±2 minutes per year accuracy from -40°C to +85°C. The TCXO frequency output is available at the 32kHz pin. The RTC is a low-power clock/calendar with two programmable time-of-day alarms and a programmable square-wave output. The I̅N̅T̅/SQW provides either an interrupt signal due to alarm conditions or a square-wave output.  The  clock/calendar  provides  seconds,  minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with  fewer  than  31  days,  including  corrections  for  leap year. The clock operates in either the 24-hour or 12-hour format with an A̅M̅/PM indicator. The internal registers are accessible though an I^{2}C bus interface.

A  temperature-compensated  voltage  reference  and  comparator circuit monitors the level of V_{CC} to detect power failures and to automatically switch to the backup supply when necessary. The R̅S̅T̅ pin  provides  an  external  pushbutton function and acts as an indicator of a power-fail event.

### Operation

The  block  diagram  shows  the  main  elements  of  the DS3231. The eight blocks can be grouped into four functional groups: TCXO, power control, pushbutton function, and RTC. Their operations are described separately in the following sections.

### 32kHz TCXO

The temperature sensor, oscillator, and control logic form the TCXO. The controller reads the output of the on-chip temperature sensor and uses a lookup table to determine the  capacitance  required,  adds  the  aging  correction  in AGE register, and then sets the capacitance selection registers. New values, including changes to the AGE register, are loaded only when a change in the temperature value occurs,  or  when  a  user-initiated  temperature  conversion is  completed.  Temperature  conversion  occurs  on  initial application of V_{CC} and once every 64 seconds afterwards.

### Power Control

This function is provided by a temperature-compensated voltage reference and a comparator circuit that monitors the V_{CC} level. When V_{CC} is greater than V_{PF} , the part is powered by V_{CC} . When V_{CC} is less than V_{PF} but greater than V_{BAT} , the DS3231 is powered by V_{CC} . If V_{CC} is less than V_{PF} and is less than V_{BAT} , the device is powered by V_{BAT}. See Table 1.

### Table 1. Power Control

**Table 1. Power Control** ([table-07-p10-data.csv](ds3231/tables/table-07-p10-data.csv), p. 10)

| SUPPLY CONDITION | ACTIVE SUPPLY |
|---|---|
| V_{CC} < V_{PF}, V_{CC} < V_{BAT} | V_{BAT} |
| V_{CC} < V_{PF}, V_{CC} > V_{BAT} | V_{CC} |
| V_{CC} > V_{PF}, V_{CC} < V_{BAT} | V_{CC} |
| V_{CC} > V_{PF}, V_{CC} > V_{BAT} | V_{CC} |

To  preserve  the  battery,  the  first  time  V_{BAT} is  applied to  the  device,  the  oscillator  will  not  start  up  until  V_{CC} exceeds  V_{PF} ,  or  until  a  valid  I^{2}C  address  is  written  to the  part.  Typical  oscillator  startup  time  is  less  than  one second. Approximately  2  seconds  after  V_{CC} is  applied, or  a  valid  I^{2}C  address  is  written,  the  device  makes  a temperature  measurement  and  applies  the  calculated correction to the oscillator. Once the oscillator is running, it continues to run as long as a valid power source is available (V_{CC} or V_{BAT} ), and the device continues to measure the temperature and correct the oscillator frequency every 64 seconds.

On the first application of power (V_{CC} ) or when a valid I^{2}C address is written to the part (V_{BAT} ), the time and date registers are reset to 01/01/00 01 00:00:00 (DD/MM/YY DOW HH:MM:SS).

### V_{BAT} Operation

There are several modes of operation that affect the amount of V_{BAT} current that is drawn. While the device is  powered  by  V_{BAT} and  the  serial  interface  is  active, active  battery  current,  I_{BATA} ,  is  drawn.  When  the  serial interface is inactive, timekeeping  current  (I_{BATT} ), which  includes  the  averaged  temperature  conversion current, I_{BATTC} , is used (refer to Application Note 3644: Power  Considerations  for  Accurate  Real-Time  Clocks for  details).  Temperature  conversion  current,  I_{BATTC} ,  is specified  since  the  system  must  be  able  to  support  the periodic higher current pulse and still maintain a valid voltage level. Data retention current, I_{BATTDR} , is the current drawn by the part when the oscillator is stopped ( E̅O̅S̅C̅ = 1). This mode can be used to minimize battery requirements for times when maintaining time and date information is not necessary, e.g., while the end system is waiting to be shipped to a customer.

### Pushbutton Reset Function

The DS3231 provides for a pushbutton switch to be connected to the R̅S̅T̅ output pin. When the DS3231 is not in a reset cycle, it continuously monitors the R̅S̅T̅ signal for a  low  going  edge.  If  an  edge  transition  is  detected,  the DS3231 debounces the  switch  by  pulling  the R̅S̅T̅ low. After the internal timer has expired (PB_{DB} ), the DS3231 continues to monitor the R̅S̅T̅ line.  If  the  line  is  still  low, the DS3231 continuously monitors the line looking for a rising edge. Upon detecting release, the DS3231 forces the R̅S̅T̅ pin low and holds it low for t_{RST} .

R̅S̅T̅ is also used to indicate a power-fail condition. When V_{CC}  is  lower  than  V_{PF} ,  an  internal  power-fail  signal  is generated,  which  forces  the R̅S̅T̅ pin  low.  When  V_{CC} returns to a level above V_{PF} , the R̅S̅T̅ pin is held low for approximately  250ms  (t_{REC} )  to  allow  the  power  supply to stabilize. If the oscillator is not running (see the Power Control section) when V_{CC} is applied, t_{REC} is bypassed and R̅S̅T̅ immediately  goes  high. Assertion  of  the R̅S̅T̅ output,  whether  by  pushbutton  or  power-fail  detection, does not affect the internal operation of the DS3231.

### Real-Time Clock

With the clock source from the TCXO, the RTC provides seconds,  minutes,  hours,  day,  date,  month,  and  year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an A̅M̅/PM indicator.

The clock provides two programmable time-of-day alarms and a programmable square-wave output. The I̅N̅T̅/SQW pin  either  generates  an  interrupt  due  to  alarm  condition or outputs a square-wave signal and the selection is controlled by the bit INTCN.

![Figure 1. Timekeeping Registers](ds3231/figures/ds3231-fig001.png)

*Figure 1. Timekeeping Registers*

 - **Note**: Unless otherwise specified, the registers’ state is not defined when power is first applied.

### Address Map

Figure  1  shows  the  address  map  for  the  DS3231  timekeeping  registers.  During  a  multibyte  access,  when  the address  pointer  reaches  the  end  of  the  register  space (12h), it wraps around to location 00h. On an I^{2}C START or address pointer incrementing to location 00h, the current time is transferred to a second set of registers. The time information is read from these secondary registers, while the clock may continue to run. This eliminates the need to  reread  the  registers  in  case  the  main  registers update during a read.

### I^{2}C Interface

The I^{2}C  interface  is  accessible  whenever either V_{CC} or V_{BAT}  is  at  a  valid  level.  If  a  microcontroller  connected to the DS3231 resets because of a loss of V_{CC} or other event, it is possible that the microcontroller and DS3231 I^{2}C communications could become unsynchronized, e.g., the  microcontroller  resets  while  reading  data  from  the DS3231.  When  the  microcontroller  resets,  the  DS3231 I^{2}C  interface  may  be  placed  into  a  known  state  by  toggling SCL until SDA is observed to be at a high level. At that  point  the  microcontroller  should  pull  SDA  low  while SCL is high, generating a START condition.

### Clock and Calendar

The time and calendar information is obtained by reading the appropriate register bytes. Figure 1 illustrates the RTC registers. The time and calendar data are set or initialized by writing the appropriate register bytes. The contents of the  time  and  calendar  registers  are  in  the  binary-coded decimal (BCD) format. The DS3231 can be run in either 12-hour  or  24-hour  mode.  Bit  6  of  the  hours  register  is defined as the 12- or 24-hour mode select bit. When high, the 12-hour mode is selected. In the 12-hour mode, bit 5 is the A̅M̅/PM bit with logic-high being PM. In the 24-hour mode, bit 5 is the 20-hour bit (20-23 hours). The century bit (bit 7 of the month register) is toggled when the years register overflows from 99 to 00.

The day-of-week register increments at midnight. Values that correspond to the day of week are user-defined but must be sequential (i.e., if 1 equals Sunday, then 2 equals Monday, and so on). Illogical time and date entries result in undefined operation.

When reading or writing the time and date registers, secondary (user) buffers are used to prevent errors when the internal registers update. When reading the time and date registers, the user buffers are synchronized to the internal registers  on  any  START  and  when  the  register  pointer rolls over to zero. The time information is read from these secondary registers, while the clock continues to run. This eliminates  the  need  to  reread  the  registers  in  case  the main registers update during a read.

The  countdown  chain  is  reset  whenever  the  seconds register is written. Write transfers occur on the acknowledge  from  the  DS3231.  Once  the  countdown  chain  is reset,  to  avoid  rollover  issues  the  remaining  time  and date registers must be written within 1 second. The 1Hz square-wave  output,  if  enabled,  transitions  high  500ms after the seconds data transfer, provided the oscillator is already running.

### Alarms

The  DS3231  contains  two  time-of-day/date  alarms. Alarm 1 can be set by writing to registers 07h to 0Ah. Alarm 2 can be set by writing to registers 0Bh to 0Dh. The alarms can be programmed (by the alarm enable and  INTCN  bits  of  the  control  register)  to  activate  the I̅N̅T̅/SQW output on an alarm match condition. Bit 7 of each  of  the  time-of-day/date  alarm  registers  are  mask bits  (Table  2).  When  all  the  mask  bits  for  each  alarm are  logic  0,  an  alarm  only  occurs  when  the  values  in the timekeeping registers match the corresponding values stored in the time-of-day/date alarm registers. The alarms can also be programmed to repeat every second, minute, hour, day, or date. Table 2 shows the possible settings. Configurations not listed in the table will result in illogical operation.

The  DY/D̅T̅ bits  (bit  6  of  the  alarm  day/date  registers) control  whether  the  alarm  value  stored  in  bits  0  to  5  of that  register  reflects  the  day  of  the  week  or  the  date  of the month. If DY/D̅T̅ is written to logic 0, the alarm will be the result of a match with date of the month. If DY/D̅T̅ is written to logic 1, the alarm will be the result of a match with day of the week.

When the RTC register values match alarm register settings, the corresponding Alarm Flag 'A1F' or 'A2F' bit is set to logic 1. If the corresponding Alarm Interrupt Enable 'A1IE' or 'A2IE' is also set to logic 1 and the INTCN bit is  set  to  logic  1,  the  alarm  condition  will  activate  the I̅N̅T̅/SQW signal. The  match  is  tested  on  the  once-persecond update of the time and date registers.




### Table 2. Alarm Mask Bits

**Table 2. Alarm Mask Bits** ([table-08-p12-register.csv](ds3231/tables/table-08-p12-register.csv), p. 12)

| DY/D̅T̅ | A1M4 | A1M3 | A1M2 | A1M1 | ALARM RATE |
|---|---|---|---|---|---|
| **ALARM 1 REGISTER MASK BITS (BIT 7)** |  |  |  |  |  |
| X | 1 | 1 | 1 | 1 | Alarm once per second |
| X | 1 | 1 | 1 | 0 | Alarm when seconds match |
| X | 1 | 1 | 0 | 0 | Alarm when minutes and seconds match |
| X | 1 | 0 | 0 | 0 | Alarm when hours, minutes, and seconds match |
| 0 | 0 | 0 | 0 | 0 | Alarm when date, hours, minutes, and seconds match |
| 1 | 0 | 0 | 0 | 0 | Alarm when day, hours, minutes, and seconds match |
| **ALARM 2 REGISTER MASK BITS (BIT 7)** |  |  |  |  |  |
| X | 1 | 1 | 1 |  | Alarm once per minute (00 seconds of every minute) |
| X | 1 | 1 | 0 |  | Alarm when minutes match |
| X | 1 | 0 | 0 |  | Alarm when hours and minutes match |
| 0 | 0 | 0 | 0 |  | Alarm when date, hours, and minutes match |
| 1 | 0 | 0 | 0 |  | Alarm when day, hours, and minutes match |



### Control Register (0Eh)

**Control Register (0Eh)** ([table-09-p13-register.csv](ds3231/tables/table-09-p13-register.csv), p. 13)

|  | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 |
|---|---|---|---|---|---|---|---|---|
| NAME: | E̅O̅S̅C̅ | BBSQW | CONV | RS2 | RS1 | INTCN | A2IE | A1IE |
| POR: | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |

### Special-Purpose Registers

The DS3231 has two additional registers (control and status) that control the real-time clock, alarms, and squarewave output.

### Control Register (0Eh)

Bit  7:  Enable  Oscillator  ( E̅O̅S̅C̅ ). When set to logic  0, the oscillator is started. When set to logic 1, the oscillator is  stopped when the DS3231 switches to V_{BAT} . This bit is  clear  (logic  0)  when  power  is  first  applied.  When  the DS3231 is powered by V_{CC} , the oscillator is always on regardless of the status of the E̅O̅S̅C̅ bit. When E̅O̅S̅C̅ is disabled, all register data is static.

Bit 6: Battery-Backed Square-Wave Enable (BBSQW). When set to logic 1 with INTCN = 0 and V_{CC} < V_{PF} , this bit  enables  the  square  wave.  When  BBSQW is logic  0, the I̅N̅T̅/SQW pin goes high impedance when V_{CC} < V_{PF} . This bit is disabled (logic 0) when power is first applied.

Bit 5: Convert Temperature (CONV). Setting this bit to 1 forces the temperature sensor to convert the temperature into digital code and execute the TCXO algorithm to update the capacitance array to the oscillator. This  can only  happen  when  a  conversion  is  not  already  in  progress.  The  user  should  check  the  status  bit  BSY  before forcing  the  controller  to  start  a  new  TCXO  execution. A user-initiated temperature conversion does not affect the internal 64-second update cycle.

A  user-initiated  temperature  conversion  does  not  affect the BSY bit for approximately 2ms. The CONV bit remains at  a  1  from  the  time  it  is  written  until  the  conversion  is finished, at which time both CONV and BSY go to 0. The CONV bit should be used when monitoring the status of a user-initiated conversion.

Bits  4  and  3:  Rate  Select  (RS2  and  RS1). These  bits control  the  frequency  of  the  square-wave  output  when the square wave has been enabled. The following table shows the square-wave frequencies that can be selected with  the  RS  bits.  These  bits  are  both  set  to  logic  1 (8.192kHz) when power is first applied.

### SQUARE-WAVE OUTPUT FREQUENCY

**SQUARE-WAVE OUTPUT FREQUENCY** ([table-10-p13-data.csv](ds3231/tables/table-10-p13-data.csv), p. 13)

| RS2 | RS1 | SQUARE-WAVE OUTPUT FREQUENCY |
|---|---|---|
| 0 | 0 | 1Hz |
| 0 | 1 | 1.024kHz |
| 1 | 0 | 4.096kHz |
| 1 | 1 | 8.192kHz |

Bit  2:  Interrupt  Control  (INTCN). This  bit  controls  the I̅N̅T̅/SQW signal. When the INTCN bit is set to logic 0, a square wave is output on the I̅N̅T̅/SQW pin. When the INTCN bit is set to logic 1, then a match between the timekeeping registers  and  either  of  the  alarm  registers  activates the I̅N̅T̅/SQW output (if the alarm is also enabled). The corresponding alarm flag is always set regardless of the state of the INTCN bit. The INTCN bit is set to logic 1 when power is first applied.

Bit  1:  Alarm  2  Interrupt  Enable  (A2IE). When  set  to logic 1, this bit permits the alarm 2 flag (A2F) bit in the status  register  to  assert I̅N̅T̅/SQW (when  INTCN  =  1). When the A2IE bit is set to logic 0 or INTCN is set to logic 0,  the A2F  bit  does  not  initiate  an  interrupt  signal.  The A2IE bit is disabled (logic 0) when power is first applied.

Bit  0:  Alarm  1  Interrupt  Enable  (A1IE). When  set  to logic 1, this bit permits the alarm 1 flag (A1F) bit in the status  register  to  assert I̅N̅T̅/SQW (when  INTCN  =  1). When the A1IE bit is set to logic 0 or INTCN is set to logic 0, the A1F bit does not initiate the I̅N̅T̅/SQW signal. The A1IE bit is disabled (logic 0) when power is first applied.

### Status Register (0Fh)

**Status Register (0Fh)** ([table-11-p14-register.csv](ds3231/tables/table-11-p14-register.csv), p. 14)

|  | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 |
|---|---|---|---|---|---|---|---|---|
| NAME: | OSF | 0 | 0 | 0 | EN32kHz | BSY | A2F | A1F |
| POR: | 1 | 0 | 0 | 0 | 1 | X | X | X |

### Status Register (0Fh)

Bit 7: Oscillator Stop Flag (OSF). A logic 1 in this bit indicates that the oscillator either is stopped or was stopped for some period and may be used to judge the validity of the timekeeping data. This bit is set to logic 1 any time that  the  oscillator  stops.  The  following  are  examples  of conditions that can cause the OSF bit to be set:

1)  The first time power is applied.
2)  The voltages present on both V_{CC} and V_{BAT} are insufficient to support oscillation.
3)  The E̅O̅S̅C̅ bit is turned off in battery-backed mode.
4)  External influences on the crystal (i.e., noise, leakage, etc.).

This bit remains at logic 1 until written to logic 0.

Bit  3:  Enable  32kHz  Output  (EN32kHz). This  bit  controls the status of the 32kHz pin. When set to logic 1, the 32kHz pin is enabled and outputs a 32.768kHz squarewave signal. When set to logic 0, the 32kHz pin goes to a high-impedance state. The initial power-up state of this bit is logic 1, and a 32.768kHz square-wave signal appears at  the  32kHz pin after a power source is applied to the DS3231 (if the oscillator is running).

Bit  2:  Busy  (BSY). This  bit  indicates  the  device  is  busy executing TCXO functions. It goes to logic 1 when the conversion  signal  to  the  temperature  sensor  is  asserted  and then is cleared when the device is in the 1-minute idle state.

Bit 1: Alarm 2 Flag (A2F). A logic 1 in the alarm 2 flag bit indicates that the time matched the alarm 2 registers. If the A2IE bit is logic 1 and the INTCN bit is set to logic 1, the I̅N̅T̅/SQW pin is also asserted. A2F is cleared when written to logic 0. This bit can only be written to logic 0. Attempting to write to logic 1 leaves the value unchanged.

Bit 0: Alarm 1 Flag (A1F). A logic 1 in the alarm 1 flag bit indicates that the time matched the alarm 1 registers. If the A1IE bit is logic 1 and the INTCN bit is set to logic 1, the I̅N̅T̅/SQW pin is also asserted. A1F is cleared when written to logic 0. This bit can only be written to logic 0. Attempting to write to logic 1 leaves the value unchanged.

### Aging Offset

The aging offset register takes a user-provided value to add to or subtract from the codes in the capacitance array registers. The code is encoded in two's complement, with bit 7 representing the sign bit. One LSB represents one small capacitor to be switched in or out of the capacitance array at the crystal pins. The aging offset register capacitance value is added or subtracted from the capacitance value  that  the  device  calculates  for  each  temperature compensation. The offset register is added to the capacitance  array  during  a  normal  temperature  conversion,  if the temperature changes from the previous conversion, or during a manual user conversion (setting the CONV bit). To see the effects of the aging register on the 32kHz output frequency immediately, a manual conversion should be started after each aging register change.

Positive aging values add capacitance to the array, slowing  the  oscillator  frequency.  Negative  values  remove capacitance  from  the  array,  increasing  the  oscillator frequency.

The change in ppm per LSB is different at different temperatures. The frequency vs. temperature curve is shifted by  the  values  used  in  this  register. At  +25°C,  one  LSB typically provides about 0.1ppm change in frequency.

Use  of  the  aging  register  is  not  needed  to  achieve  the accuracy as defined in the EC tables, but could be used to  help  compensate  for  aging  at  a  given  temperature. See  the Typical  Operating  Characteristics section  for  a graph showing the effect of the register on accuracy over temperature.

### Aging Offset (10h)

**Aging Offset (10h)** — [table-12-p14-register.csv](ds3231/tables/table-12-p14-register.csv), p. 14


|       | BIT 7   | BIT 6   | BIT 5   | BIT 4   | BIT 3   | BIT 2   | BIT 1   | BIT 0   |
|-------|---------|---------|---------|---------|---------|---------|---------|---------|
| NAME: | Sign    | Data    | Data    | Data    | Data    | Data    | Data    | Data    |
| POR:  | 0       | 0       | 0       | 0       | 0       | 0       | 0       | 0       |



### Temperature Register (Upper Byte) (11h)

**Temperature Register (Upper Byte) (11h)** ([table-13-p15-register.csv](ds3231/tables/table-13-p15-register.csv), p. 15)

|  | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 |
|---|---|---|---|---|---|---|---|---|
| NAME: | Sign | Data | Data | Data | Data | Data | Data | Data |
| POR: | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

### Temperature Register (Lower Byte) (12h)

**Temperature Register (Lower Byte) (12h)** ([table-14-p15-register.csv](ds3231/tables/table-14-p15-register.csv), p. 15)

|  | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0 |
|---|---|---|---|---|---|---|---|---|
| NAME: | Data | Data | 0 | 0 | 0 | 0 | 0 | 0 |
| POR: | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

### Temperature Registers (11h-12h)

Temperature  is  represented  as  a  10-bit  code  with  a resolution of 0.25°C and is accessible at location 11h and 12h.  The  temperature  is  encoded  in  two's  complement format. The upper 8 bits, the integer portion, are at location 11h and the lower 2 bits, the fractional portion, are in the upper nibble at location 12h. For example, 00011001 01b = +25.25°C. Upon power reset, the registers are set to a default temperature of 0°C and the controller starts a  temperature  conversion.  The  temperature  is  read  on initial application of V_{CC} or I^{2}C access on V_{BAT} and once every 64 seconds afterwards. The temperature registers are updated after each user-initiated conversion and on every  64-second  conversion.  The  temperature  registers are read-only.

### I^{2}C Serial Data Bus

The  DS3231  supports  a  bidirectional  I^{2}C  bus  and  data transmission protocol. A device that sends data onto the bus is defined as a transmitter and a device receiving data is defined as a receiver. The device that controls the message is called a master. The devices that are controlled by the master are slaves. The bus must be controlled by a  master  device  that  generates  the  serial  clock  (SCL), controls the bus access, and generates the START and STOP conditions. The DS3231 operates as a slave on the I^{2}C  bus.  Connections  to  the  bus  are  made  through  the SCL input and open-drain SDA I/O lines. Within the bus specifications, a standard mode (100kHz maximum clock rate) and a fast mode (400kHz maximum clock rate) are defined. The DS3231 works in both modes.

The following bus protocol has been defined (Figure 2):

- Data transfer may be initiated only when the bus is not busy.
- During data transfer, the data line must remain stable whenever the clock line is high. Changes in the data line while the clock line is high are interpreted as control signals.

Accordingly,  the  following  bus  conditions  have  been defined:

**Bus not busy:** Both data and clock lines remain high.

**START data  transfer:** A  change  in  the  state  of  the data line from high to low, while the clock line is high, defines a START condition.

**STOP  data  transfer:** A  change  in  the  state  of  the data line from low to high, while the clock line is high, defines a STOP condition.

**Data valid:** The state of the data line represents valid data when, after a START condition, the data line is stable for the duration of the high period of the clock signal. The data on the line must be changed during the low period of the clock signal. There is one clock pulse per bit of data.

Each data transfer is initiated with a START condition and  terminated  with  a  STOP  condition.  The  number of data bytes transferred between the START and the STOP conditions is not limited, and is determined by the master device. The information is transferred bytewise and each receiver acknowledges with a ninth bit.

**Acknowledge:** Each receiving device, when addressed,  is  obliged  to  generate  an  acknowledge after  the  reception  of  each  byte.  The  master  device must generate an extra clock pulse, which is associated with this acknowledge bit.

A device that acknowledges must pull down the SDA line during the acknowledge clock pulse in such a way that the SDA line is stable low during the high period of the acknowledge-related clock pulse. Of course, setup and hold times must be taken into account. A master must signal an end of data to the slave by not generating an acknowledge bit on the last byte that has been clocked out of the slave. In this case, the slave must leave the data line high to enable the master to generate the STOP condition.

![Figure 2. I^{2}C Data Transfer Overview](ds3231/figures/ds3231-f007.png)

*Figure 2. I^{2}C Data Transfer Overview*

Figures 3 and 4 detail how data transfer is accomplished on the I^{2}C bus. Depending upon the state of the R/W̅ bit, two types of data transfer are possible:

**Data transfer from a master transmitter to a slave receiver.** The  first  byte  transmitted  by  the  master is  the  slave  address.  Next  follows  a  number  of  data bytes. The slave returns an acknowledge bit after each received byte. Data is transferred with the most significant bit (MSB) first.

**Data transfer from a slave transmitter to a master receiver.** The first byte (the slave address) is transmitted by the master. The slave then returns an acknowledge bit. Next follows a number of data bytes transmitted by the slave to the master. The master returns an acknowledge bit after all received bytes other than the

![Figure 3. Data Write-Slave Receiver Mode](ds3231/figures/ds3231-f008.png)

*Figure 3. Data Write-Slave Receiver Mode*

![Figure 4. Data Read-Slave Transmitter Mode](ds3231/figures/ds3231-f009.png)

*Figure 4. Data Read-Slave Transmitter Mode*

![Figure 5. Data Write/Read (Write Pointer, Then Read)-Slave Receive and Transmit](ds3231/figures/ds3231-f010.png)

*Figure 5. Data Write/Read (Write Pointer, Then Read)-Slave Receive and Transmit*

last  byte. At  the  end  of  the  last  received  byte,  a  not acknowledge is returned.

The master device generates all the serial clock pulses and  the  START  and  STOP  conditions.  A  transfer is  ended  with  a  STOP  condition  or  with  a  repeated START condition. Since a repeated START condition is also the beginning of the next serial transfer, the bus will not be released. Data is transferred with the most significant bit (MSB) first.

The DS3231 can operate in the following two modes:

**Slave  receiver  mode  (DS3231  write  mode):** Serial data  and  clock  are  received  through  SDA  and  SCL. After  each  byte  is  received,  an  acknowledge  bit  is transmitted. START and STOP conditions are recognized  as  the  beginning  and  end  of  a  serial  transfer. Address  recognition  is  performed  by  hardware  after reception of the slave address and direction bit. The slave address byte is the first byte received after the master  generates  the  START  condition.  The  slave address  byte  contains  the  7-bit  DS3231  address, which is 1101000, followed by the direction bit (R/W̅ ), which is 0 for a write. After receiving and decoding the slave address byte, the DS3231 outputs an acknowledge  on  SDA.  After  the  DS3231  acknowledges  the slave address + write bit, the master transmits a word address to the DS3231. This sets the register pointer on the DS3231, with the DS3231 acknowledging the transfer. The master may then transmit zero or more bytes of  data,  with  the  DS3231  acknowledging  each byte  received.  The  register  pointer  increments  after each data byte is transferred. The master generates a STOP condition to terminate the data write.

**Slave transmitter mode (DS3231 read mode):** The first  byte  is  received  and  handled  as  in  the  slave receiver  mode.  However,  in  this  mode,  the  direction bit  indicates  that  the  transfer  direction  is  reversed. Serial data is transmitted on SDA by the DS3231 while the  serial  clock  is  input  on  SCL.  START  and  STOP conditions  are  recognized  as  the  beginning  and  end of a serial transfer. Address recognition is performed by hardware after reception of the slave address and direction  bit.  The  slave  address  byte  is  the  first  byte received after the master generates a START condition. The slave address byte contains the 7-bit DS3231 address, which is 1101000, followed by the direction bit  (R/W̅ ),  which  is  1  for  a  read. After  receiving  and decoding the slave address byte, the DS3231 outputs an acknowledge on SDA. The DS3231 then begins to transmit data starting with the register address pointed to by the register pointer. If the register pointer is not written to before the initiation of a read mode, the first address that is read is the last one stored in the register pointer. The DS3231 must receive a not acknowledge to end a read.

### Handling, PCB Layout, and Assembly

The  DS3231  package  contains  a  quartz  tuning-fork crystal.  Pick-and-place  equipment  can  be  used,  but precautions should be taken to ensure that excessive  shocks  are  avoided.  Ultrasonic  cleaning  should  be avoided to prevent damage to the crystal.

Avoid running signal traces under the package, unless a ground plane is placed between the package and the signal line. All N.C. (no connect) pins must be connected to ground.

Moisture-sensitive packages are shipped from the factory  dry  packed.  Handling  instructions  listed  on  the package label must be followed to prevent damage during reflow. Refer to the IPC/JEDEC J-STD-020 standard for moisture-sensitive device (MSD) classifications and reflow profiles. Exposure to reflow is limited to 2 times maximum.

### Pin Configuration

![pinout (p. 18)](ds3231/figures/ds3231-f011.png)

### Chip Information

SUBSTRATE CONNECTED TO GROUND PROCESS: CMOS

### Ordering Information

**Ordering Information** ([table-15-p18-data.csv](ds3231/tables/table-15-p18-data.csv), p. 18)

| PART | TEMP RANGE | PIN-PACKAGE |
|---|---|---|
| DS3231S# | 0°C to +70°C | 16 SO |
| DS3231SN# | -40°C to +85°C | 16 SO |

- #: Denotes an RoHS-compliant device that may include lead (Pb) that is exempt under RoHS requirements. The lead finish is JESD97 category e3, and is compatible with both lead-based and lead-free soldering processes. A "#" anywhere on the top mark denotes an RoHS-compliant device.

### Package Information

For  the  latest  package  outline  information  and  land  patterns (footprints), go to www.maximintegrated.com/packages . Note that a "+", "#", or "-" in the package code indicates RoHS status only. Package drawings may show a different suffix character, but the drawing pertains to the package regardless of RoHS status.

**Package Information** ([table-16-p18-data.csv](ds3231/tables/table-16-p18-data.csv), p. 18)

| PACKAGE TYPE | PACKAGE CODE | OUTLINE NO. | LAND PATTERN NO. |
|---|---|---|---|
| 16 SO | W16#H2 | 21-0042 | 90-0107 |

### Revision History

**Revision History** ([table-17-p19-data.csv](ds3231/tables/table-17-p19-data.csv), p. 19)

| REVISION NUMBER | REVISION DATE | DESCRIPTION | PAGES CHANGED |
|---|---|---|---|
| 0 | 1/05 | Initial release. | — |
| 1 | 2/05 | Changed Digital Temp Sensor Output from ±2°C to ±3°C. | 1, 3 |
| 1 | 2/05 | Updated Typical Operating Circuit. | 1 |
| 1 | 2/05 | Changed T_{A} = -40°C to +85°C to T_{A} = T_{MIN} to T_{MAX}. | 2, 3, 4 |
| 1 | 2/05 | Updated Block Diagram. | 8 |
| 2 | 6/05 | Added "UL Recognized" to Features; added lead-free packages and removed S from top mark info in Ordering Information table; added ground connections to the N.C. pin in the Typical Operating Circuit. | 1 |
| 2 | 6/05 | Added "noncondensing" to operating temperature range; changed V_{PF} MIN from 2.35V to 2.45V. | 2 |
| 2 | 6/05 | Added aging offset specification. | 3 |
| 2 | 6/05 | Relabeled TOC4. | 7 |
| 2 | 6/05 | Added arrow showing input on X1 in the Block Diagram. | 8 |
| 2 | 6/05 | Updated pin descriptions for V_{CC} and V_{BAT}. | 9 |
| 2 | 6/05 | Added the I^{2}C Interface section. | 10 |
| 2 | 6/05 | Figure 1: Added sign bit to aging and temperature registers; added MSB and LSB. | 11 |
| 2 | 6/05 | Corrected title for rate select bits frequency table. | 13 |
| 2 | 6/05 | Added note that frequency stability over temperature spec is with aging offset register = 00h; changed bit 7 from Data to Sign (Crystal Aging Offset Register). | 14 |
| 2 | 6/05 | Changed bit 7 from Data to Sign (Temperature Register); correct pin definitions in I^{2}C Serial Data Bus section. | 15 |
| 2 | 6/05 | Modified the Handing, PC Board Layout, and Assembly section to refer to J-STD-020 for reflow profiles for lead-free and leaded packages. | 17 |
| 3 | 11/05 | Changed lead-free packages to RoHS-compliant packages. | 1 |
| 4 | 10/06 | Changed R̅S̅T̅ and UL bullets in Features. | 1 |
| 4 | 10/06 | Changed EC condition "V_{CC} > V_{BAT}" to "V_{CC} = Active Supply (see Table 1)." | 2, 3 |
| 4 | 10/06 | Modified Note 12 to correct t_{REC} operation. | 6 |
| 4 | 10/06 | Added various conditions text to TOCs 1, 2, and 3. | 7 |
| 4 | 10/06 | Added text to pin descriptions for 32kHz, V_{CC}, and R̅S̅T̅. | 9 |
| 4 | 10/06 | Table 1: Changed column heading "Powered By" to "Active Supply"; changed "applied" to "exceeds V_{PF}" in the Power Control section. | 10 |
| 4 | 10/06 | Indicated BBSQW applies to both SQW and interrupts; simplified temp convert description (bit 5); added "output" to I̅N̅T̅/SQW (bit 2). | 13 |
| 4 | 10/06 | Changed the Crystal Aging section to the Aging Offset section; changed "this bit indicates" to "this bit controls" for the enable 32kHz output bit. | 14 |
| 5 | 4/08 | Added Warning note to EC table notes; updated Note 12. | 6 |
| 5 | 4/08 | Updated the Typical Operating Characteristics graphs. | 7 |
| 5 | 4/08 | In the Power Control section, added information about the POR state of the time and date registers; in the Real-Time Clock section, added to the description of the R̅S̅T̅ function. | 10 |
| 5 | 4/08 | In Figure 1, corrected the months date range for 04h from 00–31 to 01–31. | 11 |
| 6 | 10/08 | Updated the Typical Operating Circuit. | 1 |
| 6 | 10/08 | Removed the V_{PU} parameter from the Recommended DC Operating Conditions table and added verbiage about the pullup to the Pin Description table for I̅N̅T̅/SQW, SDA, and SCL. | 2, 9 |
| 6 | 10/08 | Added the Delta Time and Frequency vs. Temperature graph in the Typical Operating Characteristics section. | 7 |
| 6 | 10/08 | Updated the Block Diagram. | 8 |
| 6 | 10/08 | Added the V_{BAT} Operation section, improved some sections of text for the 32kHz TCXO and Pushbutton Reset Function sections. | 10 |
| 6 | 10/08 | Added the register bit POR values to the register tables. | 13, 14, 15 |
| 6 | 10/08 | Updated the Aging Offset and Temperature Registers (11h–12h) sections. | 14, 15 |
| 6 | 10/08 | Updated the I^{2}C timing diagrams (Figures 3, 4, and 5). | 16, 17 |
| 7 | 3/10 | Removed the “S” from the top mark in the Ordering Information table and the Pin Configuration to match the packaging engineering marking specification. | 1, 18 |
| 8 | 7/10 | Updated the Typical Operating Circuit; removed the “Top Mark” column from the Ordering Information; in the Absolute Maximum Ratings section, added the theta-JA and theta-JC thermal resistances and Note 1, and changed the soldering temperature to +260°C (lead(Pb)-free) and +240°C (leaded); updated the functional description of the V_{BAT} pin in the Pin Description; changed the timekeeping registers 02h, 09h, and 0Ch to “20 Hour” in Bit 5 of Figure 1; updated the BBSQW bit description in the Control Register (0Eh) section; added the land pattern no. to the Package Information table. | 1, 2, 3, 4, 6, 9, 11, 12, 13, 18 |
| 9 | 1/13 | Updated Absolute Maximum Ratings, and last paragraph in Power Control section | 2, 10 |
| 10 | 3/15 | Revised Benefits and Features section. | 1 |
