Temperature from DS18B20

Does DS18B20 work with kernel from image rockpi-4b-ubuntu-focal-server-arm64-20220701-0351-gpt.img?

I’ve just tried and there is no support for w1thermsensor in this kernel.

This sensor is not working with both kernels 113/116 from a while ago (year 2021) and newest 5+ from today.

I finally have the DS18B20 working on a new kernel (Armbian with 5.19.5-rockchip64 kernel) !!!

  1. Create and edit a w1-gpio.dts file as this:

/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";
                    };
            };
    };

};

  1. Compile it and put it where he must go (note dtc is normally installed with recents armbian):
    sudo dtc -I dts -O dtb -o /boot/dtb-5.19.5-rockchip64/rockchip/overlay/rockchip-w1-gpio.dtbo w1-gpio.dts
  2. Reboot, et voilà !!!
    sudo dmesg | grep w1
    [ 5.754498] w1_master_driver w1_bus_master1: Attaching one wire slave 10.000802e5e4d1 crc 3c

I think this trick should work with all distro using device tree (dietPi, armbian, etc…)

1 Like

Sorry, Alex, but I am not interested in malfunctioning toys like Armbian - I need DS18B20 working on OSes provided by Radxa. Do you have such solution?

@Stephen

Any news?

But armbian IS an OS provided by Raxda. Just see here:


I think ‘malfunctioning toys’ is pretty rude. My goal is to have a device for managing an aquaponic spot, so I need many thermal sensor, a ADC channel for Ph-meter, and GPIO output for relay.
Armbian make all what I want, and have an openHAB 3 (an home assistant clone opensource) software in armbian-config working perfectly with my sensors.
So, for me, armbian make the job.

Armbian is a toy for beginners. Nothing to do with real engineering. Half of the things dont work out of the box.

I understand that you dont have any solution for Debian nor Ubuntu. Thats not good.

That is completely normal - you need to read FAQ,
https://docs.armbian.com/User-Guide_FAQ/#why-does-hardware-feature-xy-work-in-old-kernel-but-not-in-more-recent-one

and your support contract. Where it doesn’t say anything about your rights to humiliate developers that donated their time to waste it for you.

You can deserve attention, support or gifts. Or not deserve.

Its up to you.

It took me 1/2 hour to have DS18B20 working on Ubuntu following my method (removing all errors founded). Here it is a copy of my lab notebook:

sudo xzcat rockpi-4b-ubuntu-focal-server-arm64-20220801-0355-gpt.img.xz | dd of=/dev/mmcblk1 bs=1M

#url ssh: rockpi-4b.local
#login/pw: rock/rock

sudo apt-get update -y
sudo apt-get -y install rockpi4-dtbo
sudo nano /boot/hw_intfc.conf

désactiver les consoles: #intfc:dtoverlay=console-on-ttyS2 et #intfc:dtoverlay=console-on-ttyS4

sudo nano /boot/extlinux/extlinux.conf
#remove console=ttyFIQ0,1500000n8 and console=ttyS2,1500000n8
sudo reboot

############################

Removing errors messages

############################
dmesg | grep w1
[ 20.024497] rockchip-pinctrl pinctrl: unable to find group for node w1_pins
[ 20.028947] w1-gpio: probe of onewire@0 failed with error -22

sudo apt-get -y install device-tree-compiler
sudo nano new_w1-gpio.dts

#copy and paste next lines*************************************
/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";
                    };
            };
    };

};
#end copy/paste ***********************************************

sudo mv /boot/overlays/w1-gpio4-30.dtbo /boot/overlays/w1-gpio4-30.old
sudo dtc -I dts -O dtb -o /boot/overlays/w1-gpio4-30.dtbo new_w1-gpio.dts
sudo reboot

###################

CHECKING RESULT

###################
dmesg | grep w1
[ 18.592842] w1_master_driver w1_bus_master1: Attaching one wire slave 10.000802e5e4d1 crc 3c
YEEEEEESSSSS !!!

cat /sys/bus/w1/devices/10-000802e5e4d1/w1_slave
35 00 4b 46 ff ff 07 10 98 : crc=98 YES
35 00 4b 46 ff ff 07 10 98 t=26312

I have nothing to do with developers, I am not offending anyone. I am scoring result of someone’s work which is poor. These are things, not people.

I tried your solution and needed to fix " characters to compile.

However sensor still is not visible in /sys/... folder.

The valid file:

/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 command:

dtc -I dts -O dtb -o destination_file.dtbo source_file.dts

