1befcc3e2SLuiz Otavio O Souza.\" 2befcc3e2SLuiz Otavio O Souza.\" Copyright (c) 2014 Luiz Otavio O Souza <loos@freebsd.org> 3befcc3e2SLuiz Otavio O Souza.\" All rights reserved. 4befcc3e2SLuiz Otavio O Souza.\" 5befcc3e2SLuiz Otavio O Souza.\" Redistribution and use in source and binary forms, with or without 6befcc3e2SLuiz Otavio O Souza.\" modification, are permitted provided that the following conditions 7befcc3e2SLuiz Otavio O Souza.\" are met: 8befcc3e2SLuiz Otavio O Souza.\" 1. Redistributions of source code must retain the above copyright 9befcc3e2SLuiz Otavio O Souza.\" notice, this list of conditions and the following disclaimer. 10befcc3e2SLuiz Otavio O Souza.\" 2. Redistributions in binary form must reproduce the above copyright 11befcc3e2SLuiz Otavio O Souza.\" notice, this list of conditions and the following disclaimer in the 12befcc3e2SLuiz Otavio O Souza.\" documentation and/or other materials provided with the distribution. 13befcc3e2SLuiz Otavio O Souza.\" 14befcc3e2SLuiz Otavio O Souza.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15befcc3e2SLuiz Otavio O Souza.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16befcc3e2SLuiz Otavio O Souza.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17befcc3e2SLuiz Otavio O Souza.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18befcc3e2SLuiz Otavio O Souza.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19befcc3e2SLuiz Otavio O Souza.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20befcc3e2SLuiz Otavio O Souza.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21befcc3e2SLuiz Otavio O Souza.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22befcc3e2SLuiz Otavio O Souza.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23befcc3e2SLuiz Otavio O Souza.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24befcc3e2SLuiz Otavio O Souza.\" 25*f8f999c1SJuraj Lutter.Dd December 10, 2024 26befcc3e2SLuiz Otavio O Souza.Dt DS3231 4 27befcc3e2SLuiz Otavio O Souza.Os 28befcc3e2SLuiz Otavio O Souza.Sh NAME 29befcc3e2SLuiz Otavio O Souza.Nm ds3231 30*f8f999c1SJuraj Lutter.Nd Extremely Accurate i2c-integrated real-time clock (RTC)/TCXO/Crystal 31befcc3e2SLuiz Otavio O Souza.Sh SYNOPSIS 32befcc3e2SLuiz Otavio O Souza.Cd "device iic" 33befcc3e2SLuiz Otavio O Souza.Cd "device iicbus" 34befcc3e2SLuiz Otavio O Souza.Cd "device ds3231" 35befcc3e2SLuiz Otavio O Souza.Sh DESCRIPTION 36befcc3e2SLuiz Otavio O SouzaThe 37befcc3e2SLuiz Otavio O Souza.Nm 38befcc3e2SLuiz Otavio O Souzais a low-cost, extremely accurate I2C realtime clock (RTC) with an 39befcc3e2SLuiz Otavio O Souzaintegrated temperature-compensated crystal oscillator (TCXO) and crystal. 40befcc3e2SLuiz Otavio O Souza.Pp 41befcc3e2SLuiz Otavio O SouzaThe device incorporates a battery input and maintains accurate timekeeping 42befcc3e2SLuiz Otavio O Souzawhen main power to the device is interrupted. 43befcc3e2SLuiz Otavio O Souza.Pp 44befcc3e2SLuiz Otavio O SouzaAccess to 45befcc3e2SLuiz Otavio O Souza.Nm 46befcc3e2SLuiz Otavio O Souzadata is made with the 47befcc3e2SLuiz Otavio O Souza.Xr sysctl 8 48befcc3e2SLuiz Otavio O Souzainterface: 49befcc3e2SLuiz Otavio O Souza.Bd -literal 50befcc3e2SLuiz Otavio O Souzadev.ds3231.0.%desc: Maxim DS3231 RTC 51befcc3e2SLuiz Otavio O Souzadev.ds3231.0.%driver: ds3231 52befcc3e2SLuiz Otavio O Souzadev.ds3231.0.%location: addr=0xd0 53befcc3e2SLuiz Otavio O Souzadev.ds3231.0.%pnpinfo: name=rtc compat=maxim,ds3231 54befcc3e2SLuiz Otavio O Souzadev.ds3231.0.%parent: iicbus1 55befcc3e2SLuiz Otavio O Souzadev.ds3231.0.temperature: 23.2C 56befcc3e2SLuiz Otavio O Souzadev.ds3231.0.temp_conv: 0 57befcc3e2SLuiz Otavio O Souzadev.ds3231.0.bbsqw: 0 58befcc3e2SLuiz Otavio O Souzadev.ds3231.0.sqw_freq: 8192 59befcc3e2SLuiz Otavio O Souzadev.ds3231.0.sqw_mode: interrupt 60befcc3e2SLuiz Otavio O Souzadev.ds3231.0.32khz_enable: 1 61befcc3e2SLuiz Otavio O Souza.Ed 62befcc3e2SLuiz Otavio O Souza.Bl -tag -width ".Va dev.ds3231.%d.temperature" 63befcc3e2SLuiz Otavio O Souza.It Va dev.ds3231.%d.temperature 64befcc3e2SLuiz Otavio O SouzaThe read-only value of the current temperature read by the RTC. 65befcc3e2SLuiz Otavio O Souza.It Va dev.ds3231.%d.temp_conv 667c64ddd5SWarren BlockStart a new temperature conversion. 67befcc3e2SLuiz Otavio O SouzaWhen read as 1, a temperature conversion is in progress. 687c64ddd5SWarren BlockWhen read as 0 and then set to 1, a temperature conversion is started. 69befcc3e2SLuiz Otavio O SouzaThe temperature conversion runs automatically on power up and once every 64 70befcc3e2SLuiz Otavio O Souzaseconds afterward. 71befcc3e2SLuiz Otavio O Souza.It Va dev.ds3231.%d.bbsqw 72befcc3e2SLuiz Otavio O SouzaIf set to 1 and 73befcc3e2SLuiz Otavio O Souza.Va dev.ds3231.%d.sqw_mode 74befcc3e2SLuiz Otavio O Souzais set to square-wave, battery-backed square-wave output is enabled. 75befcc3e2SLuiz Otavio O SouzaIf set to 0, the SQW pin will be set to high impendance when the RTC is 76befcc3e2SLuiz Otavio O Souzabeing powered by battery. 77befcc3e2SLuiz Otavio O Souza.It Va dev.ds3231.%d.sqw_freq 78befcc3e2SLuiz Otavio O SouzaSelect the frequency of the SQW pin when the square-wave output is enabled on 79befcc3e2SLuiz Otavio O Souza.Va dev.ds3231.%d.sqw_mode . 80befcc3e2SLuiz Otavio O SouzaIt can be set to 1, 1024, 4096, and 8192. 81befcc3e2SLuiz Otavio O Souza.It Va dev.ds3231.%d.sqw_mode 82befcc3e2SLuiz Otavio O SouzaSet the operation mode for the SQW pin. 83befcc3e2SLuiz Otavio O SouzaIt can be set to 'interrupt' (default) or 'square-wave'. 84befcc3e2SLuiz Otavio O SouzaIn interrupt mode, the SQW pin is used to generate interrupts for the RTC 85befcc3e2SLuiz Otavio O Souzaalarms. 86befcc3e2SLuiz Otavio O SouzaIn square-wave mode, the SQW pin drives a square-wave of 87befcc3e2SLuiz Otavio O Souza.Va dev.ds3231.%d.sqw_freq 88befcc3e2SLuiz Otavio O Souzafrequency. 89befcc3e2SLuiz Otavio O Souza.It Va dev.ds3231.%d.32khz_enable 90befcc3e2SLuiz Otavio O SouzaEnable the 32kHz output. 91befcc3e2SLuiz Otavio O Souza.El 92befcc3e2SLuiz Otavio O Souza.Pp 93befcc3e2SLuiz Otavio O SouzaPlease check the 94befcc3e2SLuiz Otavio O Souza.Nm 95befcc3e2SLuiz Otavio O Souzadatasheet for more details. 96befcc3e2SLuiz Otavio O Souza.Pp 97befcc3e2SLuiz Otavio O SouzaOn a 98befcc3e2SLuiz Otavio O Souza.Xr device.hints 5 99befcc3e2SLuiz Otavio O Souzabased system, such as 100befcc3e2SLuiz Otavio O Souza.Li MIPS , 101befcc3e2SLuiz Otavio O Souzathese values are configurable for 102befcc3e2SLuiz Otavio O Souza.Nm : 103befcc3e2SLuiz Otavio O Souza.Bl -tag -width ".Va hint.ds3231.%d.addr" 104befcc3e2SLuiz Otavio O Souza.It Va hint.ds3231.%d.at 105befcc3e2SLuiz Otavio O SouzaThe 106befcc3e2SLuiz Otavio O Souza.Xr iicbus 4 107befcc3e2SLuiz Otavio O Souzathat the 108befcc3e2SLuiz Otavio O Souza.Nm 109befcc3e2SLuiz Otavio O Souzais connected to. 110befcc3e2SLuiz Otavio O Souza.It Va hint.ds3231.%d.addr 1110c0a157cSIan LeporeThe 8-bit i2c address of 112befcc3e2SLuiz Otavio O Souza.Nm . 1130c0a157cSIan LeporeThe default 8-bit address for 1140c0a157cSIan Lepore.Nm 1150c0a157cSIan Leporeis 0xd0. 116befcc3e2SLuiz Otavio O Souza.El 117befcc3e2SLuiz Otavio O Souza.Pp 118befcc3e2SLuiz Otavio O SouzaOn a 119befcc3e2SLuiz Otavio O Souza.Xr FDT 4 120befcc3e2SLuiz Otavio O Souzabased system the following properties must be set: 121befcc3e2SLuiz Otavio O Souza.Bl -tag -width ".Va compatible" 122befcc3e2SLuiz Otavio O Souza.It Va compatible 123befcc3e2SLuiz Otavio O SouzaMust always be set to "maxim,ds3231". 124befcc3e2SLuiz Otavio O Souza.It Va reg 1250c0a157cSIan LeporeThe 7-bit i2c address of 126befcc3e2SLuiz Otavio O Souza.Nm . 1270c0a157cSIan LeporeThe default 7-bit address for 128befcc3e2SLuiz Otavio O Souza.Nm 1290c0a157cSIan Leporeis 0x68. 130befcc3e2SLuiz Otavio O Souza.El 131befcc3e2SLuiz Otavio O Souza.Sh SEE ALSO 132befcc3e2SLuiz Otavio O Souza.Xr fdt 4 , 133befcc3e2SLuiz Otavio O Souza.Xr iic 4 , 134befcc3e2SLuiz Otavio O Souza.Xr iicbus 4 , 135befcc3e2SLuiz Otavio O Souza.Xr sysctl 8 136befcc3e2SLuiz Otavio O Souza.Sh HISTORY 137befcc3e2SLuiz Otavio O SouzaThe 138befcc3e2SLuiz Otavio O Souza.Nm 139befcc3e2SLuiz Otavio O Souzadriver first appeared in 140befcc3e2SLuiz Otavio O Souza.Fx 11.0 . 141befcc3e2SLuiz Otavio O Souza.Sh AUTHORS 142befcc3e2SLuiz Otavio O Souza.An -nosplit 143befcc3e2SLuiz Otavio O SouzaThe 144befcc3e2SLuiz Otavio O Souza.Nm 145befcc3e2SLuiz Otavio O Souzadriver and this manual page were written by 146befcc3e2SLuiz Otavio O Souza.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org . 147