Day23 - I2C Sensor Interrupt¶
Objective¶
Enable interrupt-driven update for I2C sensor driver.
Step 1 - Modify Device Tree Overlay¶
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2712";
fragment@0 {
target = <&rp1_gpio>;
__overlay__ {
my_sensor_pins: my_sensor_pins {
brcm,pins = <23>;
brcm,function = <0>;
brcm,pull = <2>;
};
};
};
fragment@1 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
myi2c_sensor@48 {
compatible = "myvendor,myi2c-sensor";
reg = <0x48>;
interrupt-parent = <&rp1_gpio>;
interrupts = <23 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&my_sensor_pins>;
};
};
};
};
Step 2 - Rebuild and Load¶
Step 3 - Verify Driver Probe¶
Expected:
- probe success
- IRQ registered
Step 4 - Check Interrupt Entry¶
Step 5 - Trigger Interrupt¶
Press STM32 button.
Expected:
- interrupt counter increases
Step 6 - Test Script¶
Optional - Live Monitor¶
Result¶
- IRQ successfully triggered
- Driver reacts to hardware interrupt