器件型号: AM625
板:E3
TI 团队大家好、
我正在尝试将 DHT11 温度/湿度传感器与电路板连接。 然而、从传感器读取数据时、我始终面临超时问题。
以下是我尝试的两种方法及其结果:
1) 使用内核驱动程序((IIO DHT11 驱动程序)
通过将 IIO→DHT11 驱动程序选择为 M 来构建 dht11.ko、在 menuconfig 中启用该驱动程序。
修改了器件树文件:
k3-am62x-sk-common.dtsi
在 DTS 中添加了 DHT11 节点。
重建内核和器件树、将更新后的 Image 和.dtb 刷写到 EVM。
引导后、我检查了 GPIO/pinctrl 状态和 DHT11 驱动器状态。
读取数据时、驾驶员报告“超时“错误。
我已附上日志和 dtsi 的快照以供您参考。
root@am62xx-evm:~# lsmod | grep dht
dht11
16384 0
root@am62xx-evm:~# cd /sys/bus/iio/
root@am62xx-evm:/sys/bus/iio# ls
devices drivers drivers_autoprobe drivers_probe
uevent
root@am62xx-evm:/sys/bus/iio# cd devices
root@am62xx-evm:/sys/bus/iio/devices# ls
iio:deviceo
root@am62xx-evm:/sys/bus/iio/devices# cd iio:deviceo
root@am62xx-evm:/sys/bus/iio/devices/iio:device0# ls
in_humidityrelative_input
name
power
uevent
in_temp_input
of_node
subsystem
waiting_for_supplier
root@am62xx-evm:/sys/bus/iio/devices/iio:device0# cat in_humidityrelative_input
[ 366.018672] dht11 dht11@38: Only 0 signal edges detected
cat: in_humidityrelative_input: Connection timed out
root@am62xx-evm:/sys/bus/iio/devices/iio:device0# cat in_temp_input
[ 379.106726] dht11 dht11@38: Only 0 signal edges detected
cat: in_temp_input: Connection timed out
/* DHT11 Sensor Definition */
dht11@38 {
compatible = "dht11";
gpios = <&main_gpio0 38 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&main_dht11_pins_default>;
status = "okay";
};
main_dht11_pins_default: main-dht11-default-pins {
pinctrl-single,pins = <
AM62X_IOPAD(0x009c, PIN_INPUT, 7) /* (V25) GPMC0_WAIT1.GPIO0_38 */
>;
};
2) 使用 Python 脚本
作为替代测试、我直接在 AM62x Linux 控制台上执行了基于 Python 的 DHT11 读取脚本、但仍然收到相同的超时错误。
我需要澄清:
AM62x SK EVM Linux 在 IIO 下是否正式支持 DHT11?
是否有任何推荐的方法来连接 DHT11 等单线传感器?
用于此类时间关键型操作的 GPIO 是否有任何限制?
您能否帮助查看我的 DTS 配置或提供有效参考?
此致、
Harsha Vardhan