DS3231(4)

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

πŸ’– DS3231(4) πŸ’–

ok so this is a kernel interfaces manual page, and it's literally about the ds3231 β€” an extremely accurate i2c-integrated real-time clock (RTC)/TCXO/Crystal. yes that's the whole name, she's got a long government name and she slays πŸŽ€


✨ NAME ✨

ds3231 β€” Extremely Accurate i2c-integrated real-time clock (RTC)/TCXO/Crystal πŸ‘‘


🌸 SYNOPSIS 🌸

device iic
device iicbus
device ds3231

like, that's it. three lines. add these to your kernel config and you're so back bestie πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

The ds3231 is a low-cost, extremely accurate I2C realtime clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. low-cost AND extremely accurate?? it's giving overachiever, and honestly? we love that for her πŸ’–

The device incorporates a battery input and maintains accurate timekeeping when main power to the device is interrupted. so when the power dips, she's still keeping time. main character energy fr fr 🫢

Access to ds3231 data is made with the sysctl(8) interface:

dev.ds3231.0.%desc: Maxim DS3231 RTC
dev.ds3231.0.%driver: ds3231
dev.ds3231.0.%location: addr=0xd0
dev.ds3231.0.%pnpinfo: name=rtc compat=maxim,ds3231
dev.ds3231.0.%parent: iicbus1
dev.ds3231.0.temperature: 23.2C
dev.ds3231.0.temp_conv: 0
dev.ds3231.0.bbsqw: 0
dev.ds3231.0.sqw_freq: 8192
dev.ds3231.0.sqw_mode: interrupt
dev.ds3231.0.32khz_enable: 1

look at all those knobs, she's got OPTIONS 😭✨

  • dev.ds3231.%d.temperature β€” The read-only value of the current temperature read by the RTC. read-only bestie, you can look but you cannot touch πŸ™ˆ
  • dev.ds3231.%d.temp_conv β€” Start a new temperature conversion. When read as 1, a temperature conversion is in progress. When read as 0 and then set to 1, a temperature conversion is started. The temperature conversion runs automatically on power up and once every 64 seconds afterward. she's doing conversions in the background without even being asked, iconic behaviour honestly 🧚
  • dev.ds3231.%d.bbsqw β€” If set to 1 and dev.ds3231.%d.sqw_mode is set to square-wave, battery-backed square-wave output is enabled. If set to 0, the SQW pin will be set to high impendance when the RTC is being powered by battery. (yes, "impendance" β€” I'm quoting her, don't come for me πŸ’€)
  • dev.ds3231.%d.sqw_freq β€” Select the frequency of the SQW pin when the square-wave output is enabled on dev.ds3231.%d.sqw_mode. It can be set to 1, 1024, 4096, and 8192. pick your vibe, bestie ⭐
  • dev.ds3231.%d.sqw_mode β€” Set the operation mode for the SQW pin. It can be set to 'interrupt' (default) or 'square-wave'. In interrupt mode, the SQW pin is used to generate interrupts for the RTC alarms. In square-wave mode, the SQW pin drives a square-wave of dev.ds3231.%d.sqw_freq frequency. two modes, both valid, both slaying πŸ’…
  • dev.ds3231.%d.32khz_enable β€” Enable the 32kHz output. turn it on and let her sing 🎡
Please check the ds3231 datasheet for more details. (she's got lore, go read it πŸ“–)

πŸŽ€ On a device.hints(5) based system πŸŽ€

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

  • hint.ds3231.%d.at β€” The iicbus(4) that the ds3231 is connected to. where does she live? right here, on this bus 🚌
  • hint.ds3231.%d.addr β€” The 8-bit i2c address of ds3231. The default 8-bit address for ds3231 is 0xd0. that's her 8-bit government address, no cap πŸ’–

🌈 On a FDT(4) based system 🌈

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

  • compatible β€” Must always be set to "maxim,ds3231". always. no negotiating. periodt ✨
  • reg β€” The 7-bit i2c address of ds3231. The default 7-bit address for ds3231 is 0x68. different system, different address, same queen πŸ‘‘

πŸ”₯ SEE ALSO πŸ”₯

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

go read those too, bestie, they're all connected iykyk πŸ¦‹


πŸ’œ HISTORY πŸ’œ

The ds3231 driver first appeared in FreeBSD 11.0. she's been here since 11.0 and she's still accurate af ⏰


πŸ‘‘ AUTHORS πŸ‘‘

The ds3231 driver and this manual page were written by Luiz Otavio O Souza <loos@FreeBSD.org>. thank you king, the timekeeping would NOT be this accurate without you πŸ«ΆπŸ’–


okay that's the whole page!! and for the little sign-off: this beauty came out of Debian, dated December 10, 2024, and it's the DS3231(4) page β€” remember her name, she's accurate forever β±οΈβœ¨πŸŽ€

πŸ“¦ where this page comes from