Oh, you are. With “malfunctioning toys” you are offending developers of open source community, Armbian developers and all projects that are using Armbian work. Basically complete single board computers ecosystem. Most of other projects can only be behind in the sense you are exposing.

Who is in the position to judge work that is provided for free and in best effort manner? Armbian (and developers in open source community at large) pay for what you get and for your education, which sadly doesn’t work well … just a small % of this “toying” gets some sort of compensation despite most of people that maintain Armbian finance everything and are developers super starts with decades of professional experiences. Its not about not getting there, but your attitude you are blaming gift giver for the quality of the gift.

If you are not happy, use something else, just ****.

If you want functions to work with modern kernel, you should be happy that you know someone that might help you. This is not something easy to find even you are loaded with bags of cash. But if you are asking or implying its sponsors duty to develop some features for you on their expense, you are again insulting someone.

No, Igor, I am offending purely destroyed and shameful OS which tries to work, but it can’t.
And you have your own financial reasons to put it that way and you will never do anything positive about that. Everybody knows that. You are doomed to failure. Forever.

I am in IT since 1985 and I am judging a substitute (Armbian) of a Linux OS. Because I can. I spent month with Armbian and I will never come back to it. Your advertising of this system in my posts is not welcome.

I will be using everything else than Armbian and I will much more happy with my choice - I know that now and I will know that later.

Don’t offend yourself by defending poor OS. That means if you defend it - you have reasons for that defence.

I put you in ignore state as I cannot handle that much loads of bs.

Features that doesn’t work in this shameful OS, doesn’t work in any other. This means you are bashing all open source community work. You have no rights to do that.

This FAQ can unblind you a bit:
https://docs.armbian.com/User-Guide_FAQ/

… except in OS that is build with a proprietary kernel that makes you happy, but is not acceptable by many, but for other reasons. If you don’t understand that, perhaps you need to do some education. You think you are too old for that? You think you know it all? Do you think people that knew how to assemble computer in 1995 doesn’t require update on primer reality? I have 10 years of experiences with embedded Linux out of 30 years of Linux. I was running Unix server before Linus released Linux. But I understand my limits - there are a lot smarter people then me in the group that is making that shameful OS. And around that. Which is again - your only alternative. How the only alternative be such a big shit? Perhaps there is something you don’t understand?

Its dirty cheap to provide “non shameful OS” with the same static smelly hardware interface, where all chip hardware function works but many other features doesn’t. That doesn’t make one professional and the other one amateur. While the truth is right the opposite. Its always a trade and with Armbian, this is stated clearly - you should know what you are getting. Armbian is a build system first. HW functions are HW vendor expenses and their responsibility, not from shameful OS. If you can’t get that, there is really waste of time discussion with you.

You are clearly not a customer, since you expect others to waste money for your problems. You purchased hardware and you want top software support for your money even most of the software is community work. Good luck … I don’t care what OS you will use. But if you will be bashing our community work, I will say speak up.

https://si.linkedin.com/in/igorpecovnik

O Stuard, what do you do for living?

Nothing as disabled now for 20 years, but never was a professional bull shitter either.

I see. Makes sense.

These opinions are my own and not of the imaginary man in the sky” or do you like “Opinions are my own and not the views of my employer” better?

I never served as politician or similar and I am not paid to provide opinions. See? Both of us are just amateur bull shitters :wink: Professionals are quiet and does the job.

Imagine that random people that are not your friends, have no intention to become, not your clients to be, would every day fight with you to steal your time for their purpose. Because they are just lazy, disrespectful, stupid, … This BS you are referring to is defending, fighting, reasoning, clarification, … its a part of the job people say and this is unlikely to change. Regardless of what you or me thinks about all this.

I have been struggling to get DS18B20 sensors working on a new Rock 4C+ board, using the latest Radxa Ubuntu Focal release and 4.4.194-11-rk3399 kernel (and a whole heap of other distros/kernels). Sensors confirmed working with same setup on a Pi4B.

On 4C+ the sensor is detected and listed under /sys/bus/w1/devices/ however on reading w1_slave the data returned is corrupt/invalid, eg

ff ff ff ff ff ff ff ff ff : crc=c9 NO
00 00 00 00 00 00 00 00 00 t=-62

After much searching and head banging, I came across a hint in another forum (for a different board) that cpu frequency scaling may be an issue… further experimentation has led me to insert the following line into /etc/rc.local which seems to resolve the issue with reading 1-wire DS18B20 sensors, for me at least :slight_smile:

echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq

@Stephen I’ve seen you reply to a number of related issues/queries, may be of interest.

1 Like