linux - 如何在设备树中配置多个 I/O 扩展器 PCF8574a?

标签 linux embedded-linux yocto i2c device-tree

我目前正在我的设备树 am335x-boneblack.dts 中添加一个 I/O 扩展器 PCF8574a。我有两个 I/O 扩展器,一个在 0x38,另一个在 0x39。

下面的代码适用于单个扩展器,但如果我以类似方式添加地址为 0x39 的 PCF8574a,则会显示错误。

&i2c1 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c1_pins_default>;
    status = "okay";
    clock-frequency = <400000>;

pcf8574a: pcf8574a@38 {
    compatible = "nxp,pcf8574a";
    reg = <0x38>;
    gpio-controller;            
    #gpio-cells = <2>;
};

};

错误日志:

"Duplicate label 'pcf8574a' on /ocp/i2c@4802a000/pcf8574a@39 and /ocp/i2c@4802a000/pcf8574a@38" which I completely understand.

但我不知道如何添加另一个节点或说子节点来完成这项工作。有什么建议吗?

最佳答案

你试过吗

&i2c1 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c1_pins_default>;
    status = "okay";
    clock-frequency = <400000>;

pcf8574a_38: pcf8574a@38 {
    compatible = "nxp,pcf8574a";
    reg = <0x38>;
    gpio-controller;            
    #gpio-cells = <2>;
};
pcf8574a_39: pcf8574a@39 {
    compatible = "nxp,pcf8574a";
    reg = <0x39>;
    gpio-controller;            
    #gpio-cells = <2>;
};
};

关于linux - 如何在设备树中配置多个 I/O 扩展器 PCF8574a?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56395077/

相关文章:

c - 内存中不可交换的页面?为什么?

c - 在C套接字中调用两次recv时丢失接收到的数据

linux - 命令行公钥加密实用程序

c++ - 所选处理器不支持 Thumb 模式 `swp r3,sl,[fp]'

embedded-linux - 如何在 Yocto Fido (poky) 中使/var/log 持久化

python - 优雅地杀死一个孤立的套接字

linux - KVM 可以在没有 libvirt 的情况下工作吗?

linux - qvfb 编译错误 - 对 `png_create_write_struct' 的 undefined reference

python - 使用 yocto 为 Raspberry pi 3 构建图像时出现解析错误

yocto - 如何将 ldd 实用程序添加到 bitbake 图像