Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Kernel-driver activation at startup does not work - Rasbian Bullseye 64-bit RPI4

516 Views - Created 18/04/2022

18/04/2022

Posted by:
hwissing

hwissing Avatar

Hello,

I've just installed 64-bit Bullseye on my Pi 4. I want to use the Kernel driver not owfs, because of duplicates I've seen with buster beforehand. The problem could not completely resolved.

I followed your knowledge base article "Using the 1-Wire w1 Subsystem with the 1 Wire Pi".

Enabling the ds2482 kernel driver at runtime worked fine and the slaves could be accessed. However following your "Starting w1 at boot time" does not work. With i2cdetect I do not see DS2482 blocked by the system as during runtime. There is also no filesystem generated. i thnik there

I wonder, whether intitialisation of DS2482 should be made in /boot/config.txt via dtoverlay rather than in rc.local. However I do not know the correct syntax for adding the respective line to config.txt.

What is to do with several DS2482.

Somewhere I read, that there is an addon to the kernel driver, which makes simultaneous support available. Unfortunately I've lost the link. Have you also heard about that?

Regards

H. Wissing

19/04/2022

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi H. Wissing

I have just tried setting up a new install of 64-bit Bullseye on a Pi 4 and it appears to be working correctly using the rc.local file to initialise the 1 Wire Pi.

Did you put the modprobe text above the “exit 0” line? If it is below “exit 0” the commands will not be executed.

This is what my rc.local file contains.


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

modprobe ds2482
sh -c "echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device "
modprobe wire

exit 0


With several DS2482 devices, you can mount them in the same way as a single device. For example, if you have a device on address 0x18 and another on 0x1a you would use the following commands.


modprobe ds2482
sh -c "echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device "
sh -c "echo ds2482 0x1a > /sys/bus/i2c/devices/i2c-1/new_device "
modprobe wire


I tested this on my Raspberry Pi using two 1 Wire Pi Plus boards and the devices connected to both boards appeared in the "/sys/bus/w1/devices/" directory.

20/04/2022

Posted by:
hwissing

hwissing Avatar

Hi,

thank You for Your time!

Beside the activation of 1-wire-system, in my rc.local a RTC should be initiated. When I comment out that, 1-wire works.

Both variants of RTC initiation interfere with starting the RTC which is loaded via dtoverlay=i2c-rtc,ds3231


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

# Echtzeituhr lesen und Systemzeit setzen
#echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 
#sh -c "echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device "

#1-wire System aktivieren

modprobe ds2482
sh -c "echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device "
modprobe wire


exit 0


That's a working rc.local for 1-wire. Now I have to care about thr RTC :(

Regards

H. Wissing

Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.