Ninjava Posted July 28, 2022 Posted July 28, 2022 Hello. I am trying to have the 1-wire working on Rockpi4B+ on pin GPIO4_D6 (= number 158). I have this /boot/armbianEnv.txt: verbosity=1 bootlogo=true overlay_prefix=rockchip fdtfile=rockchip/rk3399-rock-pi-4b.dtb rootdev=UUID=aa1f4e9a-bad9-4760-87c5-511247ef7227 rootfstype=ext4 overlays=w1-gpio param_w1_pin=GPIO4_D6 param_w1_pin_int_pullup=1 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u but when I check on my board: sudo cat /sys/kernel/debug/gpio GPIOs 0-31, platform/pinctrl, gpio0: gpio-4 ( |bt_default_wake_host) in lo gpio-9 ( |bt_default_reset ) out hi gpio-10 ( |reset ) out hi GPIOs 32-63, platform/pinctrl, gpio1: gpio-35 ( |vcc5v0_otg ) out hi gpio-36 ( |w1 ) in lo gpio-46 ( |vsel ) out lo gpio-49 ( |vsel ) out lo GPIOs 64-95, platform/pinctrl, gpio2: gpio-83 ( |bt_default_rts ) out hi gpio-90 ( |vcc3v3_pcie ) out hi gpio-91 ( |bt_default_wake ) out hi GPIOs 96-127, platform/pinctrl, gpio3: gpio-124 ( |? ) out lo gpio-125 ( |? ) out lo GPIOs 128-159, platform/pinctrl, gpio4: gpio-153 ( |vcc5v0_host ) out hi and if I check the dtb file: Quote pi@rockpi-4b:~$ fdtdump /boot/dtb-4.4.213-rockchip64/rockchip/overlay/rockchip-w1-gpio.dtbo **** fdtdump is a low-level debugging tool, not meant for general use. **** If you want to decompile a dtb, you probably want **** dtc -I dtb -O dts <filename> /dts-v1/; // magic: 0xd00dfeed // totalsize: 0x1eb (491) // off_dt_struct: 0x38 // off_dt_strings: 0x1a8 // off_mem_rsvmap: 0x28 // version: 17 // last_comp_version: 16 // boot_cpuid_phys: 0x0 // size_dt_strings: 0x43 // size_dt_struct: 0x170 / { compatible = "rockchip,rk3399"; fragment@0 { target-path = "/"; __overlay__ { onewire@0 { compatible = "w1-gpio"; pinctrl-names = "default"; gpios = <0xffffffff 0x00000004 0x00000000 0x000000ae>; status = "okay"; phandle = <0x00000001>; }; }; }; __symbols__ { w1 = "/fragment@0/__overlay__/onewire@0"; }; __fixups__ { gpio1 = "/fragment@0/__overlay__/onewire@0:gpios:0"; }; }; It appears than the w1-gpio is connected to GPIO1_A5 (= number 36) I guess something went wrong in the configuration of 1-wire pin, but what ? 0 Quote
Ninjava Posted September 28, 2022 Author Posted September 28, 2022 Ok, I found the problem. There is a bug in the w1-gpio.dtbo installed with armbian. If I use it, I have a dmeg saying 'w1-pins' group missing. I created my own dts file: sudo nano w1-gpio.dts and remove fragment@1 and pinctrl-0 = <&w1_pins>; /dts-v1/; /plugin/; / { compatible = "rockchip,rockpi","rockchip,rk3399"; fragment@0 { target-path = "/"; __overlay__ { w1: onewire@0 { compatible = "w1-gpio"; pinctrl-names = "default"; gpios = <&gpio4 30 0>; status = "okay"; }; }; }; }; and compiled it: sudo dtc -I dts -O dtb -o /boot/dtb-5.15.63-rockchip64/rockchip/overlay/rockchip-w1-gpio.dtbo w1-gpio.dts and I have my hardware working ! sudo dmesg | grep w1 [ 7.553669] w1_master_driver w1_bus_master1: Attaching one wire slave 10.000802e5e4d1 crc 3c 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.