---
name: "ds1307"
section: "4"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/ds1307"
---

# ds1307(4)

64 x 8, serial, i2c real-time clock (RTC)

## NAME

**ds1307** – 64 x 8, serial, i2c real-time clock (RTC)

## SYNOPSIS

**device iic** **device iicbus** **device ds1307**

## DESCRIPTION

The **ds1307** serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM.

The **ds1307** has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. Timekeeping operation continues while the part operates from the backup supply.

Access to **ds1307** settings is made with the [sysctl(8)](/sysctl/8.md) interface:

```
dev.ds1307.0.%desc: Maxim DS1307 RTC
dev.ds1307.0.%driver: ds1307
dev.ds1307.0.%location: addr=0xd0
dev.ds1307.0.%pnpinfo: name=rtc compat=maxim,ds1307
dev.ds1307.0.%parent: iicbus1
dev.ds1307.0.sqwe: 1
dev.ds1307.0.sqw_freq: 32768
dev.ds1307.0.sqw_out: 0
```

- *dev.ds1307.%d.sqwe*

  If set to 1, the SQW pin drives a square-wave of *dev.ds1307.%d.sqw\_freq* frequency. If set to 0, the output level of SQW pin is controlled by *dev.ds1307.%d.sqw\_out*.

- *dev.ds1307.%d.sqw\_freq*

  Select the frequency of the SQW pin when the square-wave output is enabled on *dev.ds1307.%d.sqwe*. It can be set to 1, 4096, 8192 and 32768.

- *dev.ds1307.%d.sqw\_out*

  Set the output level of the SQW pin when *dev.ds1307.%d.sqwe* is set to 0.

Please check the **ds1307** datasheet for more details.

On a [device.hints(5)](/device.hints/5.md) based system, such as MIPS, these values are configurable for **ds1307**:

- *hint.ds1307.%d.at*

  The [iicbus(4)](/iicbus/4.md) that the **ds1307** is connected to.

- *hint.ds1307.%d.addr*

  The i2c address of **ds1307**.

On a [FDT(4)](/FDT/4.md) based system the following properties must be set:

- *compatible*

  Must always be set to "dallas,ds1307" or "maxim,ds1307".

- *reg*

  The i2c address of **ds1307**. The default address for **ds1307** is 0xd0.

## SEE ALSO

[fdt(4)](/fdt/4.md), [iic(4)](/iic/4.md), [iicbus(4)](/iicbus/4.md), [sysctl(8)](/sysctl/8.md)

## HISTORY

The **ds1307** driver first appeared in FreeBSD 11.0.

## AUTHORS

The **ds1307** driver and this manual page were written by Luiz Otavio O Souza ⟨*loos@FreeBSD.org*⟩.
