1-wire problems

Hello.
I try to read a DS18B20 (thermal sensor) on Rockpi4B and have questions:

  • Is it possible to have 1-wire on other img than Debian buster ? More specificaly, did somebody manage to make 1-wire working on Armbian ?
  • What is the proper way to have a internal pullup signal on the 1-wire pin ?
  • Is it possible to have another pin than GPIO4_D6 ? For compatibility reasons with raspberry Pi4, I have to use GPIO2_B3.
  • Is there another way to deal with GPIO pins than the libmraa ?
    Best regards

There are threads here about that sensor in which I have taken part. Please search and read.

What is the correct procedure to get 1-wire working on a ROCK 4SE running Debian Bullseye? I’m a bit confused…

Further to my last post: I think that 1-wire is not supported for Debian bullseye4.16, is this true?

This is what I did:
sudo nano /boot/hw_intfc.conf
add to the list of overlays (this is not listed, so that is suspicious!):
intfc:dtoverlay=w1-gpio4-30

reboot then…
$ sudo modprobe w1-gpio
$ sudo modprobe w1-therm

but:
rock@rockpi-4b:/sys/bus/w1/devices$ ls
00-2a0000000000 00-aa0000000000 w1_bus_master1
the IDs are zero, so we get:
rock@rockpi-4b:/sys/bus/w1/devices$ 00-2a0000000000 w1_bus_master1
bash: 00-2a0000000000: command not found
rock@rockpi-4b:/sys/bus/w1/devices$ cat ./00-aa0000000000/w1_slave
cat: ./00-aa0000000000/w1_slave: No such file or directory

so maybe this is fixed in a later version?

I finally got 1-wire working on some debian-based distro. See my post here:

Maybe the problem I had with mraa is the same as the problem wit 1-wire?
“You have to run mraa/examples/c in root AS root, as per the instructions. This is a tad inconvenient as my application will have to run as root too, unless there is a fix by relocating a bunch of files in home/ or some other method?”
Any ideas?

In my opinion:

  1. Forget mraa: this library is obsolete, works only in buster, and there is no support for recent debian.
  2. You have to modify and compile your dt overlay to have 1-wire working on recent distro. See my post above.
  3. If you need to access to gpio, just use the Linux kernel user space interface with chardev on /dev/gpiochipxx (use standard file system open, close, read, write, etc…). You can use libgpiod for tools. You may have to gain access to userspace with a sudo chmod 777 /dev/gpio* at every reboot (crontab @reboot…)
    I found usefull info here: https://sergioprado.blog/new-linux-kernel-gpio-user-space-interface/

Good advice, but it’s getting a bit too technical for me, I am not confident with building at this level. -I just need easy GPIO access at user level from my C/C++/GPL applications, That’s not too much to ask of a sbc after all!

I have to say I’m impressed with Debian on the ROCK 4 SE, a much more pleasant experience than Pi hacked Armbian. It will seize up occasionally when running Geany for example, but it runs my two graphic apps with 60% CPU at 60deg almost as well as on my PC.

What are the simple instructions for installing libgpiod on Debian ‘stable’ Bullseye 4.16? I need PWM support - and also 1-Wire if possible…

sudo apt-get install libgpiod-dev libgpiod-doc
should work fine on Debian

That installs OK, but $# gpiodetect returns with no info. I think my kernel version is too old at 4.4, your ref. says > 4.7! I guess that needs a new build of Debian Bullseye for the ROCK 4 SE - which is not stable or supported?

You have official images on the Radxa website with 5.10 Kernel for Rockpi4 SE (Ubuntu and Debian desktop).
You could also try a dietPi for rockpi4.
And Armbian say to use model B builds for model SE. See here: https://www.armbian.com/rockpi4/

By the way… Depending of what you want to do, you could try to connect your device to a ESP32 or a 8266 or an Arduino uno, which are very low-cost and very easy to deploy, and communicate with your mainboard by MQTT or serial link. Toast a 3$ board , not a 120$ board, if something goes wrong with the voltage on gpio pins is less painfull !

OK I can try a newer image, but I’ve tried before, some refuse to startup at all…
I already have an Arduino Adafruit M4 (itzy bitzy) that does all the VERY demanding real-time stuff, interfacing with three I2C sensor cards and a 1-wire temp sensor in fact. This simply uses 1 usb/serial cable to plug into the ROCK 4SE - voila, done. Then there is an ESP32 based GPS module that uses two more usb/serial lines to both of my concurrently running graphic windows (forcing the use of separate cores - I hope). I need a sbc to handle all the graphics and it is really busy, the Pi 3 just gave up the struggle. It is a headless system so all I need urgently to do is control it with 4 buttons, and to generate some continuous sounds with PWM for loop-back into the mic input for mixing with other audio stuff. This could admittedly be handled by the Adafruit M4, but I would much prefer to use the ROCK 4 SE connector directly - it shouldn’t be this hard to do that!

For non-starting image, it could help to remove console=ttyFIQ0,1500000n8 and console=ttyS2,1500000n8 from /boot/extlinux/extlinux.conf

For my stuff (driving an aquaponic plant), I use node-red on rockpi4B, and have no more problems to use libgpiod or read 1-wire DS18B20 with armbian, after many fail/retry. But never try to use PWM.

Thanks for the tips! Do you have a link to an image with a 4.8 kernel on the download pages?
I have PWM working well with mraa, but I will have to launch my apps as root, which is not really acceptable…