Howto setup I2C and 1-wire (DS18B20) on a NanoPi NEO Air? Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
thomaspfeiffer

Howto setup I2C and 1-wire (DS18B20) on a NanoPi NEO Air?

Post by thomaspfeiffer »

Hi,

first thanks for fixing the wifi bug at the NanoPi NEO Air [1] very fast!

Now i've got two new issues at the latest DietPi image (rev 141, DietPi 4.9.0-sun8i):

1) I2C seems to be disabled:
root@DietPi:~# dietpi-software list | grep i2c
id 72 | =0 | i2c: enables support for i2c based hardware | disabled for hw_model

How can i enable i2c at my NanoPi?


2) I failed to setup the 1-wire bus:
modprobe w1_gpio
modprobe w1-therm
both seem to work
root@DietPi:~# dmesg | grep wire
[ 1036.997465] Driver for 1-wire Dallas network protocol.

But in /sys/devices/ i do not see any 1-wire directory.

How can i setup 1-wire properly?

Thanks very much!
Thomas

[1] http://dietpi.com/phpbb/viewtopic.php?f=9&t=886
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: Howto setup I2C and 1-wire (DS18B20) on a NanoPi NEO Air

Post by Gord_W »

Hi,

You should try the latest NanoPi Neo version 141. The kernel has been changed to 4.9 and I believe one of the changes incorporated in 4.9 was I2C support for H3 processors.

Then in config.txt file in boot there are some i2C dtparam you can turn on.

About a year ago when I was playing with ds3231 hardware clock I added

Code: Select all

#----- Hardware Clock -------- GW addition for DS3231 This will also turn on i2c
dtoverlay=i2c-rtc,ds3231
to the config.txt file. I didn't need to explicitly turn on i2c as this command did it as well.

I've no idea whether that would fix your problem. You would have to try it to see.

As another thought you could look at the dietpi-software code for how to enable it if it wasn't blocked.

Gordon Williams
thomaspfeiffer

Re: Howto setup I2C and 1-wire (DS18B20) on a NanoPi NEO Air

Post by thomaspfeiffer »

Gord_W wrote: I've no idea whether that would fix your problem. You would have to try it to see.
Thanks for your hints, Gordon! Unfortunately it didn't work. You're talking about a NanoPi NEO, right? I'm using an Air, which might make the difference.

Additionally i found this script:
/DietPi/dietpi/func/dietpi-set_hardware i2c enable
which doesn't enable i2c as well.

Code: Select all

root@DietPi:~# i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
root@DietPi:~# i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
root@DietPi:~# 
Post Reply