DS1307(4)
π 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 to1, the SQW pin drives a square-wave ofdev.ds1307.%d.sqw_freqfrequency. if you set it to0, then the output level of the SQW pin is controlled bydev.ds1307.%d.sqw_outinstead. 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 ondev.ds1307.%d.sqwe. it can be set to1,4096,8192and32768. those are your options, don't try to be creative πdev.ds1307.%d.sqw_outβ sets the output level of the SQW pin whendev.ds1307.%d.sqweis set to0. 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β theiicbus(4)that theds1307is connected to πhint.ds1307.%d.addrβ the i2c address ofds1307π
π¦ 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 ofds1307. the default address fords1307is0xd0π
β 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
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2015 Luiz Otavio O Souza <loos@freebsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms