Roadmaps / BeagleBone / Phase 2
Phase 2 of 4 · Study weeks 5-8
Device tree, drivers and buses
This phase lets you describe real hardware to the kernel instead of poking registers from user space, so your step engine gets safe, supervised I/O. Start here: docs.kernel.org (device tree usage) and Bootlin's kernel and driver labs.
Topics every week
- Week 58 h
- Device tree syntax and the
dtccompiler compatibleand driver binding- Pin control (pinctrl) and overlays
- Reading
/proc/device-tree
Hand inAn overlay that enables one extra UART and one GPIO group, with
dmesgevidence - Device tree syntax and the
- Week 68 h
- I2C and SPI
- the IIO subsystem
- a kernel driver against
/dev/i2caccess from user space
Hand inA sensor read through its kernel driver and through raw I2C, with timings for both
- Week 78 h
- Out-of-tree kernel module
- platform driver bound by
compatible - build against the kernel headers
- threaded interrupts
Hand inA module that binds to a device tree node and handles a button interrupt
- Week 88 h
- Limit-switch design: debouncing, interrupt against polling,
enableanddirectionlines - unbinding safely
Hand inCheckpoint 2, with your predicted and measured event latency
- Limit-switch design: debouncing, interrupt against polling,
Practice projects
- IIO sensor. Add one I2C or SPI sensor with an overlay and read it through IIO. Done when the sensor appears under
/sys/bus/iio, and a script logs 1,000 readings with timestamps. - Hot unbind. Make your module survive unbind while a user process holds the device open. Done when 1,000 bind and unbind cycles with a reader attached produce no kernel warning.
- Interrupt budget. Measure interrupt-to-user-space latency for your button with and without load. Done when the p99 and the maximum are reported with the load profile from Phase 1.
Optional: port the overlay from the Debian image's kernel to a Buildroot kernel and list what differs.
GitHub repos to study
| Repo | What to read | Week |
|---|---|---|
| beagleboard/BeagleBoard-DeviceTrees (Nov 2026) | The BeagleBone Black base device tree and the overlays in src/ | 5 |
| beagleboard/docs.beagleboard.io (Apr 2026) | books/beaglebone-cookbook, the I2C, SPI and sensor chapters | 6 |
Also read the kernel's own documentation for device tree bindings and the IIO subsystem at docs.kernel.org.
Milestone checkpoint
Describe the stage's I/O to the kernel (Checkpoint 2). Make an overlay and either a small kernel driver or a libgpiod service that exposes enable, direction and limit_hit. Write the specification first: signals, pins, voltages, the latency budget and what a limit hit must do. Done when the Checkpoint 2 row passes. Evidence: the specification, the overlay, dtc output, the 1,000-cycle log, and ADR-2 on driver against user-space service.
Check yourself
Answer each question in your head first, then open it to check.
What does
compatibledo, and who reads it?The kernel matches it against driver tables to bind a driver to the node. Overlays and bootloaders also use it.How do you find which two peripherals want the same pin?
Readdmesgfor pinctrl errors, inspectpinmux-pinsunder debugfs, and check the board's pin table.When would you choose a kernel driver over
/dev/i2c?When the device needs interrupts, power management, or sharing between several users, or when another subsystem (IIO, input) should present it.What must a driver do in
remove()that you cannot skip?Stop interrupts and timers, free resources, and make sure no user process can reach freed memory.Why does a threaded interrupt handler help latency on an RT kernel?
The handler runs as a schedulable thread, so a higher-priority task can preempt it.