DS1307(4)

πŸ’– DS1307 πŸ’–

okay bestie, so this is from the Kernel Interfaces Manual section (iykyk) and it's literally all about the ds1307 β€” a 64 x 8, serial, i2c real-time clock. she's tiny, she keeps time, she's iconic. let's get into it πŸ•βœ¨


✨ NAME ✨

ds1307 β€” 64 x 8, serial, i2c real-time clock πŸ’…


🌸 SYNOPSIS 🌸

so to even have her in your kernel you need these three lines, no cap:

device iic
device iicbus
device ds1307

πŸŽ€ DESCRIPTION πŸŽ€

okay so the ds1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. yes girl, clock AND storage. multitasking queen. πŸ‘‘

she's also got a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. and the timekeeping? doesn't even stop. she keeps ticking while she's running off the backup supply. main character energy fr fr. πŸ¦‹

access to ds1307 settings is made with the sysctl(8) 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

look at her. so organized. 😭

  • 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. pick your fighter bestie ⚑
  • dev.ds1307.%d.sqw_freq β€” this one selects 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. that's the whole menu, don't try to be cute with other numbers πŸ’…
  • dev.ds1307.%d.sqw_out β€” sets the output level of the SQW pin when dev.ds1307.%d.sqwe is set to 0. that's it, that's her job. πŸŽ€

please check the ds1307 datasheet for more details. (yes girl, read the datasheet, it's giving homework but it's worth it πŸ“š)


🧚 device.hints(5) vibes 🧚

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) vibes 🌈

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 options bestie, these are the only two she answers to. πŸ’œ
  • reg β€” the i2c address of ds1307. the default address for ds1307 is 0xd0. remember it, love it, use it. ✨

πŸ”₯ SEE ALSO πŸ”₯

fdt(4), iic(4), iicbus(4), sysctl(8)

go read them, they're all part of the friend group 🫢


πŸ’€ HISTORY πŸ’€

the ds1307 driver first appeared in FreeBSD 11.0. a legend since day one, periodt. πŸ‘‘


πŸ“ AUTHORS πŸ“

the ds1307 driver and this manual page were written by Luiz Otavio O Souza <loos@FreeBSD.org>. thank you for your service king πŸ«‘πŸ’–


and that's the whole page bestie!! this version came from Debian and it's dated March 7, 2015, filed under DS1307(4). slay, go forth and keep time β°βœ¨πŸŽ€
πŸ“¦ where this page comes from