ECE 440 · Week 2
Modern Computer: Full Stack
A pinmux row has a pad, the function you claim, the function you must not claim, and an electrical limit.
Week 2 of 10 · Solitude
ECE 440 · Week 2 · In class
A pinmux row has a pad, the function you claim, the function you must not claim, and an electrical limit.
- Fill the four cells from the board's device tree for the header device your driver will bind.
- The graded page is the table, not an overlay listing.
- The overlay file stays in the repository.
ECE 440 · Week 2 · In class
The pin number for your pad is the number the station sheet prints for that pad.
- Copy it, and write the function you will leave alone.
- These notes do not print a second pin list.
- On the second pass, add one pad you will not claim, then take it off the graded page.
ECE 440 · Week 2 · Lecture
Each pin has a role on this board
- 5 V
- 3.3 V
- Ground
- I2C
- SPI
- UART
- PWM
- TDM
- PDM
Colours as on the Solitude pinout, where each pin's name is. The square pad is pin 1.
ECE 440 · Week 2 · Lecture
Pad, pin, function
- A pad is a physical connection on the chip; a header pin is where a pad reaches the board's edge.
- Each pad can carry one of several functions: GPIO, a UART line, an I2C line, and so on.
- The pin controller picks one function per pad. Two drivers cannot both own a pad.
- Claiming a function means some other function on that pad is now off.
ECE 440 · Week 2 · Lecture
How the device tree claims a pad
&mydev {
pinctrl-names = "default";
pinctrl-0 = <&mydev_pins>;
status = "okay";
};
pinctrl-0points at a pin group node the pin controller defines.- When the driver probes, the kernel applies the "default" state before
probe()runs.
ECE 440 · Week 2 · Lecture
Reading what is claimed now
# the tree the kernel booted with
dtc -I fs -O dts /proc/device-tree > live.dts
# which pads are claimed, and by whom (root, debugfs)
ls /sys/kernel/debug/pinctrl/
cat /sys/kernel/debug/pinctrl/*/pinmux-pins
Each row of pinmux-pins names a pad and the device that owns it, or says it is unclaimed.
ECE 440 · Week 2 · Lecture
The four columns
| Column | Where it comes from |
|---|---|
| Pad | The pin group in the device tree |
| Function claimed | The group your node selects |
| Function not claimed | Another function the same pad offers |
| Electrical limit | The header's I/O voltage and drive current |
ECE 440 · Week 2 · Lecture
Electrical limits are part of the row
- Header I/O runs at the pad's I/O voltage; a higher voltage on an input can damage the chip.
- A pad sources or sinks a limited current: drive a load through a transistor, not straight from the pad.
- Internal pull-ups set in the device tree are weak; an I2C bus relies on proper resistor pull-ups, on the board or the device.
ECE 440 · Week 2 · Lab
Lab
- For the header device your driver will bind, fill a pinmux table from the board's device tree: the pad, the function you claim, the function you must not claim, and the header's electrical limit.
- The overlay file stays in the repository. The graded page is the table. Second pass: add one more pad you will not claim, then remove it from the graded page.
ECE 440 · Week 2 · Lab
Lab (continued)
- Assemble the lab hand-in: The pinmux table: pad, function claimed, function that must not be claimed, and the electrical limit.
ECE 440 · Week 2 · Lab
Hand in
The pinmux table: pad, function claimed, function that must not be claimed, and the electrical limit.
ECE 440 · Week 2 · Homework
Homework
- Write the header pin number the lecture assigns to your pad, and the function you will leave alone, as a sentence.
ECE 440 · Week 2 · Homework
Turn in
The pin number and the function left alone.
ECE 440 · Week 2 · Read
Read
On the lab site: Module 9, Device tree and pin multiplexing, explains muxing. This week grades the four-column table.
ECE 440 · Week 2 · Next
Week 3
No Monday lecture.