The ds3231 is a low-cost, extremely accurate I2C realtime clock (RTC) with an integrated temperature-
compensated crystal oscillator (TCXO) and crystal.
The device incorporates a battery input and maintains accurate timekeeping when main power to the device
is interrupted.
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
dev.ds3231.%d.temperature The read-only value of the current temperature read by the RTC.
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.
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.
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.
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.
On a FDT(4) based system the following properties must be set:
compatible Must always be set to "maxim,ds3231".
reg The 7-bit i2c address of ds3231. The default 7-bit address for ds3231 is 0x68.