Beginning FPGA Programming - Partie74
Beginning FPGA Programming - Partie74
The following link provides more info on thee SPIDEV modules: www.100randomtasks.
com/simple-spi-on-raspberry-pi.
365
Chapter 15 ■ Two-Way Communications with Your Raspberry Pi: SPI
Run the Python code as follows. Figure 15-24 shows the result from the Raspberry Pi. The LEDs on
the BeMicro MAX10 board will start blinking when the code is running. The LED is on and off as the value
shown in the Raspberry PI.
$ python max10spi_simple.py
Following are additional web sites with information about the SPI in Raspberry Pi:
http://raspberrypi-aa.github.io/session3/spi.html
www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/
15.6 Summary
This chapter shows you how to do two-way communication with your Raspberry Pi. We created our own
two-byte protocol for reading and writing.
We have also provided detailed design explanations on the spi_slave. You should now know the
function of all six processes in the design and the connection between them. This example illustrates
(clock edge detection) how to deal with the number-one issue of external communication—clock in the
communication link. The example shows you how to use shift registers to send and receive data.
It is not that hard to send and receive data to and from the FPGA though standard interfaces.
“As an engineer I’m constantly spotting problems and plotting how to solve them.”
—James Dyson
366
CHAPTER 16
16.1 Introduction
In this chapter we will introduce a 7 segment display counter design. The counter counts from 0 to 9 and
then resets to 0 and starts again. The Raspberry Pi can also send a control message to force the counter to
have a particular value. We will re-use all of the VHDL code from Chapter 15 and add a 7 segment display
counter module.
368
Chapter 16 ■ Up in Lights: How to Drive LED Segment Displays
The connections should look like the following table mapping on the FPGA side. We will use the FPGA
port names in the VHDL design.
369