please choosego to mobile | Continue to access the PC version
View: 2306|Reply: 1

Orange Pi Zero 2: 1-wire does't work. Temperature sensor DS18B20

[Copy link]

1

threads

1

posts

29

credits

Novice

Rank: 1

credits
29
Published in 2022-6-15 04:24:18 | Show all floors |Read mode
Hello,
I have a problem with an 1-wire interface. I can not make a temperature sensor (DS18B20) work.


I have an Orange Pi Zero 2 board. I installed the official image os, that is Orangepizero2_3.0.0_debian_bullseye_server_linux5.16.17.
My settings:


/boot/armbianEnv.txt
overlays=w1-gpio
param_w1_pin=PC10

/etc/modules
w1-gpio
w1-therm

lsmod command shows this:
w1_therm  28672 0
w1_gpio    16384 0
wire          40960 2 w1_gpio,w1_therm


The temperature sensor (DS18B20) is wired like this:

- ground on ground pin
- data on pin PC10 but I tried different pins with no success
- VCC on 3.3v pin
- a 4.7kohm resistor between the 3.3v and the data wire


Sensors (I have 3 pieces) work with Raspberry Pi so it's not a sensor problem.
Is there any issue with an 1-wire interface on Orange Pi Zero 2 boards? Or should I set it differently?

0

threads

1

posts

6

credits

Novice

Rank: 1

credits
6
Published in 2023-8-23 16:45:03 | Show all floors
This post was finally edited by JohnB at 2023-8-23 16:52

Hello, also faced this problem.


my board is OrangePi Zero2 1GB

OS : debian 3.0.6 Bullseye (Orange Pi 3.0.6 Bullseye)


Does not work because there is no device tree file (in the /boot/dtb/allwinner/) you need to create it.


How to:

1. You need to create text file "sun50i-h616-w1-gpio.dts"

/dts-v1/;
/ {
        compatible = "xunlong,orangepi-zero2\0allwinner,sun50i-h616";

        fragment@0 {
                target = <0xffffffff>;

                __overlay__ {

                        w1_pins {
                                pins = "PC9";
                                function = "gpio_in";
                                phandle = <0x01>;
                        };
                };
        };

        fragment@1 {
                target-path = [2f 00];

                __overlay__ {

                        onewire@0 {
                                compatible = "w1-gpio";
                                pinctrl-names = "default";
                                pinctrl-0 = <0x01>;
                                gpios = <0xffffffff 0x02 0x06 0x00>;
                                status = "okay";
                        };
                };
        };

        __symbols__ {
                w1_pins = "/fragment@0/__overlay__/w1_pins";
        };

        __fixups__ {
                pio = "/fragment@0:target:0\0/fragment@1/__overlay__/onewire@0:gpios:0";
        };

        __local_fixups__ {

                fragment@1 {

                        __overlay__ {

                                onewire@0 {
                                        pinctrl-0 = <0x00>;
                                };
                        };
                };
        };
};


2. After you need to compile it, with command "dtc -O dtb -o sun50i-h616-w1-gpio.dtbo sun50i-h616-w1-gpio.dts"

3. Copy it too /boot/dtb/allwinner/overlay/

4. Reboot All done:)




You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list