hello! I'm Ryosu, a new engineer on the Lattice team.

 

Last time, we confirmed the operation of the temperature sensor using Digilent's Analog Discovery.

 

This time, I would like to examine the outline of SPI communication.

 

For those of you who are visiting this blog for the first time, let me give you a brief overview of this blog.

In this blog, I will introduce the process of making a temperature sensor that controls 7 segments with FPGA.

(If you're interested, I'll attach links to other episodes below, so please take a look!)

What does it mean to create SPI communication?

 

I thought about designing SPI communication, but I can't imagine "making communication" in the first place...

 

Should I write only the data I want to set using a certain function? Is the description language C language? Is it possible in Python? When

 

I had a lot of questions and didn't know where to start, so I decided to research "SPI communication concept" first.

 

Serial and parallel communication

 

First, I had heard of concepts like Paradise Syria for communications, so I decided to look it up.

 

Communication can be roughly divided into "parallel communication" and "serial communication". (Paradise...)

 

The image of parallel communication and serial communication is as follows.

 

 

As you can see from the diagram above,

 

Parallel communication, as the name suggests, is a method of transmitting data in parallel by preparing several data lines.

 

Serial communication is a method of transmitting data bit by bit from a single data line. (The image is a rocket pencil?)

 

Compared to serial communication, parallel communication has the advantage of being able to send more data at once.

 

However, there are also disadvantages such as the need for many lines to transmit data, the need to consider data synchronization more, and the cost.

 

On the other hand, serial communication has less communication volume than parallel communication, but it is superior in that data is sent in sequence and in terms of cost.

 

SPI communication is a type of serial communication method.

SPI communication

 

I understand that SPI communication is serial communication. Does that mean that you are communicating with only one wire?

 

Is there supposed to be transmission and reception, and is it all covered by one line?

 

If so, how do you distinguish where the data is sent from and where it is received?

 

I still have a lot of questions, so I decided to quickly look into SPI communication.

 

SPI communication uses 4 wires!

 

Looking into SPI communication,

 

It turns out that SPI communication consists of four communication lines, divided into master and slave.

 

There are four lines, MISO, MOSI, SCLK, and CS.

 

The table below summarizes each line.

Abbreviation

name

meaning

MISO

Master-In Slave-Out

FPGA side is input, sensor side is output

MOSI

Master-Out Slave-In

Output on FPGA side, input on sensor side

SCLK

Slave Clock

Input clock to sensor

CS

Chip Select

Communication starts when this signal = Low Communication stops when CS = High

 

When the FPGA is the master and the temperature sensor is the slave, use the MOSI line to send commands from the FPGA to the temperature sensor.

 

It turns out that the data from the temperature sensor comes through MISO.

 

We also found that the data from the temperature sensor is synchronized with the SCLK output from the FPGA, and that data is exchanged during the period when CS is low.

 

Expressed as a waveform, it looks like this:

 

After CS = Low, SCLK starts moving from High → Low, Low → High.

 

On the rising edge of SCLK, send/receive data bit by bit so that the data is centered.

 

I see, I was able to understand the outline of SPI communication somehow!

 

As an impression,

 

I thought it would be easier to understand if I followed the waveforms one by one!

 

Next time, I would like to move on to RTL design.

 

See you next time! See ya!

About the Lattice FPGA Getting Started Blog

 

Throughout the article, we are making a module that converts the temperature (SPI communication) acquired by the temperature sensor inside the FPGA and displays it on the 7-segment LED display!

 

If you are interested in "What is this newcomer making?"

 

I would be happy if you could check the module production process and the whole picture from the page below!