query Posted April 25, 2019 Posted April 25, 2019 Armbianmonitor: http://ix.io/1Hc5 Hi everyone, What I want to do is to use a DS18B20 through 1-Wire to read temperature on an OPi Zero. The sensor seems to be detected by the board (I see the file under /sys/bus/w1/devices/28-something), and then it disappears randomly after a reboot or a power cycle. (file goes away and obviously I can't get any readings). Then it starts working randomly again after an indefinite amount of reboots. I'm having this problem for a while now, and it's driving me absolutely crazy. This one here on the picture is the sensor I'm using. I have attached a 4.7K Ohm resistor between the VCC and Digital cables, and attached to OPi Zero as follows: VCC -> BCM pin 2 (5V, I've also tried with 3.3V) Digital -> BCM pin 26 (PA10) Ground -> BCM pin 25 After that, I've edited my /boot/armbianEnv.txt and it looks like this now: verbosity=1 logo=disabled console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 overlays=usbhost2 usbhost3 i2c0 i2c1 w1-gpio param_w1_pin=PA10 param_w1_pin_int_pullup=0 rootdev=UUID=374d182b-7b9e-4570-b7c5-519a1eb837a7 rootfstype=ext4 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u0x2537:0x1066:u,0x2537:0x1068:u0x2537:0x1066:u,0x2537:0x1068:u Also adapted the /etc/default/cpufrequtils file as follows: # WARNING: this file will be replaced on board support package (linux-root-...) upgrade ENABLE=true MIN_SPEED=480000 MAX_SPEED=1200000 GOVERNOR=interactive And the /etc/modules-load.d/modules.conf: g_serial i2c-dev w1-gpio w1-therm So, after all these modifications, I do a reboot and I can see the w1_gpio and w1_therm modules loaded in the output from lsmod, and I can see the device in /sys/bus/w1/devices/28-something I can get my readings and everything works properly. Then, I do a reboot. Here is where I get super confused, because it seems like there's no systematic error in the wiring or the kernel modules being loaded as far as I can see. But, the device disappears after the reboot. Sometimes it will get detected again, without me doing any changes in the configuration. I've already tried two of the same sensor, but it doesn't seem to make any difference, same problem still. I've also put the armbianmonitor output to the post. Looking desparately for some ideas to help me debug this problem. Thanks!
martinayotte Posted April 25, 2019 Posted April 25, 2019 3 hours ago, query said: And the /etc/modules-load.d/modules.conf: g_serial i2c-dev w1-gpio w1-therm You should not placed i2c-dev, w1-gpio and w1-therm inside /etc/modules-load.d/modules.conf, you should leave the DeviceTree doing the load of modules itself, otherwise it won't take in account the pins definitions you've provided in /boot/armbianEnv.txt
query Posted April 25, 2019 Author Posted April 25, 2019 Thanks for the reply @martinayotte 8 minutes ago, martinayotte said: You should not placed i2c-dev, w1-gpio and w1-therm inside /etc/modules-load.d/modules.conf, you should leave the DeviceTree doing the load of modules itself, So, I should remove everything in /etc/modules-load.d/modules.conf and place them accordingly into /boot/armbianEnv.txt ? I need the i2c-dev for another sensor I have. How do I do this exactly? Thanks in advance.
martinayotte Posted April 25, 2019 Posted April 25, 2019 30 minutes ago, query said: So, I should remove everything in /etc/modules-load.d/modules.conf and place them accordingly into /boot/armbianEnv.txt ? Yes, remove them from modules.conf, but don't add them in armbianEnv.txt since you've already have things properly set there : overlays=usbhost2 usbhost3 i2c0 i2c1 w1-gpio param_w1_pin=PA10 param_w1_pin_int_pullup=0 This will make the module loading properly with the proper pin PA10.
query Posted April 25, 2019 Author Posted April 25, 2019 Thank you. I think I've added those lines in the modules.conf after having this problem in the beginning, but I'll remove them and let you know how it goes.
query Posted April 25, 2019 Author Posted April 25, 2019 I've now completely removed the modules.conf file. Looks like it worked, I can reboot it now and it still detects the sensor, and I think a little bit faster than before. Thanks a lot for the tip! One thing I'm confused about though. I have already had g_serial and i2c-dev in my modules.conf before I even wired the ds18b20. After I first noticed the reboot problem I decided it wouldn't hurt to add the w1 lines there too, since I've seen some people do that. (I didn't know about the DT/modules.conf conflict) It's clear to me now that the modules should be handled by the DT. However, why did I encounter this problem in the first place with i2c-dev and g_serial only? Would those two cause any conflict for the w1 modules being loaded?
Recommended Posts