Day35 - IIO + DRDY GPIO + IRQ Integration¶
Overview¶
This day extends the IIO I2C driver by introducing data-ready (DRDY) interrupt signaling.
Key idea:
- Move from polling (pull model) to interrupt-driven (push model)
- Establish the pipeline:
This prepares the system for IIO trigger/buffer mode (Day36).
System Architecture¶
STM32 (fake sensor)
├── sensor_reg (register model)
├── sensor_task (sample update)
├── sensor_gpio (DRDY pulse)
└── i2c_slave (transport)
↓ I2C + GPIO
Linux
├── I2C driver
├── IRQ handler
└── IIO framework (direct mode)
DRDY Signal Design¶
Design Choice¶
- Active-low pulse
- Triggered on new sample
- Non-blocking, time-controlled
Implementation Flow¶
GPIO Pulse Model¶
STM32 Side¶
- DRDY asserted via GPIO
- Pulse width controlled in
sensor_gpio_process()
Why Pulse Instead of Level?¶
| Mode | Problem |
|---|---|
| Level | IRQ storm or no re-trigger |
| Pulse | Clean edge trigger |
Linux IRQ Integration¶
Device Tree¶
Driver Integration¶
IRQ Handler¶
(Current stage: no data consumption yet)
Data Flow¶
Comparison with Day34¶
| Day34 | Day35 |
|---|---|
| polling read | interrupt notification |
| CPU pulls data | sensor pushes event |
| no IRQ | GPIO interrupt |
Key Concepts¶
1. Sensor must be explicitly configured¶
Driver must enable:
- measurement engine
- DRDY interrupt
2. IRQ is only a trigger, not data path¶
3. Separation of concerns¶
| Layer | Responsibility |
|---|---|
| sensor_task | generate data |
| sensor_gpio | signal event |
| driver | receive IRQ |
| IIO | expose interface |
Limitations (Current Stage)¶
- No data consumption in IRQ
- No buffer / trigger
- DATA_READY not cleared by host
- No timestamp
Next Step (Day36)¶
- Introduce IIO trigger
- Push data into buffer
- Enable
/dev/iio:deviceX - Add timestamped samples