DS1307(4)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1, nixpkgs unstable

πŸ’– DS1307(4) β€” the Kernel Interfaces Manual, bestie edition πŸ’–

okay so you picked up the DS1307(4) page, which means we're talking about the Kernel Interfaces Manual today. buckle up πŸŽ€


✨ NAME ✨

ds1307 β€” it's a 64 x 8, serial, i2c real-time clock (RTC) πŸ’…


🌸 SYNOPSIS 🌸

so to get this situation going you literally just need these three lines in your kernel config:

device iic
device iicbus
device ds1307

that's it. that's the whole vibe check πŸ¦‹


πŸŽ€ 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. like, it tells time AND it has extra storage? main character energy fr fr πŸ‘‘

Here's the iconic part: the ds1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. and the timekeeping operation keeps going while the part operates from the backup supply. no cap, it does not stop. it does not miss. πŸ’€βœ¨

Access to ds1307 settings is made with the sysctl(8) interface β€” and here's what that looks like:

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

now let's go through the knobs one by one, bestie 🫢

  • dev.ds1307.%d.sqwe β€” if you set this to 1, the SQW pin drives a square-wave of dev.ds1307.%d.sqw_freq frequency. if you set it to 0, then the output level of the SQW pin is controlled by dev.ds1307.%d.sqw_out instead. so it's giving "who's in charge here" energy πŸ”₯
  • dev.ds1307.%d.sqw_freq β€” this one picks 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. those are your options, don't try to be creative πŸ’œ
  • dev.ds1307.%d.sqw_out β€” sets the output level of the SQW pin when dev.ds1307.%d.sqwe is set to 0. simple as that ✨
Please check the ds1307 datasheet for more details. (yes, the actual datasheet, go read it, i believe in you πŸ“–)

🌈 device.hints(5) based systems (like MIPS) 🌈

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

  • hint.ds1307.%d.at β€” the iicbus(4) that the ds1307 is connected to πŸ”Œ
  • hint.ds1307.%d.addr β€” the i2c address of ds1307 🏠

πŸ¦‹ FDT(4) based systems πŸ¦‹

On a FDT(4) based system the following properties must be set:

  • compatible β€” must always be set to "dallas,ds1307" or "maxim,ds1307". no other strings, okay? it's not a suggestion, it's the rule πŸ’…
  • reg β€” the i2c address of ds1307. the default address for ds1307 is 0xd0 πŸ“

⭐ SEE ALSO ⭐

fdt(4), iic(4), iicbus(4), sysctl(8) β€” go read these too, they're all part of the friend group 🫢


πŸ‘‘ HISTORY πŸ‘‘

The ds1307 driver first appeared in FreeBSD 11.0. a legend was born ✨


πŸ’– AUTHORS πŸ’–

The ds1307 driver and this manual page were written by Luiz Otavio O Souza <loos@FreeBSD.org>. thank you for your service, icon 🫑🌸


and that's the whole page!! this one came to you from Debian, dated December 10, 2024 β€” mwah, go set some RTC frequencies bestie πŸ’‹πŸ’…πŸ¦‹

πŸ“¦ where this page comes from