PicoScope 7 Software
Available on Windows, Mac and Linux
SPI (Serial Peripheral Interface) bus was originally developed by Motorola for use with their microcontrollers. Due to the simplicity of the bus, other manufacturers adopted it and it has become widely available in components used in embedded system designs. It is commonly used for chip-to-chip communications between a CPU and keyboard, display, ADCs and DACs, real-time clocks, EEPROM, SD and other memory devices.
SPI is a synchronous bus with four lines: Data - master output/slave input (MOSI) and master input/slave output (MISO), clock (SCLK), and slave select (CS or SS). SPI is a full duplex standard, meaning signals can be transmitted in both directions simultaneously, with data rates from a few Mb/s to tens of Mb/s.
In PicoScope 7 you have the choice between SPI MISO/MOSI and SPI SDIO. The main difference is that SPI MISO/MOSI is a general communication protocol for data transfer between microcontrollers and peripheral devices, while SPI SDIO is specifically designed for communication with SD cards or other SDIO devices.
Devices communicate using a master-slave architecture with a single master. The master device initiates the frame for reading and writing. Multiple slave devices can be addressed with individual slave select lines.
SPI waveforms can be decoded with PicoScope: From the Tools menu select Serial Decoding then Create and select SPI from the list of available protocols.
The SPI bus is a master/slave, 4-wire serial communications bus. The four signals are Data - master output/slave input (MOSI), master input/slave output (MISO), clock (SCLK), and slave select (SS) or chip select (CS).
Whenever two devices communicate, one is referred to as the master and the other as the slave. The master drives the serial clock and the data is simultaneously transmitted and received, making it a full-duplex protocol. SPI uses the CS (or SS) line to specify which device data is being transferred to or from, so each unique device on the bus needs its own CS signal from the master. If there are 3 slave devices, there are 3 CS lines from the master, to each of the slaves.
To begin communication, the bus master configures the clock, using a frequency supported by the slave device, typically a few MHz or tens of MHz. The master then selects the slave device with a logic level 0 on the select line.
During each SPI clock cycle, a full duplex data transmission occurs. The master sends a bit on the MOSI line and the slave reads it, while the slave sends a bit on the MISO line and the master reads it.
Transmissions involve two shift registers of a given word size, such as eight bits, one in the master and one in the slave. Data is usually shifted out with the most significant bit first while shifting a new least significant bit into the same register. After the register has been fully shifted out the master and slave have exchanged register values. If more data needs to be exchanged the shift registers are reloaded and the process repeats. Transmission may continue for any number of clock cycles. When complete, the master stops toggling the clock signal and deselects the slave.
The master device must select only one slave at a time. Slave devices on the bus that have not been activated using their chip select line must disregard the input clock and MOSI signals, and must not drive MISO.
To decode SPI data first acquire the packets of interest using PicoScope. Then select Serial Decoding from the Tools menu.
In order to decode an SPI bus with a PicoScope, the data must first be captured. Ideally, at least SCK, MOSI and MISO must be connected to the oscilloscope. In the case of a two-channel device, only MISO or MOSI can be decoded since SCK is always necessary. With a four or more-channel device, the CS line of the various slaves can also be captured.
PicoScope 7 allows you to name the channels accordingly in the channel menu for easier handling.
Now the trigger must be set. To ensure that the triggering always occurs at the beginning of a packet, it is recommended to work with a pulse width trigger. In this example, the relevant edge of the clock is rising. Therefore, the trigger must be set to a negative pulse whose pulse duration exceeds the maximum pause between two clock intervals. The trigger level should be set approximately halfway between the minimum and maximum levels.
After pressing next, the channels can be assigned to the corresponding functions. This is made particularly easy by naming the channels correctly beforehand. The thresholds and hysteresis are recognized automatically, but can still be adjusted manually.
If you scroll down in this menu, the other SPI parameters can be configured.
In the next step, a name for the decoder can be specified and the format in which the decoded data will be displayed can be chosen. Furthermore, the range that should be decoded can be limited. This can help you by collecting the data that you want to evaluate.
After pressing Finish, the table with the results will appear on the screen. This table can either be scaled together with the Scope screen or moved in a separate image like other graphs in PicoScope7.
The line above the decoded data provides many functions. The data can be exported with Export and Data to Text. You can use the Fields to select which data should be displayed. You can also set the display size and configure again which data is decoded into this table.
The search function is particularly valuable. Since most PicoScopes have a deep memory, allowing a large number of data packets to be captured. Thanks to the search function, a schema can be created allowing only the data to be displayed that you need. What’s the benefit of this, well it can save a lot of time.
Important to note, that when you hover over a package will display the data for that individual package.
For more information on PicoScope's serial decoding capabilities, see Serial bus decoding and protocol analysis - overview.