I never realized we have a GPIO driver for DHT11/22 sensor.
I was having problems compiling the DT Overlay.
The FreeBSD manpage gives this:
The GPIO_ACTIVE_HIGH setting is faulty.
Simply changing it to 0 does the trick.(Sets the pin high)
/boot/dtb/overlays/rockpro64-gpioths.dts
Add to /boot/loader.conf :
gpioths(4)
www.freebsd.org
I was having problems compiling the DT Overlay.
The FreeBSD manpage gives this:
Code:
gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
Code:
# dtc -O dtb -o rockpro64-gpioths.dtbo -@ rockpro64-gpioths.dts
Error at rockpro64-gpioths.dts:12:33: Expected numbers in array of cells
gpio = <&pio 1 4 GPIO_ACTIVE_HIGH>;
^
Error at rockpro64-gpioths.dts:12:33: Expected ; at end of property
gpio = <&pio 1 4 GPIO_ACTIVE_HIGH>;
^
Error at rockpro64-gpioths.dts:12:33: Failed to find root node /.
gpio = <&pio 1 4 GPIO_ACTIVE_HIGH>;
^
Failed to parse tree.
Simply changing it to 0 does the trick.(Sets the pin high)
/boot/dtb/overlays/rockpro64-gpioths.dts
Code:
/dts-v1/;
/plugin/;
/ {
compatible = "rockchip,rk3399";
fragment@0 {
target-path = "/";
__overlay__ {
dht0 {
compatible = "dht11";
pinctrl-names = "default";
gpios = <&gpio1 4 0>;
status = "okay";
};
};
};
};
Add to /boot/loader.conf :
Code:
gpioths_load="YES"
fdt_overlays="rockpro64-gpioths.dtbo"
dmesg | grep gpioth
Code:
gpioths0: <DHT11/DHT22 Temperature and Humidity Sensor> on ofwbus0
sysctl -a | grep gpioths
Code:
gpioths0: <DHT11/DHT22 Temperature and Humidity Sensor> on ofwbus0
value: /boot/kernel/gpioths.ko
value: /boot/dtb/overlays/rockpro64-gpioths.dtbo
dev.gpioths.0.fails: 0
dev.gpioths.0.humidity: 70
dev.gpioths.0.temperature: 24.1C
dev.gpioths.0.%parent: ofwbus0
dev.gpioths.0.%pnpinfo: name=dht0 compat=dht11
dev.gpioths.0.%location:
dev.gpioths.0.%driver: gpioths
dev.gpioths.0.%desc: DHT11/DHT22 Temperature and Humidity Sensor
dev.gpioths.%parent: