Why a software engineer reads schematics
4 min readIn the previous lesson you wired a serial adapter to a board and watched it boot. That worked because the wiring was simple. The moment something does not work, you face a question software cannot answer: is the fault in the code or in the hardware? An embedded Linux engineer answers it by reading three documents: the board schematic, the datasheet of the chip in question, and the reference manual of the SoC. This lesson teaches you to read all three, and then to confirm what they say with a multimeter, an oscilloscope and a logic analyser.
A a drawing that shows components as symbols and the electrical connections between them as lines or named nets, without showing physical placement uses a small set of conventions. Every part has a reference designator: R for resistors, C for capacitors, L for inductors, D for diodes, Q for transistors, U for integrated circuits, J or P for connectors, TP for test points. A wire that leaves the page is replaced by a net label, so two pins with the same label are connected even if no line joins them. A name such as RESET_N, nRESET or RESET# usually means the signal is active low: the event happens when the line is pulled to ground, not when it goes high.
Four things appear on almost every page, and learning to see them quickly is most of the skill.
Power rails. A rail is a net held at a fixed voltage, named after it: 5V, 3V3, 1V8, or VDD, VDDIO and VCC for a chip's supply pins. A board usually starts from one input, often 5 V from USB or a barrel jack, and a regulator or power-management chip derives lower rails from it. Following the rails from the connector to every chip tells you which voltage each part runs at, and therefore which logic level its pins speak.
Ground. Ground (GND, VSS) is the zero-volt reference every other voltage is measured against. A voltage has no meaning without a reference, which is why the earlier serial wiring needed a shared ground wire. Large boards connect many ground symbols to one copper plane, and a measurement taken against any of them gives the same answer.
Decoupling capacitors. Near each power pin of a digital chip you will see a small capacitor to ground, often 100 nF. When a chip switches thousands of transistors in a nanosecond it demands a sudden pulse of current. The power supply is too far away, and its wiring has too much inductance, to answer that fast, so the local a small capacitor placed next to a chip's supply pin that stores charge and supplies the chip's fast current spikes, keeping the local rail steady does. You rarely change these, but their absence or a bad one explains random resets that no software change fixes.
Pull-up and pull-down resistors. A a resistor, typically between a few hundred ohms and tens of kilohms, that connects a signal line to the supply rail so the line sits at logic high unless something pulls it low gives a line a default level. A pull-down does the same toward ground. You will meet them on reset lines, chip-select lines, I2C buses and boot-mode pins, and the next sections explain each use.
DNP or DNF on a schematic means do not populate: the footprint exists but no part is fitted, and a 0 ohm resistor is a deliberate jumper, so the board in your hand may differ from the design.
Reading a datasheet
3 min readA datasheet is the manufacturer's contract for one part. Reference manuals go deeper into register behaviour for complex chips, but the datasheet is where electrical truth lives. Open one and look for these sections, usually in roughly this order.
Pinout and pin description. The package drawing numbers every pin, and a table gives each pin's name, direction, supply domain and alternate functions. On an SoC, one physical ball can be a GPIO, a UART transmit line or an SPI clock, depending on how it is configured. This is the table you consult before writing a device tree.
Absolute maximum ratings. This table lists the limits beyond which the part can be damaged, such as the highest voltage on any pin, the highest supply voltage, the junction temperature and the ESD rating. These are stress limits, not operating limits. The manufacturer does not promise correct behaviour at those values, and long exposure near them shortens life. A typical rule written in many datasheets is that a pin must not exceed its supply voltage by more than a few tenths of a volt. That is why a 5 V signal on a 3.3 V pin is a design fault even if the chip survives the first try.
Recommended operating conditions. This is the range inside which the manufacturer guarantees the part meets its specification: supply voltage window, temperature range, and the legal input voltage range. Your design lives here, not at the absolute limits.
Electrical characteristics. The DC tables give the input threshold voltages VIL and VIH, the output levels VOL and VOH at a stated load current, input leakage and the current each pin may source or sink. The AC tables give timing: maximum clock frequency, setup and hold times, propagation delays and rise and fall times. Every row has conditions, such as a supply voltage and a temperature, and most have three columns, minimum, typical and maximum. Design with the worst case of the column that hurts you, not the typical value.
Timing diagrams. A timing diagram draws signals against time and labels the intervals with symbols that point to the AC table. For a bus such as SPI it shows which edge samples the data and how long the data must be stable before and after that edge.
Voltage levels: 1.8 V, 3.3 V and 5 V logic
4 min readA digital pin carries a voltage, and the receiving input decides which logic value it means by comparing it with two thresholds. The input needs at least VIH to read high and at most VIL to read low; between them is undefined. The output guarantees at least VOH when driving high and at most VOL when driving low. A link works when the sender's VOH is above the receiver's VIH and its VOL is below the receiver's VIL. The gap is the the voltage gap between what a driver guarantees and what the receiver requires, which tells how much interference a link can tolerate.
Three supply families matter on embedded boards. 5 V logic is the legacy level of Arduino Uno boards and old logic chips. 3.3 V logic dominates SoC GPIO, UARTs, SPI and I2C on boards such as the Raspberry Pi and the STM32MP1 Discovery Kit. 1.8 V logic serves fast peripherals such as many eMMC devices, sensors and camera links. The generic 3.3 V standard LVTTL puts the thresholds near 0.8 V for low and 2.0 V for high, but your datasheet's numbers count. I2C defines thresholds relative to the supply: below 30 percent of VDD is low and above 70 percent is high.
The danger is not only misreading a level but overstressing a pin. Almost every CMOS input has protection diodes from the pin to the supply rail and to ground. If you drive 5 V into a pin whose supply is 3.3 V, the upper diode conducts, current flows from your 5 V source into the 3.3 V rail through a structure designed only for brief static pulses, and the chip heats, latches up or fails. That is why the Raspberry Pi documentation says its GPIO is 3.3 V and not 5 V tolerant, and why the warning in the previous lesson about 5 V serial adapters stands.
Going deeperWhy protection diodes make a 5 V input dangerous
An input pad has a diode from the pin up to the pad supply and another from ground up to the pin. They clamp short electrostatic pulses by steering the energy into the rails, and in normal use both are reverse biased. Put a pin more than about 0.6 V above its supply and the upper diode conducts, so a 5 V source feeds the 3.3 V rail through a structure built only for brief pulses. A series resistor limits the current, but only datasheets that state a maximum injected current allow it. Treat 5 V into a 3.3 V domain as unsafe unless the datasheet says that pin is 5 V tolerant.
Connecting domains means level shifting. For a slow, one-direction signal going down in voltage, a resistor divider works: 1 kilohm in series and 2 kilohms to ground turn 5 V into about 3.3 V at a high-impedance input. It fails for fast or bidirectional lines, because the resistors and the pin capacitance form a low-pass filter. Going up, a 3.3 V output satisfies a 5 V TTL input (VIH 2.0 V) or a 74HCT input, but not a 5 V CMOS 74HC input, which wants about 3.5 V. In the general case use a purpose-built translator: a unidirectional buffer powered from both rails, or for open-drain buses such as I2C a bidirectional one built around a small MOSFET. Check the direction and speed it supports, and which side takes which supply.
Output stages and why I2C needs pull-ups
5 min readA digital output has two switches inside: one that connects the pin to the supply and one that connects it to ground. In a an output stage with one transistor to the supply and one to ground, so it actively drives both logic high and logic low (also called totem-pole) exactly one switch is on at a time. The pin is driven hard in both directions, which gives clean, fast edges. It also means two push-pull outputs on the same wire fight if they disagree: one connects the line to the supply, the other to ground, a large current flows through both and the voltage lands somewhere in between. That is called bus contention, and it can damage drivers.
An an output stage that has only a transistor to ground: it can pull the line low or release it, and an external pull-up resistor makes the line high when released has only the lower switch. It pulls the line to ground or lets go. Something else, a pull-up resistor to the supply, brings the line high when nobody pulls. If several open-drain outputs share a line, it is low when any of them pulls and high only when all of them release. This is a wired-AND, and it makes conflicts harmless: two devices cannot short the supply to ground through each other.
This explains why different buses look different. A UART line is point to point: the transmitter of one device goes to the receiver of exactly one other device, so a push-pull driver is correct and fast, and the idle level is whatever the driver holds. SPI data lines are push-pull as well, with the chip-select line choosing which of several targets may drive the shared data line. I2C is a shared bus on which any device may need to talk, and on which a target must be able to hold the clock low to say wait. Both data and clock are open-drain and the line is high by the pull-up resistor, which is why an I2C bus with no pull-up shows nothing at all and why a scan tool reports no devices.
The Raspberry Pi header takes this one step further. The two pins that carry the first I2C bus, GPIO2 and GPIO3 on physical pins 3 and 5, have fixed 1.8 kilohm pull-ups to 3.3 V on the board. A bare sensor chip or breakout board therefore already finds pull-ups, and a breakout that adds its own in parallel lowers the resistance further.
How big should the pull-up be? Two limits sit on either side. The resistor with the line capacitance forms an RC circuit that sets how fast the line rises when released: a larger resistor means a slower rise. The I2C specification defines the rise time as the time to move from 30 percent to 70 percent of the supply, which for a single resistor and capacitor is about 0.8473 times R times C. On the other side, when a device pulls the line low the resistor passes current into the device, and the low voltage must stay below 0.4 V while that current stays within the sink capability, which the specification sets at 3 mA for standard and fast mode.
Pick the speed mode: standard mode runs at 100 kHz and allows a rise time of up to 1000 ns; fast mode runs at 400 kHz and allows up to 300 ns.
Estimate the bus capacitance: add the pin capacitance of every device, the connector and the PCB trace or cable; a short board-level bus is often around 50 to 150 pF, and the specification limit is 400 pF.
Compute the maximum resistor: Rmax = rise time / (0.8473 x capacitance). For fast mode with 100 pF this is 300 ns / (0.8473 x 100 pF), about 3.5 kilohms.
Compute the minimum resistor: Rmin = (supply - 0.4 V) / 3 mA. For a 3.3 V supply this is 2.9 V / 3 mA, about 970 ohms.
Choose between: any standard value in the range works; 2.2 kilohms satisfies both limits, rises in roughly 190 ns with 100 pF, and wastes only 1.5 mA while the line is low.
Check the corners: with 400 pF at fast mode the two limits cross, since Rmax is under 900 ohms and Rmin is about 970 ohms, so no resistor works and you must slow the bus or reduce the capacitance.
Going deeperWhere the 0.8473 comes from and what Fm+ changes
An RC circuit charging toward the supply follows V(t) = VDD x (1 - e^(-t/RC)). The 30 percent point is at about 0.357 RC and the 70 percent point at about 1.204 RC, and their difference is the 0.8473 RC of the specification. Fast-mode plus at 1 MHz needs a rise time of 120 ns and a 20 mA sink capability, so its pull-ups are much smaller and not every device supports it. Linux only asks the adapter driver for a bus frequency, normally the clock-frequency property in the device tree; making that number physically achievable is the hardware designer's job.
GPIO electrical basics: drive, impedance and floating pins
4 min readA general-purpose input and output pin, a GPIO, is more than a wire to a register. Inside the pad sit the structures the datasheet describes: the protection diodes from the last section, an input buffer with a threshold, an output stage whose strength can often be set in software, and a small optional resistor to either rail. Understanding what each does explains most of the odd behaviour a beginner meets.
The first property is input impedance. A CMOS input buffer draws almost no steady current: only a leakage specified in nanoamps or microamps. That is why a GPIO can read a signal without disturbing it, and also why it is easily influenced. The input looks like a few picofarads of capacitance and a very high resistance, so a long wire connected to it acts like an antenna.
The second is the floating pin. An input connected to nothing takes whatever voltage stray charge and noise give it, so the buffer can read high, low or flip between them, and near its threshold the input stage briefly conducts from supply to ground and draws extra current. This is the classic cause of intermittent behaviour: a button that seems pressed, an interrupt storm, a chip select that picks a device at random. The cure is a default level: an external pull resistor, usually 4.7 to 100 kilohms, or the SoC's internal one. Internal pulls are weak, tens of kilohms (about 50 to 65 kilohms on the Pi 4 per the BCM2711 datasheet), fine for a button and too weak for a fast bus. Tie an unused input to a rail; leave an unused output unconnected.
The third is drive strength, the current an output can source or sink while holding its level. SoCs often make it configurable, and the lowest settings soften edges, which reduces interference. Raspberry Pi guidance has long given 16 mA for one 3.3 V pin and about 50 mA across all pins as ceilings; design well below them. An LED at 2 to 4 mA is fine, while a relay, motor or buzzer needs a transistor or driver between pin and load, and a diode across any inductive load.
Linux exposes these electrical properties through the kernel's pin-control subsystem rather than through GPIO calls alone. A board's device tree describes pull direction, drive strength and open-drain mode with properties such as bias-pull-up, bias-pull-down, drive-strength and drive-open-drain, and the pin controller driver writes the SoC registers. The GPIO subsystem separately exposes lines to user space through the character device interface and the libgpiod tools, which is the supported interface; the old sysfs GPIO interface is deprecated. On a running board you can list the lines the kernel manages and who uses them.
# list GPIO chips and then the lines on the first one, with consumers and flags
gpiodetect
gpioinfo gpiochip0
# on Raspberry Pi OS Bookworm, show the pin function, pull and level of GPIO 2 and 3
pinctrl get 2,3
The exact chip name and layout depend on the board and kernel, and libgpiod 1.x and 2.x use slightly different command arguments, so read the help of the installed version. The point is that pull, level and function are visible state you can read, not guesses.
Boot configuration pins and strapping resistors
3 min readWhen a SoC leaves reset, the first code that runs is the ROM code you met in the boot chain. The ROM has to know where to find the next stage: an SD card, eMMC, NOR or NAND flash, or a serial link. Many chips decide by reading a few pins at the moment reset is released. These are pins sampled by the boot ROM at reset, held high or low by resistors, jumpers or switches, to select a boot source or a hardware option.
On the STM32MP1 family, including the STM32MP157 used for this course, three pins called BOOT0, BOOT1 and BOOT2 are read by the ROM code after reset, and their combination selects among sources such as the serial UART and USB download mode, serial NOR flash, NAND flash, the SD card and eMMC. On the Discovery Kit they go to a small switch bank. The binary value for each source is in the boot section of the reference manual and the board manual; the lab asks you to find it, so do not memorise it here. Other families differ: the TI AM335x reads SYSBOOT pins, NXP i.MX parts combine BOOT_MODE pins with fuses, and on many chips a fuse can override the pins in a finished product. The Raspberry Pi 4 and 5 use no strap on the header: their boot order is stored in an on-board EEPROM.
Power good: the supply rails rise and the reset line is held active, so no software runs and the strapping pins sit at their resistor or switch levels.
Reset released: the SoC leaves reset and the internal ROM code starts executing.
Strap sampled: the ROM reads the strapping pins once and stores the value; changing the switch now has no effect until the next reset.
Source selected: the ROM maps the value to a boot source, for example SD card, and falls back to a download mode if no valid image is found.
First stage loaded: the ROM reads the first-stage loader, TF-A on the STM32MP1, from that device and jumps to it.
On a schematic a strap looks like an ordinary pull resistor: a pin with a 10 kilohm resistor to ground and a second footprint, perhaps marked DNP, to the supply, or a jumper. Reading the schematic around those pins tells you the default source and how to change it. Two failures recur. An external device that drives a strap pin during reset, such as an LCD data line or an adapter board, overrides the weak resistor, and the board boots from the wrong place. A switch left in the wrong position gives a board that does nothing visible. The serial console helps, because the ROM or first stage often prints which source it tried.
Multimeter and oscilloscope basics
3 min readBefore any clever instrument, measure the power. In DC voltage mode, place the black lead on ground and the red lead on the net, in parallel with the circuit, with the board powered. A healthy 3.3 V rail reads within about five percent of nominal, roughly 3.13 to 3.47 V, and a 5 V rail roughly 4.75 to 5.25 V. A reading that sags when the board starts working points to a weak supply, a thin cable or a struggling regulator. On Raspberry Pi OS, sudo dmesg | grep -i voltage and vcgencmd get_throttled report under-voltage events the firmware detected. On a Raspberry Pi 4 the 5 V pins are physical pins 2 and 4, the 3.3 V pins are 1 and 17, and ground pins include 6, 9, 14, 20, 25, 30, 34 and 39.
In continuity mode, which beeps when the resistance between the leads is very low (the exact threshold depends on the meter, often tens of ohms), you check that a connection exists. It is only valid with the board unpowered, because the meter injects its own small current. Use it to confirm that every ground pin goes to the same ground, that a cable has no break and that a suspected short between two adjacent pins is real. Resistance mode has the same rule: measure only on a powered-off board. Never put the meter in current mode across a power rail; that is a short circuit.
A meter shows only a slowly changing average: a UART line idling at 3.3 V that carries 115200 baud data flickers in microseconds, and the meter reads something between zero and 3.3 V. To see the signal you need an oscilloscope, which plots voltage against time. Four controls matter: volts per division sets the height, time per division sets the width, the trigger starts each sweep on a chosen edge so a repeating signal holds still, and the probe carries the signal in. A 10x passive probe divides the signal by ten and presents about 10 megohms and a few picofarads, which disturbs the circuit less than a bare wire.
Reading a square wave is arithmetic on the grid. The amplitude is the number of vertical divisions between the low and high levels times the volts per division: 3.3 V logic fills 3.3 V from bottom to top. The period is the horizontal distance of one full cycle times the time per division. Frequency is its inverse. If one cycle spans four divisions at 5 microseconds per division, the period is 20 microseconds and the frequency is 50 kHz. In the same way the start bit of a 115200 baud UART frame, which lasts one bit time of about 8.68 microseconds, should span roughly two divisions at 5 microseconds per division when it is the only thing on screen, and a measurement that disagrees with that tells you the real baud rate.
Two cautions complete the basics. The scope's bandwidth must exceed the signal's content: for a digital square wave a common rule is at least five times the clock frequency, because the sharp edges contain strong harmonics. And the probe ground clip is not a free wire: the long clip lead has inductance, and a few centimetres of it adds visible ringing to fast edges. For fast signals use the short ground spring that comes with the probe tip.
The logic analyser: sample rate, triggers and channels
4 min readA an instrument that samples several digital signals at a fixed rate, records each as a sequence of ones and zeros against time, and can decode protocols from the recording complements the scope. It has fewer analogue talents and many more channels, 8, 16 or 32, so you can watch a whole SPI or I2C bus at once. Cheap USB analysers with eight channels at 24 MHz suffice for this lesson. The specification has four numbers: channel count, maximum sample rate, memory depth and input threshold range. Record length equals memory depth divided by sample rate. The threshold separates high from low and must fit the logic family: around 1.65 V for 3.3 V logic, lower for a 1.8 V bus, or every sample reads low.
Sample rate is the number to get right. The analyser samples the line at a regular tick and decides high or low each time. The Nyquist limit says a signal must be sampled at more than twice its highest frequency, but that is a floor for sine waves, not a recipe for square waves, whose edges carry energy far above the clock rate. A practical rule is at least four samples per fastest toggle, ten when you can, because each edge can land anywhere inside one sample interval, so its timing is known only to plus or minus one sample period. A pulse shorter than one interval can vanish completely.
Work an example you will meet in the lab. At 115200 baud one bit lasts 1 / 115200, about 8.68 microseconds. Sampled at 100 kS/s the analyser takes only about 0.87 samples per bit and cannot decode it. At 500 kS/s that rises to about four samples per bit, which is marginal. At 2 MS/s it is about 17 samples per bit, which is comfortable. A 24 MS/s analyser gives about 208 samples per bit, which is more than enough, and for a 4 MHz SPI clock the same analyser takes six samples per clock period, which is acceptable but not generous.
A a condition on the monitored signals that tells the analyser when the capture of interest begins, such as an edge on one channel or a pattern across several is how you capture the rare event rather than a long stretch of idle line. Common triggers are a falling edge on a UART receive line (the start bit of the first byte), a falling edge on SPI chip select, an I2C start condition, or a pattern across several channels. Analysers keep a buffer of samples from before the trigger, so you can see what happened just prior to the event. Without a good trigger you capture the wrong moment. With one, you see exactly the transaction that failed.
The free sigrok project provides drivers for many cheap analysers and a graphical front end called PulseView. Its command-line tool captures and decodes in one step, and the following form is typical for an eight-channel analyser that uses the common fx2lafw firmware, here capturing a UART line at 1 MS/s. Check the help of your installed version for the exact option spelling.
# install on Ubuntu 24.04 (needs sudo), then capture channel D0 and decode it as UART at 115200 8N1
sudo apt install sigrok-cli pulseview
sigrok-cli --driver fx2lafw --config samplerate=1m --samples 200000 \
--channels D0 -P uart:rx=D0:baudrate=115200
Decoding UART, I2C and SPI from a capture
5 min readA raw capture shows waveforms. A protocol decoder runs on top of it and annotates the waveform with the bytes the bus carried. It needs the parameters that a human would need to read the same trace, and the decoded output is wrong if any is wrong.
UART. One channel per direction. The decoder needs baud rate, data bits, parity, stop bits and polarity. It waits for the falling start edge, then samples each bit mid-slot: the first sample comes one and a half bit times after the edge, the next one bit time later. Take the ASCII letter A, 0x41 or 01000001. A UART sends the least significant bit first, so the full frame is start 0, then 1 0 0 0 0 0 1 0, then stop 1: ten bit times, about 86.8 microseconds at 115200 baud. A stop bit that is not high at its sample point is a framing error, which a wrong baud rate or a noisy edge produces. Garbage characters on a clearly active line almost always mean a baud mismatch.
I2C. Two channels, SDA and SCL, and no other parameters. The decoder recognises the start condition (SDA falls while SCL is high), reads eight bits on rising clock edges, and reads a ninth bit as acknowledge, where a low means ACK from the receiver and a high means NACK. The first byte after a start carries the 7-bit target address in its upper seven bits and the read or write flag in bit 0: 0 for write, 1 for read. A sensor at address 0x48 is therefore addressed as 0x90 for writing and 0x91 for reading. A stop condition (SDA rises while SCL is high) ends the transaction. The decoded form below is typical of what a decoder prints for a register read, and yours will differ in format and values.
Start
Address write: 48 ACK
Data write: 00 ACK (select register 0)
Start repeat
Address read: 48 ACK
Data read: 19 NACK (the controller ends the read)
Stop
SPI. Four lines: clock, MOSI (controller out), MISO (controller in) and chip select, which is active low. The decoder needs the clock polarity and phase, called the mode, the word size and the bit order. In mode 0 the clock idles low and data is sampled on the rising edge. A wrong mode shifts every bit by half a clock and gives plausible-looking but wrong bytes, which is why mode errors are harder to notice than baud errors.
Start: SDA falls while SCL is high; the decoder opens a transaction and the bus is now busy.
Address and direction: eight bits give the 7-bit address and the write flag; a ninth bit is the target's ACK.
Register pointer: the controller writes one byte that selects which register the target will return, and the target ACKs it.
Repeated start: the controller issues a second start without a stop, keeping the bus, and sends the address again with the read flag.
Data in: the target drives SDA for eight bits while the controller clocks; the controller answers NACK on the last byte to end the read.
Stop: SDA rises while SCL is high and the bus becomes idle.
The widgets below show the address byte split into its address and direction bits and let you step through the bus states of one transaction.
Signal integrity: rise time, ringing and termination
4 min readThe ideal square wave has instantaneous edges. A real edge has a finite the time a signal takes to move between two stated levels on a rising edge, commonly 10 to 90 percent of its swing, and the rise time, not the clock rate, decides how much high-frequency energy the signal holds. A useful estimate of the bandwidth needed is about 0.35 divided by the rise time, so a 5 nanosecond edge needs roughly 70 MHz even if it toggles at a few hundred kilohertz. The same figure applies to instruments: too little bandwidth rounds a sharp edge and reports a longer rise time than the true one.
Edges on a PCB trace do not arrive everywhere at once. A signal travels at roughly half the speed of light in FR-4 board material, around 15 centimetres per nanosecond. When the travel time of the trace becomes a sizeable fraction of the rise time, a rule of thumb says about a sixth (for a 2 nanosecond edge, roughly 5 cm), the wire behaves as a transmission line with a characteristic impedance. A driver and a high-impedance CMOS input that do not match that impedance reflect part of the wave, and the reflections show up as ringing: oscillating overshoot and undershoot around the final level. Overshoot beyond the supply drives the protection diodes you met earlier. Designers cure it with series termination, a resistor of roughly 22 to 47 ohms close to the driver, so the returning reflection is absorbed. A receiver may see one edge as two or three, and an analyser records the extras as extra bits. Slow UART and I2C wires on a development board have edges of tens to hundreds of nanoseconds and never meet this; SPI at tens of megahertz, SDIO, eMMC and memory buses do. Linux sees it only through the pin-control drive-strength and slew-rate settings.
The opposite problem is a slow edge. When an I2C line rises slowly through its pull-up, the voltage lingers near the receiver's threshold and a little noise toggles the output repeatedly. An analyser sees the same chatter, because its threshold is a single voltage. A badly set threshold, such as 3.3 V on a 1.8 V bus, shows nothing at all.
So when is a logic analyser reading unreliable? When the sample rate is too low for the edges; when the threshold is wrong for the logic family; when ringing or slow edges make one transition cross the threshold more than once; when a long ground lead adds its own ringing; and when the analyser loads a weak driver so much that the signal it shows is not the signal that existed before probing. Test by viewing the same signal on a scope: if decoded data has occasional errors and the edges are clean, suspect configuration; if the edges ring or crawl, fix the hardware, not the decoder.
Probing safely, ESD and common mistakes
4 min readStart with the measurement itself. Connect a common ground first: the instrument's ground lead goes to the board's ground before any signal lead, because every voltage is relative to a reference. Power the board off while attaching probes where you can, and use hook clips or pin-header leads instead of a bare tip held by hand. The classic accident on a dense header is a slipped tip that bridges two adjacent pins, a 3.3 V pin to ground or a data pin to the supply, which can reset the board or destroy the regulator. Check an unplugged board for shorts in continuity mode before powering it.
Think about loading. Every probe adds capacitance to the node you touch, a few picofarads for a 10x scope probe or a logic-analyser input. That is negligible on a GPIO but noticeable on a weak, high-impedance signal such as a crystal oscillator. If connecting the probe changes the board's behaviour, you have measured your own influence. For mains-powered products, never connect the ground lead of an earthed oscilloscope to a circuit that is tied to mains voltage, because the earth connection becomes a short circuit; use an isolated setup.
Electrostatic discharge is the quiet killer of boards. Walking on carpet can charge your body to several thousand volts, a spark you can feel starts around 3,000 V, and many chip pins are damaged by far less, either at once or as latent damage that fails weeks later. A Raspberry Pi exposes its GPIO and SoC pins with only the chip's own small protection behind them. electrostatic discharge, a sudden transfer of static charge between two objects at different potentials, which can damage the thin insulating layers inside integrated circuits precautions are cheap: hold a board by its edges, touch grounded metal first, use a wrist strap on a grounded mat when you can, store boards in antistatic bags, and never slide a board across a surface.
Three failures repeat often. Each is given with symptom, cause, diagnosis and fix; the others in this lesson (garbage characters, intermittent decode errors) follow from the baud-rate and signal-integrity sections.
No response over the serial line. Symptom: the terminal is silent after power on. Cause: TX and RX not crossed, ground missing, a 5 V adapter on a 3.3 V board, or the wrong header pins. Diagnose: put the logic analyser or scope on the board's TX pin, power-cycle and look for activity; check the adapter's logic level and the continuity between adapter ground and board ground. Fix: cross the data lines, join the grounds, use a 3.3 V adapter or a level shifter.
I2C scan finds nothing. Symptom: i2cdetect shows an empty table. Cause: no pull-ups, wrong bus number, device unpowered, wrong level on a 1.8 V part, or the I2C controller not enabled in the device tree. Diagnose: with the board powered, measure SDA and SCL at idle; both should sit near the supply voltage. A line near zero means a short or a device holding it low, and a line that floats means no pull-up. Fix: add or correct pull-ups and levels, then check the device tree.
Board boots from the wrong medium. Symptom: a flashed SD card is ignored, or the board waits in download mode. Cause: strap switches in the wrong position, or a peripheral driving a strap pin at reset. Diagnose: read the strap pin levels with the meter before and just after reset, and compare with the reference manual's boot table. Fix: set the switches and remove the device that drives the pin during reset.
Check the polarity and voltage of the supply, look for obvious shorts with continuity mode, set the analyser threshold for the logic family, connect ground first, and discharge yourself on grounded metal before touching the board.
Try it
1 min readWork through the lab on a powered-off board and then a powered one. Verify the 3.3 V and 5 V rails and ground continuity with a multimeter, capture the board's UART TX line with a logic analyser at a sample rate you can justify, and decode the ASCII at 115200 baud. Then read the boot-pin section of the STM32MP157 datasheet and reference manual and explain which boot sources the board can select. The practice pack tests the calculations, level and wiring decisions and decoding steps against your own measurements.
Key takeaways
- The schematic and the datasheet, not the software, are the final authority on what a pin can do; read them before you blame a driver.
- Absolute maximum ratings are damage limits, not operating limits; stay inside the recommended operating conditions.
- Raspberry Pi GPIO pins are 3.3 V logic and are not 5 V tolerant, so any 5 V signal needs a level shifter or divider.
- Open-drain outputs can only pull a line low, so I2C needs pull-up resistors, and the resistor value is bounded by rise time above and by sink current below.
- A digital input must never float: use an external or internal pull resistor so the pin has a defined level.
- Boot-source pins are sampled at reset, so a wrong strap or an external driver on that pin changes which medium the board boots from.
- Sample a logic analyser at four to ten times the fastest signal edge rate or clock, and trigger on the event you care about, not on time zero.
- Share a ground between probe and board, keep ground leads short, and treat any decoded error as a possible signal-integrity problem first.
Reflect
- Explain to a colleague, in two sentences: identify power rails, ground, decoupling capacitors and pull resistors on a schematic and trace a signal from a connector to the SoC.
- Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
- What surprised you when you ran the commands yourself?
On a real board
Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.
References and further reading
- Official docsRaspberry Pi documentation: the 40-pin GPIO header
- Official docsBCM2711 ARM peripherals datasheet (Raspberry Pi 4)
- Official docsLinux kernel: pin control subsystem
- Official docsLinux kernel: GPIO driver API
- Official docsLinux kernel: I2C and SMBus subsystem
- Official docssigrok protocol decoders
Official documentation first. Links checked when the lesson was published.