creating overlay for device on i2c bus 11 Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
flykarlos
Posts: 1
Joined: Fri Sep 17, 2021 8:19 pm

creating overlay for device on i2c bus 11

Post by flykarlos »

Dear DietPi users!

Its the beginning of my adventure with DietPi OS, and Im really happy with performance of the system and how nicely it is maintained.
Since two weeks im working on my first serious project using:
RPi Zero W
Hyperpixel 2.1 round display https://shop.pimoroni.com/products/hyperpixel-round,
Waveshare UPS Hat https://www.waveshare.com/wiki/UPS_HAT_(C)
and Waveshare Serial Expansion Hat https://www.waveshare.com/wiki/Serial_Expansion_HAT.

As the display uses all GPIO pins available on RPI zero, designers provided separate I2C bus brekout on the back on the display.
So I am connecting serial expansion hat there. After installing display drivers display works like a charm, also when I run i2cdetect -l to list available i2c buses I receive this output:

Code: Select all

root@DietPi:~# i2cdetect -l
i2c-11	i2c       	i2c@0                           	I2C adapter
So i2c-11 bus is detected. Scaning across Bus 11 gives me output:

Code: Select all

root@DietPi:~# i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- 15 -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- 43 -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  
0x15 is touchscreen interface
0x43 is UPS Hat interface
0x48 is Waveshare Serial expansion Hat (SC16IS752)

After installing scripts to make readouts on UPS board status via its I2C interface all is working (I had to change I2C Bus 1 to I2C Bus 11 in python script).

Now comes problematic part.
To make SC16IS752 expansion hat to work I have to add its overlay to /boot/config.txt file. But according to info I found somewhere, overlay provided with kernel is hardcoded to use I2C1 Bus. So I have to create overlay with I2C11 specified as target. So I downloaded sc16is752-i2c-overlay.dts (https://github.com/raspberrypi/linux/tr ... s/overlays), opened it with nano, changed

Code: Select all

target = <&i2c_arm>;
to

Code: Select all

target = <&i2c11>;
and created .dtbo:

Code: Select all

dtc -@ -I dts -O dtb -o sc16is752-i2c11.dtbo sc16is752-i2c11-overlay.dts
and then placed in /boot/overlays. I was trying to use it writing

Code: Select all

dtoverlay=sc16is752-i2c11
to /boot/config.txt. Then of course reboot. When testing it via i2cdetect:

Code: Select all

root@DietPi:~# i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- 15 -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- 43 -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  
shows me 48 address, which means that overlay was not loaded. To see what's the problem Im trying to load overlay dynamically running command in terminal:

Code: Select all

dtoverlay sc16is752-i2c11
In response I get:

Code: Select all

* Failed to apply overlay '0_sc16is752-i2c11' (kernel)
to se more details I run dmesg, which says:

Code: Select all

[ 7071.544733] OF: resolver: node label 'i2c11' not found in live devicetree symbols table
[ 7071.544764] OF: resolver: overlay phandle fixup failed: -22
when I list symbols:

Code: Select all

root@DietPi:~# ls /sys/firmware/devicetree/base/__symbols__/
act_led			gpclk1_gpio44	  mmcnr		 spi2
alt0			gpclk1_gpio5	  name		 spi2_gpio40
audio			gpclk2_gpio43	  pcm_gpio18	 spidev0
audio_pins		gpclk2_gpio6	  pcm_gpio28	 spidev1
aux			gpio		  pixelvalve0	 system_timer
axiperf			gpioout		  pixelvalve1	 thermal
bt			hdmi		  pixelvalve2	 txp
bt_pins			hvs		  pm		 uart0
cam1_reg		i2c		  power		 uart0_ctsrts_gpio16
clk_osc			i2c0		  pwm		 uart0_ctsrts_gpio30
clk_usb			i2c0_gpio0	  pwm0_gpio12	 uart0_ctsrts_gpio38
clocks			i2c0_gpio28	  pwm0_gpio18	 uart0_gpio14
cma			i2c0_gpio44	  pwm0_gpio40	 uart0_gpio32
cpu_thermal		i2c0_pins	  pwm1_gpio13	 uart0_gpio36
csi0			i2c0if		  pwm1_gpio19	 uart0_pins
csi1			i2c0mux		  pwm1_gpio41	 uart1
dma			i2c1		  pwm1_gpio45	 uart1_ctsrts_gpio16
dpi			i2c1_gpio2	  random	 uart1_ctsrts_gpio30
dpi_18bit_cpadhi_gpio0	i2c1_gpio44	  rmem		 uart1_ctsrts_gpio42
dpi_18bit_cpadhi_gpio2	i2c1_pins	  sdhci		 uart1_gpio14
dpi_18bit_gpio0		i2c2		  sdhost	 uart1_gpio32
dpi_18bit_gpio2		i2c_arm		  sdhost_gpio48  uart1_gpio40
dpi_gpio0		i2c_csi_dsi	  sdio_pins	 uart1_pins
dsi0			i2c_slave_gpio18  smi		 usb
dsi1			i2c_vc		  soc		 usbphy
emmc_gpio22		i2s		  sound		 v3d
emmc_gpio34		i2s_pins	  spi		 vc4
emmc_gpio48		intc		  spi0		 vchiq
fb			jtag_gpio22	  spi0_cs_pins	 vcsm
firmware		jtag_gpio4	  spi0_gpio35	 vdd_3v3_reg
firmware_clocks		leds		  spi0_gpio7	 vdd_5v0_reg
firmwarekms		mailbox		  spi0_pins	 vec
gpclk0_gpio4		minibt		  spi1		 watchdog
gpclk1_gpio42		mmc		  spi1_gpio16
indeed there's nothing similar to i2c11. But during .dtbo creation process I added -@ parameter which should generate __symbols__ entry for i2c11..

What could be cause of this? Is there a way to generate __symbols__ entry for specific device?

thanks for any help or advice,
Karol
User avatar
Joulinar
Posts: 6072
Joined: Sat Nov 16, 2019 12:49 am

Re: creating overlay for device on i2c bus 11

Post by Joulinar »

issue has been posted on GitHub as well https://github.com/MichaIng/DietPi/issues/4754

Investigation will continue over there.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply