How to use w1-gpio rockpi4

how to use w1

modprobe wire
modprobe w1-gpio
modprobe w1-therm

but nothing
cd /sys/bus/w1/devices/

and not w1-gpio pin

GPIOs 0-31, platform/pinctrl, gpio0:

gpio-4 ( |bt_default_wake_host) out hi
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-46 ( |vsel ) out lo
gpio-49 ( |vsel ) out lo

GPIOs 64-95, platform/pinctrl, gpio2:
gpio-83 ( |bt_default_rts ) out lo
gpio-90 ( |vcc3v3_pcie ) out hi
gpio-91 ( |bt_default_wake ) out hi

GPIOs 96-127, platform/pinctrl, gpio3:
gpio-111 ( |mdio-reset ) out hi
gpio-124 ( |? ) out lo
gpio-125 ( |? ) out lo

GPIOs 128-159, platform/pinctrl, gpio4:
gpio-153 ( |vcc5v0_host ) out hi
gpio-155 ( |ep ) out hi

mission impossible ?..
oh no, it works

root@linaro-alip:/home/linaro# ls /sys/bus/w1/devices/

28-0000046ff950 28-0114648aafff 28-0114648c9aff 28-0315549dd0ff w1_bus_master1
28-0114647f01ff 28-0114648ba2ff 28-0114648fb7ff 28-041673558bff
28-0114648067ff 28-0114648bcdff 28-021464d8b9ff 28-051672c7adff

Just one question. How? Which GPIO you used as data? Did you edit kernel?

GPIO4_D6
…/overlays

		w1: onewire@0 {
			compatible = "w1-gpio";
			pinctrl-names = "default";
			gpios = <&gpio4 30 0 0xae>;
			status = "okay";
		};
1 Like

I guess i’m doing something wrong, since i’m getting

stdout>: ERROR (phandle_references): Reference to non-existent node or label "gpio4"

I tried creating overlay file (with -f) with following code

/dts-v1/;
/ {
    model = "ROCK PI 4B";
    compatible = "rockchip,rockpi", "rockchip,rk3399";
    fragment@0 {
        target-path = "/";
        __overlay__ {
            onewire@0 {
                compatible = "w1-gpio";
                pinctrl-names = "default";
                gpios = <&gpio4 30 0 0xae>;
                status = "okay";
            };
        };
     };
};

But device wasn’t there, so i guess i messed something (yes i did modprobe x3 times)

nano hw_intfc.conf
intfc:dtoverlay=rockchip-w1-gpio (.dtb name)

maybe need label w1
my script …“w1: onewire@0 {”…

root@linaro-alip:/home/linaro# lsmod
w1_therm 16384 0
w1_gpio 16384 0
wire 32768 2 w1_gpio,w1_therm

root@linaro-alip:/home/linaro# cat /sys/kernel/debug/gpio

gpio-158 ( |w1 ) in hi