Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/manish04-mu/TheEmbeddedInsights/llms.txt

Use this file to discover all available pages before exploring further.

A logic analyzer lets you verify SPI transactions in real time — seeing the actual waveforms confirms that clock polarity, phase, bit order, and data values are correct. The examples in this repo include channel comments directly in the sketch headers, making it straightforward to wire your analyzer probes to the right pins and configure the decoder without guesswork.

Why Use a Logic Analyzer

Verify Mode

Confirm CPOL/CPHA settings by observing the clock idle state and the edge on which data transitions. A single glance at the SCK waveform tells you if your mode is correct.

Decode Data

See the actual hex bytes sent on MOSI and received on MISO, decoded frame by frame. Instantly verify that 0x62 is being transmitted as expected.

Debug Timing

Identify CS assertion timing, missing clock pulses, or glitches that cannot be detected from Serial Monitor output alone. Timing issues are visible at a glance.

Validate Bit Order

Confirm MSB-first vs LSB-first transmission by inspecting the individual bit sequence in the captured frame. Switch between MSBFIRST and LSBFIRST sketches and see the difference immediately.

Channel Mapping

Every sketch in the repository includes the following channel assignment comment at the top. Wire your logic analyzer probes accordingly:
ChannelSignalArduino UNO PinDescription
CH0SCK13SPI clock signal
CH1CS / Enable10Chip Select — active LOW
CH2MOSI11Master Out Slave In (data to slave)
CH3MISO12Master In Slave Out (data from slave)

Decoder Settings

In most logic analyzer software — including Saleae Logic and Sigrok / PulseView — configure the SPI decoder as follows after wiring the probes:
  • Clock: CH0 (SCK)
  • Enable / CS: CH1 — set polarity to active LOW
  • MOSI: CH2
  • MISO: CH3
  • CPOL / CPHA: match the mode used in the sketch (e.g., CPOL = 0, CPHA = 0 for SPI_MODE0)
  • Bit order: match the SPISettings argument — MSBFIRST or LSBFIRST
  • Word / frame length: 8 bits
Refer to the SPI API reference to identify the correct CPOL and CPHA values for the mode used in the sketch you are testing.

Sampling Rate

The example sketches use a clock speed of 100 kHz. Logic analyzer best practice requires sampling at least 10× the clock frequency to accurately reconstruct waveform edges. That means a minimum sample rate of 1 MHz; a rate of 4–10 MHz is recommended to cleanly resolve fast edges and avoid aliasing artifacts. Check your analyzer’s specifications and set the sample rate in the capture software before starting a capture session.

Connecting the Probes

1

Connect CH0 to SCK

Clip the CH0 probe to Arduino pin 13 (SCK). This is the clock line and is always the reference channel for the SPI decoder.
2

Connect CH1 to CS

Clip the CH1 probe to Arduino pin 10 (CS / Chip Select). The decoder uses a falling edge on this line to detect the start of a transaction.
3

Connect CH2 to MOSI

Clip the CH2 probe to Arduino pin 11 (MOSI). This carries the data byte sent from the Arduino master to the slave.
4

Connect CH3 to MISO

Clip the CH3 probe to Arduino pin 12 (MISO). This carries the data byte returned from the slave to the Arduino master.
5

Connect the ground clip

Connect the logic analyzer’s ground clip to any GND pin on the Arduino. A shared ground reference is essential — without it, signal levels will be meaningless and decoding will fail.
6

Set the capture trigger

In your analyzer software, set the trigger to a falling edge on CH1 (CS). This causes the capture to begin exactly when CS is asserted, giving you a clean, aligned view of each complete transaction.
The sketches work perfectly without a slave device attached — the logic analyzer can decode the full MOSI data stream without a slave present. MISO (CH3) will simply read 0x00 since there is nothing driving the line, but all transmitted bytes on MOSI are still fully visible and decodable. This is a great way to verify your SPISettings configuration before connecting real hardware.

Build docs developers (and LLMs) love