Article by: Digilent Inc.
Developed in collaboration with Analog Devices and supported by the Xilinx University Program, the Digilent Analog Discovery 2 is small enough to fit in your pocket, yet powerful enough to replace a stack of lab equipment.
Dnimble and SPI communications
The Serial Peripheral Interface (SPI) is a duplex synchronous serial communication interface specification used for short-distance communication, primarily in embedded systems. It is commonly used for communication with flash memory, sensors, real-time clocks (RTC), analog-to-digital converters, etc. SPI can also support multiple slave devices, but an additional slave select (SS) signal should be added. You can find out how SPI works at Digilent Learning Materials.
The SPI communication protocol uses four communication pins as well as a power and ground pin. There is usually a “master” device and a “slave” device that communicate with each other. The “master” will select one of its “slaves” with its slave select (SS) communication line to indicate to the “slave” that it will communicate with it. The master and the slave will then communicate with each other simultaneously on the MOSI (Master Out Slave In) and MISO (Master In Slave Out) data lines. The master and slave send each other a bit before the actual data is sent to ensure that the SPI is working. Data can be sent from the most significant bit (MSB) or the least significant bit (LSB).
To initiate communication, the master device must bring the chip select (CS) line to a low voltage state and maintain this low voltage state throughout the communication session. The master and slave devices will send a bit to each other for the SPI communication to work. Data can then be transferred simultaneously one bit at a time between the two devices. The microcontroller platform controls the timing of data transfer.
Typically, the SPI protocol transfers one bit of data on the falling edge of the serial clock signal (SCK). Data must be placed on the data line before the falling edge of the serial clock (SCK). The serial clock line (SCK) must also be in a high voltage state before it “falls” to a low voltage state (i.e. before the falling edge). This can be done with a microcontroller by changing the voltage state of the data line before bringing the clock signal to a low voltage state.
The cycle of changing the bit value (voltage) on the serial clock line (SCK) data and pulse line will continue until all required bits are transferred. The chip select (CS) line will be brought to a high voltage state. Then the microcontroller knows that the communication is over and prepares for another session.
A timing diagram of SPI communication is provided below.
Digilent Learn Materials SPI Timing Diagram
Debug SPI communication
Digilent Analog Discovery 2 is a multifunction instrument that allows you to measure, visualize, generate, record and control mixed-signal circuits of all kinds. There are 16 channels for digital inputs or outputs. You can access its logic analyzer, via Digilent Waveformsmulti-instrument software application for debugging SPI communication.
There is a sample project to show you how. In the project you use the Digilent Pmod MIC3 (master) and Digilent Basics 3 (slave) to create the SPI communication. Once the hardware is properly configured. You can debug SPI communication with Analog Discovery 2.
For example, you can create individual signals including CS, SCK, MOSI, MISO, and SCK and SPI protocols in the logic analyzer at the same time to examine each signal in the communication.
Add SPI protocol
Add a digital signal
You can use the logic analyzer in Waveforms to visualize SPI communication.
Timing diagram in the logic analyzer
The step-by-step tutorial for this project is available on the Digilent project page.
Product Overview: What is Analog Discovery 2?
Digilent Analog Discovery 2 is a USB oscilloscope, logic analyzer, and multi-function instrument that allows users to measure, view, generate, record, and control mixed-signal circuits of all kinds. Developed in conjunction with Analog Devices and supported by the Xilinx University Program, this test and measurement device is small enough to fit in your pocket, yet powerful enough to replace a stack of lab equipment, providing professionals with engineering, students and hobbyists. and electronics enthusiasts the freedom to work with analog and digital circuits in virtually any environment, inside or outside the lab. Analog and digital inputs and outputs can be connected to a circuit using simple wired probes; alternatively, the Analog Discovery BNC adapter and BNC probes can be used to connect and use the inputs and outputs.
Driven by the free WaveForms software (Mac, Linux and Windows compatible), Analog Discovery 2 can be configured to operate as any of many traditional test and measurement instruments, including an oscilloscope, waveform generator, power supply, voltmeter, data logger, logic analyzer, frequency generator models, static I/O, spectrum analyzer, network analyzer, impedance analyzer, and protocol analyzer.
Product overview: What is the Basys 3?
Basics 3 is one of the best boards on the market to start with the FPGA. This is an entry-level development board built around a Xilinx Artix-7 FPGA. As a complete, out-of-the-box digital circuit development platform, it includes enough switches, LEDs, and other I/O devices to enable a large number of designs to be made without having to need additional hardware. There are also enough uncommitted FPGA I/O pins to allow expansion of designs using Digilent Pmods or other custom boards and circuits.
The Basics 3 is designed exclusively for Xilinx’s Vivado Design Suite, and the WebPACK edition is available for free download from Xilinx.
To learn more about Digilent products, please visit www.digilent.com.