xref: /freebsd/share/man/man4/htu21.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2021 Andriy Gapon <avg@FreeBSD.org>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd January 19, 2021
28.Dt HTU21 4
29.Os
30.Sh NAME
31.Nm htu21
32.Nd driver for HTU21D and compatible temperature and humidity sensors
33.Sh SYNOPSIS
34To compile this driver into the kernel,
35place the following lines in your
36kernel configuration file:
37.Bd -ragged -offset indent
38.Cd "device htu21"
39.Cd "device iicbus"
40.Ed
41.Pp
42Alternatively, to load the driver as a
43module at boot time, place the following line in
44.Xr loader.conf 5 :
45.Bd -literal -offset indent
46htu21_load="YES"
47.Ed
48.Sh DESCRIPTION
49The
50.Nm
51driver provides temperature and relative humidity readings over I2C bus
52for the supported sensors:
53.Bl -bullet -compact
54.It
55HTU21D
56.It
57SHT21
58.It
59Si7021
60.El
61.Pp
62The
63.Nm
64driver reports data via
65.Xr sysctl 8
66entries in the device's node in the
67.Xr sysctl 8
68tree:
69.Bl -tag -width temperature
70.It temperature
71The temperature, in hundredths of Kelvin.
72.It humidity
73The relative humidity, in hundredths of a percent.
74.It crc_errors
75The number of CRC errors in reading the measurements from the device.
76.It power
77The good power indication.
78This can be useful with battery powered sensors.
79.It heater
80The built-in heater control.
81The heater can be used for testing and for recovery from saturation
82after high humidity.
83.It hold_bus
84Whether the sensor should hold SCL low while performing the measurement.
85Normally, the sensor releases the bus and NACKs all accessed until the
86measurement is completed.
87The hold mode may be useful in mult-master environments.
88.El
89.Pp
90On an
91.Xr FDT 4
92based system the following properties must be set:
93.Bl -tag -width "compatible"
94.It Va compatible
95Must be set to "meas,htu21".
96.It Va reg
97The I2C address of
98.Nm .
99Although, it is hard-wired to 0x40 (7-bit) on all supported sensors.
100.El
101.Pp
102The DTS part for a
103.Nm
104device usually looks like:
105.Bd -literal
106/ {
107
108	...
109	htu21d {
110		compatible = "meas,htu21";
111		reg = <0x40>;
112	};
113};
114.Ed
115.Sh SEE ALSO
116.Xr fdt 4 ,
117.Xr iicbus 4 ,
118.Xr sysctl 8
119.Sh HISTORY
120The
121.Nm
122driver and this manual page was written by
123.An Andriy Gapon Aq Mt avg@FreeBSD.org .
124.Sh BUGS
125There is no way to control the measurement resolution.
126.Pp
127Some sensor variants do not provide a serial number or use an incompatible
128format.
129The
130.Nm
131driver does not distinguish those variants and may complain about incorrect
132serial number checksum.
133