Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
The FPGA Programming Handbook - Second Edition

You're reading from  The FPGA Programming Handbook - Second Edition

Product type Book
Published in Apr 2024
Publisher Packt
ISBN-13 9781805125594
Pages 550 pages
Edition 2nd Edition
Languages
Authors (2):
Frank Bruno Frank Bruno
Profile icon Frank Bruno
Guy Eschemann Guy Eschemann
Profile icon Guy Eschemann
View More author details

Table of Contents (17) Chapters

Preface Introduction to FPGA Architectures FPGA Programming Languages and Tools Combinational Logic Counting Button Presses Let’s Build a Calculator FPGA Resources and How to Use Them Math, Parallelism, and Pipelined Design Introduction to AXI Lots of Data? MIG and DDR2 A Better Way to Display – VGA Bringing It All Together Using the PMOD Connectors – SPI and UART Embedded Microcontrollers Using the Xilinx MicroBlaze Advanced Topics Other Books You May Enjoy
Index

Using the PMOD Connectors – SPI and UART

In the previous chapter, we focused on putting together everything we learned throughout the book. We took our temperature sensor, which relied on math and pipelining, our VGA controller, which had multiple clock domains and state machines, and our character generator. We modified our state machines to display the waveform from our microphone and made a simple project to bring it all together. Now we’ll take a look at what to do if we have external devices to connect.

Up until now, we’ve focused on the resources that are built into the FPGA and on the board. You have probably noticed that the Nexys A7 board has five black connectors, two on the left-hand side, and three on the right-hand side of the board. These are Digilent Peripheral MODule connectors or PMODs.

PMOD connectors allow system designers to purchase pre-made daughter cards or to design their own cards to interface with the FPGA on the board. PMOD connectors...

Technical requirements

The technical requirements for this chapter are the same as those for Chapter 2, FPGA Programming Languages and Tools.

To follow along with the examples and the project, you can find the code files for this chapter at the following repository on GitHub: https://github.com/PacktPublishing/The-FPGA-Programming-Handbook-Second-Edition/tree/main/CH12.

If you wish to use the PMODs that are used in this section, they can be found on Digilent’s website: https://digilent.com/shop/fpga-boards/accessories/pmod-expansion-modules/

UART PMOD

The UART PMOD can be found at https://digilent.com/shop/pmod-usbuart-usb-to-uart-interface/. Alternatively, you can use the UART on the board by using the pins defined in the XDC file if you don’t wish to use the PMOD.

ACL2 PMOD

The ACL2 PMOD can be found at https://digilent.com/shop/pmod-acl2-3-axis-mems-accelerometer/. Alternatively, the Nexys A7 includes the same part on the board and you can...

Understanding Peripheral Modules (PMODs)

Digilent introduced the PMOD connector as a way to provide a standardized interface for its development boards. The goal of the PMOD specification is to allow the development of lower-speed daughter cards, such as I2C, SPI, UART, and General-Purpose Input/Output (GPIO) peripherals. The standard is open and has been adopted by multiple companies both for their development boards and to provide different PMODs for developers.

PMOD connectors primarily provide low-speed connections of a predefined type. In practice, the power connections are the only pins that are constant, and the others could be used for any signaling up to about 100MHz operation, even though this would technically be beyond the original spec.

From the Nexys A7 perspective, four of the PMODs connect to GPIO and the fifth is dual-purpose analog/digital.

...

Pin

PMOD JA

Introduction to Universal Asynchronous Receiver-Transmitter (UART)

The UART interface is one of the oldest interfaces still active and in use. It was developed in the 1960s by Digital Equipment Corporation for its PDP-1 minicomputer.

Figure 12.2: Serial connection between a computer and test equipment

Today it is used as a debug port from televisions to test equipment. It’s commonly used to communicate with embedded processors like the Microblaze that we will use in Chapter 13, Embedded Microcontrollers using the Xilinx MicroBlaze.

Let’s take a look at the physical connections of the UART bus.

Bus interface

The UART interface is a slow speed compared to modern-day interfaces. Current serial interfaces such as USB or PCIe lanes can be multiple gigabits per second. UART is a serial interface that can be run in full duplex where data is sent and received simultaneously, or half duplex where RX and TX do not run at the same time. In the design we...

Understanding Serial Peripheral Interface (SPI)

Like I2C, the SPI bus is a simple bus for low speed communications. It operates faster than I2C since it uses chip selects rather than passing addresses that need to be decoded, wasting valuable bandwidth. It also utilizes a separate receive and transmit bus, so that it can operate bidirectionally at the same time. It is a four-wire interface that has bidirectional data, a clock, and chip select.

Figure 12.6: deadbeef displayed on the board

It’s used in places where you may want to have easy read and write access with optional burstiness – typically used on things like ADCs, DACs, and other sensors that typically do not operate with high performance. It’s also a common interface for Erasable Programmable Read-Only Memory (EPROM) or low-speed access to Flash or SD cards.

Let’s look at the Digilent ACL2 PMOD, a 3-axis MEMS accelerometer.

ACL2 PMOD

The ACL2 PMOD from Digilent is based...

Summary

In this chapter, we’ve looked at two more serial interfaces commonly used among hobbyists and in industry, namely the UART and SPI. We’ve developed IP, simulated the UART, and tested both IPs on the board. We’ve also looked at the PMOD interface, and hopefully, you’ve checked out the Digilent website and come up with different ideas for projects using readily available components and IP.

Although we’ll use a Xilinx IP, the UART will become an important interface for us when we look at the Microblaze in the next chapter.

Questions

  1. The UART and SPI are examples of:
    1. Serial interfaces
    2. High-speed interfaces like PCIe
    3. Low-speed, lightweight interfaces
    4. a and c
  2. UART interfaces are commonly used for:
    1. CPU terminal connections
    2. Graphical displays
    3. Multi-chip busses
  3. MISO, MOSI, CSn, and SCLK are all part of the ______ bus:
    1. I2C
    2. SPI
    3. UART
    4. DDR2
  4. Which signals are part of the UART interface? (Choose all that apply)
    1. CSn
    2. RXD
    3. TXD
    4. SCLK
  5. Which bus uses oversampling of data?
    1. UART
    2. I2C
    3. SPI

Answers

  1. a) Serial interfaces
  2. a) CPU terminal connections
  3. b) SPI
  4. b) RXD and c) TXD
  5. a) UART

Further reading

For more information about what was covered in this chapter, please refer to the following link:

Join our community on Discord

Join our community’s Discord space for discussions with the authors and other readers:

https://packt.link/embedded

lock icon The rest of the chapter is locked
You have been reading a chapter from
The FPGA Programming Handbook - Second Edition
Published in: Apr 2024 Publisher: Packt ISBN-13: 9781805125594
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}