RPI4 USB Boot : i2c-gpio overlay (OS 2.53.12)

I’ve successfully been able to boot a PI 4 via USB. Only issue I am having is that enabling i2c-gpio overlay prevents the Pi from booting. The Pi will fail if I add the following to config.txt:
If I remove this then it will boot successfully again. I know there are additional i2c busses but unfortunately board I am interfacing with was done before the PI 4 so pins don’t align.

As a workaround I have attempted to dynamically add overlays via dtoverlay command from Host OS, however, this also gives me issues regardless of overlay I try…

root@e5814b7:~# dtoverlay -v -d /resin-boot/overlays i2c-gpio bus=3 i2c_gpio_delay_us=1 i2c_gpio_sda=8 i2c_gpio_scl=7
DTOVERLAY[debug]: Found override bus
DTOVERLAY[debug]:   override bus: cell target reg @ offset 0 (size 4)
DTOVERLAY[debug]: Found override i2c_gpio_delay_us
DTOVERLAY[debug]:   override i2c_gpio_delay_us: cell target i2c-gpio,delay-us @ offset 0 (size 4)
DTOVERLAY[debug]: Found override i2c_gpio_sda
DTOVERLAY[debug]:   override i2c_gpio_sda: cell target gpios @ offset 4 (size 4)
DTOVERLAY[debug]: Found override i2c_gpio_scl
DTOVERLAY[debug]:   override i2c_gpio_scl: cell target gpios @ offset 16 (size 4)
DTOVERLAY[debug]: delete_node(/__symbols__)
DTOVERLAY[debug]: Wrote 1023 bytes to '/tmp/.dtoverlays/0_i2c-gpio.dtbo'
DTOVERLAY[debug]: Wrote 1080 bytes to '/sys/kernel/config/device-tree/overlays/0_i2c-gpio/dtbo'
* Failed to apply overlay '0_i2c-gpio' (kernel) 

Hello! Which os version did you use?

OS version is 2.53.12

Hi, when you add that overlay, are you removing the existing vc4-fkms-v3dwhich is defined there in the dashboard?

No both overlays are defined.


I noticed you mentioned adding this to config.txt but if you do this the API will change it back after a reboot. Could you add it via the Host Configuration options in the Dashboard and see if it makes a difference. Thanks.

Hey rich, I usually do specify via fleet configuration. When I do it this way the Pi will go online, apply the config changes, reboot, and never go back online. If I go and remove the i2c-gio the Pi will boot up and process will repeat.

To add to the problem, it looks like that if we flash a fresh Balena OS 2.53.12 for a given app to an SD Card (not USB boot) that has i2c-gpio defined in fleet configuration the Pi will apply settings, reboot, and never go online again. If we revert to OS 2.51 the problem goes away.

So I think the issue is the latest i2c-gpio.dtbo in OS 2.53.12 is bad. I copied i2c-gpio.dtbo from a mounted 2.51.1 image and replaced 2.53.12 version. Once I did this the device works as normal using i2c-gpio overlay. It works whether booted from SD card or USB boot. So looks like some regression/bug was introduced into latest i2c-gpio overlay.

For more context, looks like similar issue reported below and fixed in kernel (5.4): https://github.com/raspberrypi/firmware/issues/1401

Hi @adamp – thanks very kindly for the additional information, this definitely helps narrow things down. Just to check, it looks like you have filed a bug for this here; have I got this right? In any case, it seems like this bug captures the issue. I’ll add a note reporting your finding to that report. Once it is resolved, you should get notified automatically.

Thanks again,

No problem. Balena has been an awesome asset for our company. The linked bug is indeed mine.