xref: /freebsd/share/man/man4/htu21.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
12c98edd6SAndriy Gapon.\"
2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause
32c98edd6SAndriy Gapon.\"
42c98edd6SAndriy Gapon.\" Copyright (c) 2021 Andriy Gapon <avg@FreeBSD.org>
52c98edd6SAndriy Gapon.\"
62c98edd6SAndriy Gapon.\" Redistribution and use in source and binary forms, with or without
72c98edd6SAndriy Gapon.\" modification, are permitted provided that the following conditions
82c98edd6SAndriy Gapon.\" are met:
92c98edd6SAndriy Gapon.\" 1. Redistributions of source code must retain the above copyright
102c98edd6SAndriy Gapon.\"    notice, this list of conditions and the following disclaimer.
112c98edd6SAndriy Gapon.\" 2. Redistributions in binary form must reproduce the above copyright
122c98edd6SAndriy Gapon.\"    notice, this list of conditions and the following disclaimer in the
132c98edd6SAndriy Gapon.\"    documentation and/or other materials provided with the distribution.
142c98edd6SAndriy Gapon.\"
152c98edd6SAndriy Gapon.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
162c98edd6SAndriy Gapon.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
172c98edd6SAndriy Gapon.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
182c98edd6SAndriy Gapon.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
192c98edd6SAndriy Gapon.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
202c98edd6SAndriy Gapon.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
212c98edd6SAndriy Gapon.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
222c98edd6SAndriy Gapon.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
232c98edd6SAndriy Gapon.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
242c98edd6SAndriy Gapon.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
252c98edd6SAndriy Gapon.\" SUCH DAMAGE.
262c98edd6SAndriy Gapon.\"
272c98edd6SAndriy Gapon.Dd January 19, 2021
282c98edd6SAndriy Gapon.Dt HTU21 4
292c98edd6SAndriy Gapon.Os
302c98edd6SAndriy Gapon.Sh NAME
312c98edd6SAndriy Gapon.Nm htu21
322c98edd6SAndriy Gapon.Nd driver for HTU21D and compatible temperature and humidity sensors
332c98edd6SAndriy Gapon.Sh SYNOPSIS
342c98edd6SAndriy GaponTo compile this driver into the kernel,
352c98edd6SAndriy Gaponplace the following lines in your
362c98edd6SAndriy Gaponkernel configuration file:
372c98edd6SAndriy Gapon.Bd -ragged -offset indent
382c98edd6SAndriy Gapon.Cd "device htu21"
392c98edd6SAndriy Gapon.Cd "device iicbus"
402c98edd6SAndriy Gapon.Ed
412c98edd6SAndriy Gapon.Pp
422c98edd6SAndriy GaponAlternatively, to load the driver as a
432c98edd6SAndriy Gaponmodule at boot time, place the following line in
442c98edd6SAndriy Gapon.Xr loader.conf 5 :
452c98edd6SAndriy Gapon.Bd -literal -offset indent
462c98edd6SAndriy Gaponhtu21_load="YES"
472c98edd6SAndriy Gapon.Ed
482c98edd6SAndriy Gapon.Sh DESCRIPTION
492c98edd6SAndriy GaponThe
502c98edd6SAndriy Gapon.Nm
512c98edd6SAndriy Gapondriver provides temperature and relative humidity readings over I2C bus
522c98edd6SAndriy Gaponfor the supported sensors:
532c98edd6SAndriy Gapon.Bl -bullet -compact
542c98edd6SAndriy Gapon.It
552c98edd6SAndriy GaponHTU21D
562c98edd6SAndriy Gapon.It
572c98edd6SAndriy GaponSHT21
582c98edd6SAndriy Gapon.It
592c98edd6SAndriy GaponSi7021
602c98edd6SAndriy Gapon.El
612c98edd6SAndriy Gapon.Pp
622c98edd6SAndriy GaponThe
632c98edd6SAndriy Gapon.Nm
642c98edd6SAndriy Gapondriver reports data via
652c98edd6SAndriy Gapon.Xr sysctl 8
662c98edd6SAndriy Gaponentries in the device's node in the
672c98edd6SAndriy Gapon.Xr sysctl 8
682c98edd6SAndriy Gapontree:
692c98edd6SAndriy Gapon.Bl -tag -width temperature
702c98edd6SAndriy Gapon.It temperature
712c98edd6SAndriy GaponThe temperature, in hundredths of Kelvin.
722c98edd6SAndriy Gapon.It humidity
732c98edd6SAndriy GaponThe relative humidity, in hundredths of a percent.
742c98edd6SAndriy Gapon.It crc_errors
752c98edd6SAndriy GaponThe number of CRC errors in reading the measurements from the device.
762c98edd6SAndriy Gapon.It power
772c98edd6SAndriy GaponThe good power indication.
782c98edd6SAndriy GaponThis can be useful with battery powered sensors.
792c98edd6SAndriy Gapon.It heater
802c98edd6SAndriy GaponThe built-in heater control.
812c98edd6SAndriy GaponThe heater can be used for testing and for recovery from saturation
822c98edd6SAndriy Gaponafter high humidity.
832c98edd6SAndriy Gapon.It hold_bus
842c98edd6SAndriy GaponWhether the sensor should hold SCL low while performing the measurement.
852c98edd6SAndriy GaponNormally, the sensor releases the bus and NACKs all accessed until the
862c98edd6SAndriy Gaponmeasurement is completed.
872c98edd6SAndriy GaponThe hold mode may be useful in mult-master environments.
882c98edd6SAndriy Gapon.El
892c98edd6SAndriy Gapon.Pp
902c98edd6SAndriy GaponOn an
912c98edd6SAndriy Gapon.Xr FDT 4
922c98edd6SAndriy Gaponbased system the following properties must be set:
932c98edd6SAndriy Gapon.Bl -tag -width "compatible"
942c98edd6SAndriy Gapon.It Va compatible
952c98edd6SAndriy GaponMust be set to "meas,htu21".
962c98edd6SAndriy Gapon.It Va reg
972c98edd6SAndriy GaponThe I2C address of
982c98edd6SAndriy Gapon.Nm .
992c98edd6SAndriy GaponAlthough, it is hard-wired to 0x40 (7-bit) on all supported sensors.
1002c98edd6SAndriy Gapon.El
1012c98edd6SAndriy Gapon.Pp
1022c98edd6SAndriy GaponThe DTS part for a
1032c98edd6SAndriy Gapon.Nm
1042c98edd6SAndriy Gapondevice usually looks like:
1052c98edd6SAndriy Gapon.Bd -literal
1062c98edd6SAndriy Gapon/ {
1072c98edd6SAndriy Gapon
1082c98edd6SAndriy Gapon	...
1092c98edd6SAndriy Gapon	htu21d {
1102c98edd6SAndriy Gapon		compatible = "meas,htu21";
1112c98edd6SAndriy Gapon		reg = <0x40>;
1122c98edd6SAndriy Gapon	};
1132c98edd6SAndriy Gapon};
1142c98edd6SAndriy Gapon.Ed
1152c98edd6SAndriy Gapon.Sh SEE ALSO
1162c98edd6SAndriy Gapon.Xr fdt 4 ,
1172c98edd6SAndriy Gapon.Xr iicbus 4 ,
1182c98edd6SAndriy Gapon.Xr sysctl 8
1192c98edd6SAndriy Gapon.Sh HISTORY
1202c98edd6SAndriy GaponThe
1212c98edd6SAndriy Gapon.Nm
1222c98edd6SAndriy Gapondriver and this manual page was written by
1232c98edd6SAndriy Gapon.An Andriy Gapon Aq Mt avg@FreeBSD.org .
1242c98edd6SAndriy Gapon.Sh BUGS
1250d40cd15SGordon BerglingThere is no way to control the measurement resolution.
1262c98edd6SAndriy Gapon.Pp
1272c98edd6SAndriy GaponSome sensor variants do not provide a serial number or use an incompatible
1282c98edd6SAndriy Gaponformat.
1292c98edd6SAndriy GaponThe
1302c98edd6SAndriy Gapon.Nm
1312c98edd6SAndriy Gapondriver does not distinguish those variants and may complain about incorrect
1322c98edd6SAndriy Gaponserial number checksum.
133