DS3231(4)

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

ok so this is a page from the Kernel Interfaces Manual, and it's all about ds3231 β€” the Extremely Accurate i2c-integrated RTC/TCXO/Crystal. yes bestie, that's the full government name. πŸ•βœ¨


🌸 NAME 🌸

ds3231 β€” Extremely Accurate i2c-integrated RTC/TCXO/Crystal


✨ SYNOPSIS ✨

device iic
device iicbus
device ds3231

πŸŽ€ DESCRIPTION πŸŽ€

ok so the ds3231 is a low-cost, extremely accurate I2C realtime clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. it's giving "tiny chip, huge responsibility." πŸ‘‘

the device has a battery input and it keeps accurate timekeeping even when main power to the device is interrupted. it literally does not care about your power outage. main character energy fr. πŸ’…

you get at the ds3231 data through the sysctl(8) interface, and it looks like this:

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
  • dev.ds3231.%d.temperature β€” the read-only value of the current temperature read by the RTC. you can look, you cannot touch. πŸ™ˆ
  • dev.ds3231.%d.temp_conv β€” start a new temperature conversion. when you read it as 1, a temperature conversion is in progress. when you read it as 0 and then set it to 1, a temperature conversion is started. the temperature conversion runs automatically on power up and once every 64 seconds afterward. it's on its own lil schedule, no notes. ⏱️
  • dev.ds3231.%d.bbsqw β€” if you set it to 1 and dev.ds3231.%d.sqw_mode is set to square-wave, battery-backed square-wave output is enabled. if you set it to 0, the SQW pin will be set to high impendance when the RTC is being powered by battery.
  • 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.
  • 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.
  • dev.ds3231.%d.32khz_enable β€” enable the 32kHz output. 🎡

please check the ds3231 datasheet for more details. (yes bestie, the datasheet. it's the lore. πŸ“–)


πŸ¦‹ device.hints(5) systems πŸ¦‹

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.
  • hint.ds3231.%d.addr β€” the 8-bit i2c address of ds3231. the default 8-bit address for ds3231 is 0xd0.

🌈 FDT(4) systems 🌈

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

  • compatible β€” must always be set to "maxim,ds3231". no negotiating. 🚫
  • reg β€” the 7-bit i2c address of ds3231. the default 7-bit address for ds3231 is 0x68.
⚠️ heads up bestie: device.hints(5) systems want the 8-bit address (0xd0 default), FDT systems want the 7-bit address (0x68 default). two different numbers, same chip. don't mix them up, it's not the vibe. 😭

⭐ SEE ALSO ⭐

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


πŸ‘‘ HISTORY πŸ‘‘

the ds3231 driver first appeared in FreeBSD 11.0. a legend from day one, honestly. πŸ”₯


πŸ’œ AUTHORS πŸ’œ

the ds3231 driver and this manual page were written by Luiz Otavio O Souza <loos@FreeBSD.org>. we stan. 🫢


ok that's the whole page bestie, you're officially a ds3231 girlie now πŸ’…βœ¨

this was DS3231(4) from the Debian build, dated February 12, 2016 β€” yeah it's an old baddie but she still slays. bye ily, go read your datasheet πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from