SPI decoder
The SPI decoder I/O decodes analog data on an SPI bus to SPI data. Just measure the Clock and Data (MOSI or MISO) lines of the SPI bus with a scope and connect the measuring channels to the SPI decoder I/O. The SPI decoder I/O has auto level detection and auto bus speed detection. The output of the SPI decoder I/O can be shown in a Table sink.

The SPI decoder always needs two sources: the first connected source will be used as SPI clock and the second connected source will be used as SPI data, either MOSI (data output from master) or MISO (data output from slave).

When both MOSI and MISO data need to be decoded, simply use two SPI decoder I/Os, connect the CLK signal to both I/Os, the MOSI data signal to one I/O and the MISO data signal to the other I/O.

The following fields are extracted from the SPI communication and shown as a column in a table:

Field name Purpose Default shown
Value (Hex) The value in hexadecimal notation
Value (Dec) The value in decimal notation
Value (Bin) The value in binary notation
Value (ASCII) The value in ASCII notation

When decoding both MOSI and MISO data, connect both SPI decoder I/Os to the same table, after first setting its Layout to "Common rows".

Properties and actions

To control the behavior of the SPI decoder I/O, several properties are available. These can be accessed through a popup menu which is shown when the I/O is right clicked in the Object Tree. The properties can also be accessed through its settings window which is shown when the I/O is double clicked in the Object Tree. To open the Object tree, click the Show object tree Show object tree button.

SPI decoder control

Swap inputs

The SPI decoder always needs two sources: the first connected source will be used as SPI clock and the second connected source will be used as SPI data. When the sources are connected the wrong way, the Swap inputs action will correct it.

Level (Clock) and Level (Data)

In order to decode the analog signals into a digital signal, the SPI decoder I/O compares the analog input signals with mid levels: anything above that level is considered "high" and anything below that level is considered "low". The Level (..) properties set a mid level for the Clock and Data signal individually.

Hysteresis (Clock) and Hysteresis (Data)

To minimize the effect of noise on the signals when comparing the signals to the mid levels, a Hysteresis can be used around these levels. Anything above "level + hysteresis/2" is considered "high" and anything below "level - hysteresis/2" is considered "low". The Hysteresis (..) properties set the size of the hysteresis for the Clock and Data signal individually.

Auto detect levels and hystereses

Enabling Auto detect level and hysteresis will let the software determine a suitable mid level and hysteresis, based on the measured signal. Each time new data is available, the suitable levels and hystereses will be determined again. In streaming mode, levels and hystereses are determined once based on the first chunk of data and remain at these values though out the whole measurement.

Auto detect levels and hystereses is default enabled.

Mode

The SPI decoder supports four SPI modes:

  • Mode 0: Clock Polarity (CPOL) = 0, Clock Phase (CPHA) = 0
  • Mode 1: Clock Polarity (CPOL) = 0, Clock Phase (CPHA) = 1
  • Mode 2: Clock Polarity (CPOL) = 1, Clock Phase (CPHA) = 0
  • Mode 3: Clock Polarity (CPOL) = 1, Clock Phase (CPHA) = 1

The Mode property determines which mode the SPI decoder uses. The default Mode setting is Mode 0.

Bit order

The bit order of transferred data on the SPI bus is not defined in a standard, it depends on the implementation. The Bit order property determines how the SPI decoder will interpret the decoded bits: MSB first or LSB first. The default Bit order is MSB first.

Word size

The word length of transferred data on the SPI bus is not defined in a standard, it depends on the implementation. The Word size property determines how many bits the SPI decoder will use for one word. Several predefined values are available and it is also possible to enter a user defined value. The default Word size is 8 bits.

Common properties and actions

Related information

Pulse decoder

The Pulse decoder I/O decodes the two signals from a quadrature encoder to a pulse count/position.

I2C decoder

The I2C decoder I/O decodes analog data on the SDA and SCL lines of an I2C bus to I2C data.

CAN decoder

The CAN decoder I/O decodes analog data to CAN data.

J1939 decoder

The J1939 decoder I/O extracts SAE J1939 SPN values from CAN messages.

Table

The table sink shows alphanumerical values in a table.