Skip to content

Day35 - DRDY GPIO IRQ Integration

Objective

  • Add DRDY GPIO signaling from STM32
  • Configure Linux to receive GPIO interrupt
  • Verify IRQ flow from sensor to driver

Step 1 - STM32 DRDY Output

Ensure:

  • GPIO configured as output
  • idle = HIGH
  • DRDY = LOW (pulse)

Step 2 - Verify GPIO Pulse

Use:

  • logic analyzer / oscilloscope
  • or debug LED

Expected:

HIGH → LOW → HIGH (periodic)

Step 3 - Device Tree Configuration

Add interrupt to I2C node:

interrupt-parent = <&rp1_gpio>;
interrupts = <23 2>;

Step 4 - Verify IRQ Line

cat /proc/interrupts

Expected:

myadc_irq counter increases

Step 5 - Load Driver

sudo insmod myadc_iio.ko
dmesg | tail

Step 6 - Check IRQ Trigger

watch -n 1 'cat /proc/interrupts | grep myadc'

Expected:

counter increases continuously

Step 7 - Check Driver Log

dmesg | grep myadc

Expected:

DRDY IRQ
DRDY IRQ

Step 8 - Validate Data

cd /sys/bus/iio/devices/iio:device0

cat in_voltage0_raw
cat in_voltage1_raw
cat in_voltage2_raw

Expected:

  • values change over time
  • IRQ does not affect read correctness

Result

Verified:

  • DRDY pulse generation
  • GPIO interrupt reception
  • driver IRQ handling
  • integration with IIO direct mode