0

I'm trying to enable the second (GPIO-based i2c) on RPi Zero 2 W, Ubuntu server 20.04 to connect the following sensor. Note that the primary i2c pins are physically occupied as RPi is used as a hat for another board. I've read tons of articles / similar questions, but have no luck detecting the sensor.

Here's my /boot/config.txt:

start_x=1
enable_uart=1
dtparam=i2c_arm=on 
dtoverlay=i2c-gpio,bus4,i2c_gpio_delay_us=8,i2c_gpio_sda=23,i2c_gpio_scl=24

Here's the actual wiring: wiring

I've also added 2x4.7 resistors for SDA and SCL according to recommendations. Well, I tried w/o resistors as well.

When I run i2cdetect -l, I see only a default bus:

ubuntu@rpi:~$ i2cdetect -l
i2c-1   i2c         bcm2835 (i2c@7e804000)              I2C adapter

Which obviously gives nothing for i2cdetect -y 1:

ubuntu@rpi:~$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

I see a sensor only if I connect it to the primary i2c port:

ubuntu@rpi:~$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77 

Here's additional system info:

ubuntu@rpi:~$ uname -a
Linux rpi 5.4.0-1050-raspi #56-Ubuntu SMP PREEMPT Thu Jan 13 13:09:35 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Note that I've already tried to upgrade the kernel, but it seems like Ubuntu 20.04 has stuck on the 5.4 version.

Here's dmesg log.

Any thoughts would be greatly appreciated.

3

2 Answers 2

0

dtoverlay=i2c-gpio works on Raspberry Pi OS-Buster and reports
i2c-22 i2c ffffffff00000002.i2c I2C adapter

dtoverlay=i2c-gpio,bus=4 works

Who knows what Ubuntu does (or supports) as it uses its own kernel?

0

After a number of experiments, I came up with the fact that Ubuntu on RPi ignores /boot/config.txt settings for some reason (or just overwrites them) in favor of /boot/firmware location. I examined /boot/firmware/syscfg.txt and found the same settings there. So then I've just blindly added dtoverlay=i2c-gpio,... to syscfg and after reboot, my i2c sensor magically appeared in the list. That's weird and disappointing as all the guides mention /boot/config.txt as a single point of truth. I wasted so many hours on that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.