Score:0

Additional i2c_gpio is not detected on Ubuntu Server 20.04 / RPi Zero 2 W / A+

pg flag

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.

Any thoughts would be greatly appreciated.

UPDATES

  • 2022/01/31: added dmesg logs.
ch flag
Do you see something interesting regarding your interface in `dmesg` output?
Sergey Korol avatar
pg flag
@Serg I updated the post with a link to dmesg log. I see some issues with spi and encodings. But I'm not sure if it has a direct relationship with the original problem. Maybe you can find something interesting there.
ch flag
It's hard to say definitely in your case as you tried many things. First, maybe omit bus definition, i.e. remove `bus4` from `dtoverlay` - let it be provided by system. And also maybe try to explicitly enable support of appropriate `i2c-rtc` device.
Sergey Korol avatar
pg flag
@Serg tried to remove the bus, but it didn't help. Not sure regarding an explicit `i2c-rtc` device support though. Did you mean smth like this: https://gist.github.com/Lahorde/2bc5e4a3b69fc6ca5797?
ch flag
Yes, something of that kind as you provided in GitHub link.
Score:0
pg flag

Ok, 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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.