您尚未登录。

楼主 # 2023-11-02 19:02:03

poupou
会员
注册时间: 2023-11-02
已发帖子: 1
积分: 16

求助,luckfox pico 驱动 dht11 设备树问题?

LuckFox Pico、Luckfox Pico Mini A/B 与 LuckFox Pico Plus 是基于瑞芯微 RV1103 芯片的低成本微型 linux 开发板,而 LuckFox Pico Pro 与 LuckFox Pico Max 是基于瑞芯微 RV1106 芯片的低成本微型 linux 开发板。RV1103/RV1106 是一款专门用于人工智能相关应用的高度集成 IPC 视觉处理器 SoC。它基于单核 ARM Cortex-A7 32 位内核,集成了 NEON 和 FPU,并内置 NPU 支持 INT4 / INT8 / INT16 混合运算,计算能力高达 0.5TOPs。
目前是想用 Luckfox pico 来驱动 dht11

1.修改内核,使能dht11
cd /home/luckfox/Luckfox-Pico/luckfox-pico/sysdrv/source/kernel
cp ./arch/arm/configs/luckfox_rv1106_linux_defconfig .config
make ARCH=arm menuconfig

搜索dht11,打开使能。接下来保存配置

make ARCH=arm savedefconfig
cp defconfig ./arch/arm/configs/luckfox_rv1106_linux_defconfig
2.修改设备树

vi /home/luckfox/Luckfox-Pico/luckfox-pico/sysdrv/source/kernel/arch/arm/boot/dts/rv1103g-luckfox-pico.dts
设备树不太明白,自己仿着写的,应该是错的

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2022 Rockchip Electronics Co., Ltd.
 */

/dts-v1/;

#include "rv1103.dtsi"
#include "rv1106-evb.dtsi"
#include "rv1103-luckfox-pico-ipc.dtsi"

/ {
        model = "Luckfox Pico";
        compatible = "rockchip,rv1103g-38x38-ipc-v10", "rockchip,rv1103";


        dht11 {
                compatible = "dht11";
                gpios = <&gpio1 55 GPIO_ACTIVE_HIGH>;  //dht11 data引脚接着开发板的 55 号引脚
                linux,open-drain;
                pinctrl-names = "default";
                pinctrl-0 = <&gpio1_pc7>;
                status = "okay";
        };

        gpio4pa2:gpio4pa2 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio4_pa2>;
                regulator-name = "gpio4_pa2";
                regulator-always-on;
        };

        gpio4pa3:gpio4pa3 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio4_pa3>;
                regulator-name = "gpio4_pa3";
                regulator-always-on;
        };

        gpio4pa4:gpio4pa4 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio4_pa4>;
                regulator-name = "gpio4_pa4";
                regulator-always-on;
        };



        gpio4pa6:gpio4pa6 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio4_pa6>;
                regulator-name = "gpio4_pa6";
                regulator-always-on;
        };

        gpio4pb0:gpio4pb0 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio4_pb0>;
                regulator-name = "gpio4_pb0";
                regulator-always-on;
        };

        gpio4pb1:gpio4pb1 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio4_pb1>;
                regulator-name = "gpio4_pb1";
                regulator-always-on;
        };
};
/**********GPIO**********/
&pinctrl {
        gpio1-pc7 {
                gpio1_pc7:gpio1-pc7 {
                        rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; //其实我也不知道这干嘛的,但是看文档有这么一句
                };
        };
        gpio4-pa2 {
                gpio4_pa2:gpio4-pa2 {
                        rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio4-pa3 {
                gpio4_pa3:gpio4-pa3 {
                        rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio4-pa4 {
                gpio4_pa4:gpio4-pa4 {
                        rockchip,pins = <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio4-pa6 {
                gpio4_pa6:gpio4-pa6 {
                        rockchip,pins = <4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio4-pb0 {
                gpio4_pb0:gpio4-pb0 {
                        rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio4-pb1 {
                gpio4_pb1:gpio4-pb1 {
                        rockchip,pins = <4 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

};

// &sfc {
//      status = "okay";

//      flash@0 {
//              compatible = "spi-nand";
//              reg = <0>;
//              spi-max-frequency = <75000000>;
//              spi-rx-bus-width = <4>;
//              spi-tx-bus-width = <1>;
//      };
// };

&usbdrd_dwc3 {
        dr_mode = "peripheral";
};


&gmac {
        status = "disabled";
};


/**********I2C**********/
// &i2c0 {
//      status = "okay";
//      pinctrl-0 = <&i2c0m2_xfer>;
//      clock-frequency = <100000>;
// };
&i2c3 {
        status = "okay";
        pinctrl-0 = <&i2c3m1_xfer>;
        clock-frequency = <100000>;
};

/**********SPI**********/
&spi0 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&spi0m0_pins>;
        cs-gpios = <&gpio1 RK_PC0 1>;
        // cs-gpios = <&gpio1 26 1>;
        #address-cells = <1>;
        #size-cells = <0>;
        spidev@0 {
                compatible = "rockchip,spidev";
                spi-max-frequency = <1000000000>;
                reg = <0>;
        };
};

/**********UART**********/
&uart3 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&uart3m1_xfer>;
};
&uart4 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&uart4m1_xfer>;
};
// &uart5 {
//      status = "okay";
//      pinctrl-names = "default";
//      pinctrl-0 = <&uart5m0_xfer>;
// };

/**********PWM**********/

&pwm0 {
        status = "okay";
        pinctrl-names = "active";
        pinctrl-0 = <&pwm0m0_pins>;
        // pinctrl-0 = <&pwm0m1_pins>;
};
&pwm1 {
        status = "okay";
        pinctrl-names = "active";
        pinctrl-0 = <&pwm1m0_pins>;
        // pinctrl-0 = <&pwm1m1_pins>;
};

// &pwm2 {
//      status = "okay";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm2m2_pins>;
// };
// &pwm3 {
//      status = "okay";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm3m2_pins>;
// };
// &pwm4 {
//      status = "okay";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm4m2_pins>;
// };
// &pwm5 {
//      status = "okay";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm5m2_pins>;
// };
// &pwm6 {
//      status = "okay";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm6m2_pins>;
// };
// &pwm7 {
//      status = "okay";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm7m2_pins>;
// };
// &pwm8 {
//      status = "okay";
//      pinctrl-names = "active";
//      // pinctrl-0 = <&pwm8m1_pins>;
//      pinctrl-0 = <&pwm8m0_pins>;
// };
// &pwm9 {
//      status = "okay";
//      pinctrl-names = "active";
//      // pinctrl-0 = <&pwm9m1_pins>;
//      pinctrl-0 = <&pwm9m0_pins>;
// };

&pwm10 {
        status = "okay";
        pinctrl-names = "active";
        pinctrl-0 = <&pwm10m1_pins>;
        // pinctrl-0 = <&pwm10m2_pins>;
        // pinctrl-0 = <&pwm10m0_pins>;
};
//&pwm11 { pwm11注释掉,55引脚变成普通IO引脚
//      status = "disabled";
//      pinctrl-names = "active";
//      pinctrl-0 = <&pwm11m1_pins>;
        // pinctrl-0 = <&pwm11m2_pins>;
        // pinctrl-0 = <&pwm11m0_pins>;
//};
3.编译内核
cd /home/luckfox/Luckfox-Pico/luckfox-pico
./build.sh kernel
4.烧录sd

上面编译会得到 boot.img ,替换掉从这里下载的镜像中的 boot.img
烧录之后,adb shell 进到开发板里,/dev 里面没有 dht11 的设备文件



想知道是哪一步错了呢?大佬们帮帮忙。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn