Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7583

Device Tree • Problem activating i2c-hid overlay

$
0
0
Hello,

I'm developing a custom keyboard using HID over I2C, and since it's supposed to work with a RPi, I'm trying to enable it on my CM4 + IO board setup.

It seems the kernel has support for HID over I2C already, so I'm running the normal bookworm kernel (installed today).

My overlay cm4-i2c-hid.dts looks like this:

Code:

// Definitions for HID over I2C/dts-v1/;/plugin/;/{    // Not sure what to leave in here for CM4?    compatible = "brcm,bcm2711", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";    // Since this is enabled, can we remove i2c_arm from config.txt?    fragment@0 {        target = <&i2c_arm>;        __overlay__ {            status = "okay";        };    };        // This sets up / reserves the interrupt pin    fragment@1 {        target = <&gpio>;        __overlay__ {            i2c_hid_pins: i2c_hid_pins {                brcm,pins = <27>;                brcm,function = <0>;            };        };    };        fragment@2 {        target = <&i2c_arm>;        __overlay__{            #address-cells = <1>;            #size-cells = <0>;            i2c_hid: i2c-hid-dev@3b {                compatible = "hid-over-i2c";                reg = <0x3b>;                hid-descr-addr = <0x0000>;                interrupt-parent = <&gpio>;                interrupts = <27 0x8>;            };                    };    };        __overrides__ {        gpiopin = <&i2c_hid_pins>, "brcm,pins:0",                    <&i2c_hid>, "interrupts:0";        addr = <&i2c_hid>, "reg:0";        };        };
This is compiled and installed:

Code:

dtc -O dtb -o cm4-i2c-hid.dtbo -b 0 -@ cm4-i2c-hid.dtssudo cp cm4-i2c-hid.dtbo /boot/overlays/
I add this line to config.txt:

Code:

dtoverlay=cm4-i2c-hid
The I2C bus works, I can see my custom device on address 0x3b with i2cdetect -y 1:

Code:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f00:                         -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- 3b -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
But it should show as `UU` ?

The debug info looks as follows:

Code:

007778.873: dtdebug: Opened overlay file 'overlays/cm4-i2c-hid.dtbo'007779.619: brfs: File read: /mfs/sd/overlays/cm4-i2c-hid.dtbo007786.662: Loaded overlay 'cm4-i2c-hid'007796.033: dtdebug: merge_fragment(/soc/i2c@7e804000,/fragment@0/__overlay__)007796.051: dtdebug:   +prop(status)007796.612: dtdebug: merge_fragment() end007797.656: dtdebug: merge_fragment(/soc/gpio@7e200000,/fragment@1/__overlay__)007802.247: dtdebug: merge_fragment(/soc/gpio@7e200000/i2c_hid_pins,/fragment@1/__overlay__/i2c_hid_pins)007802.266: dtdebug:   +prop(brcm,pins)007803.085: dtdebug:   +prop(brcm,function)007803.909: dtdebug:   +prop(phandle)007804.715: dtdebug: merge_fragment() end007804.732: dtdebug: merge_fragment() end007812.716: dtdebug: merge_fragment(/soc/i2c@7e804000,/fragment@2/__overlay__)007812.734: dtdebug:   +prop(#address-cells)007813.272: dtdebug:   +prop(#size-cells)007817.003: dtdebug: merge_fragment(/soc/i2c@7e804000/i2c-hid-dev@3b,/fragment@2/__overlay__/i2c-hid-dev@3b)007817.018: dtdebug:   +prop(compatible)007817.541: dtdebug:   +prop(reg)007818.096: dtdebug:   +prop(hid-descr-addr)007818.946: dtdebug:   +prop(interrupt-parent)007819.483: dtdebug:   +prop(interrupts)007820.058: dtdebug:   +prop(phandle)007820.629: dtdebug: merge_fragment() end007820.646: dtdebug: merge_fragment() end
It doesn't look as if it even tries to use the I2C bus. I have a logic analyzer connected to the bus, and I can see the expected traffic from i2cdetect and i2cdump. But during boot, nothing happens on the bus at all.

What is the next step to find the problem?

Statistics: Posted by RasmusB_SE — Fri Aug 16, 2024 1:22 pm — Replies 1 — Views 29



Viewing all articles
Browse latest Browse all 7583

Trending Articles