cyclone 10 lp spi slave to avalon master bridge hardware ...€¦ · how to setup the hardware for...

12
©2017 Intel Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, HARDCOPY, INTEL, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are trademarks of Intel Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Intel warrants performance of its semiconductor products to current specifications in accordance with Intel's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Intel assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Intel. Intel customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services. Date: 8/17/2017 Revision: 1.0 Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware Development Reference Design User Guide

Upload: others

Post on 06-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

©2017 Intel Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, HARDCOPY, INTEL, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are trademarks of Intel Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Intel warrants performance of its semiconductor products to current specifications in accordance with Intel's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Intel assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Intel. Intel customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services.

Date: 8/17/2017

Revision: 1.0

Cyclone 10 LP SPI Slave to Avalon Master Bridge

Hardware Development

Reference Design User Guide

Page 2: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

2

Table of Contents Introduction.................................................................................................................................................... 3

Requirements ................................................................................................................................................ 3

Theory of Operation ...................................................................................................................................... 4

How to Setup the Hardware for Link Test ..................................................................................................... 4

How to Reconstruct and Running the Reference Design ............................................................................. 5

Get Started with Quartus ........................................................................................................................... 5

Building Your Qsys Based Processor System .......................................................................................... 5

Creating the Software for the “Hello World” Design .................................................................................. 6

Downloading the Hardware Image ............................................................................................................ 9

Running Software .................................................................................................................................... 10

Conclusion................................................................................................................................................... 12

References .................................................................................................................................................. 12

Revision History .......................................................................................................................................... 12

Page 3: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

3

Introduction

This Cyclone® 10 LP Nios® II hardware development tutorial introduces you to the system

development flow for the Nios II processor. This design example demonstrates how to use the

SPI Slave to Avalon® Master Bridge to provide a connection between the host and the remote

system for SPI transactions.

Requirements The reference design requires the following hardware and software to run the test:

• Quartus® Prime Software Version: 17.0

• Cyclone 10 LP FPGA Evaluation Kit

Figure 1. Cyclone 10 LP FPGA Evaluation Kit

Page 4: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

4

Theory of Operation

Figure 2. Block diagram of modules in the reference design

The system in this design example consists of two sub-systems. The first is the host system,

which consists of a Nios® II CPU and SPI Master Core, that initiates the SPI transactions. The

second is the remote system which consists of the SPI Slave to Avalon Master Bridge and an on-

chip memory. For demonstration purposes, these two sub-systems are connected internally

within the FPGA without going through any physical pin routing.

The software portion demonstrates how to perform read and write transactions using the SPI Slave

to Avalon Master Bridge. In order for the SPI Slave to Avalon Master Bridge to successfully

convert incoming streams of data into Avalon Memory-Mapped (Avalon-MM) transactions, the

host system CPU needs to encode and packetize the streams of data according to the protocols

used by the bridge. Similarly, outgoing streams of data from the SPI Slave to the Avalon Master

Bridge need to be converted according to the same protocol used by the CPU. The software files

needed to perform this process are included in the ZIP file.

How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

1. Connect the USB cable coming together with the Cyclone 10 LP FPGA Evaluation Kit between the

PC and the kit as shown in Figure 1

2. The USB cable will supply the power as well as establish the JTAG connection with the kit

3. Use the default switching settings. For more details about default switching settings, please refer

to Cyclone 10 LP FPGA Evaluation Kit user guide

4. The hardware system is now ready for programming

Page 5: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

5

How to Reconstruct and Running the Reference Design

Get Started with Quartus Download the reference design from Design Store and then follow the instruction in the Design Store to

prepare the design template and load the design into your Quartus software.

Building Your Qsys Based Processor System Now we can move on to build the Qsys system. The Block design consist 3 block

i. PLL

ii. cpu_spi_core

iii. cpu_bridge_system

Users can double click and understand the QSYS files and IP setting.

You may now run a full compilation with your design.

Page 6: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

6

Creating the Software for the “Hello World” Design The Nios II Software Build Tools (SBT) for Eclipse are included as part of Quartus. These tools will help

manage creation of the application software and Board Support Package (BSP). Board Support Package

contains libraries, linker file, drivers for IP blocks, along with Hardware Abstraction Layer (HAL). Launch it

from Tools -> Nios II Software Build Tools for Eclipse. You can use the default location that Eclipse picks

for you. It’s usually better to create a folder called “software” in your Quartus project folder and choose

it as the workspace. An example is shown in Figure 21. Click “OK” to continue.

Figure 21. Eclipse Workspace Setup

After Eclipse SBT finishes the launch process, right click in the area called “Project Explorer” and select

New -> Nios II Application and BSP from Template as shown in Figure 22.

Figure 22. Creating Project from Template in Eclipse SBT

Next you will see a panel that requests information to setup your design. First you need to setup the target

hardware information. Navigate to your Quartus project directory and click on the

“cpu_spi_core.sopcinfo” file as shown in Figure 23. The. sopcinfo file tells Eclipse what your Qsys system

contains. Click OK.

Page 7: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

7

Figure 23. Navigating to the correct. sopcinfo File

As shown in Figure 24, fill in the Project name. Call it niosii_hw_dev_tutorial_sw. Next you will be asked

to pick a template design. The Hello World Small is a software application to write “Hello from Nios II” to

the screen. Click Finish. Note: make sure to pick Hello World Small and not Hello World or you will not

have enough memory in your FPGA design to store the program executable.

Page 8: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

8

Figure 24. Completing Setup with Project Name and Template

Click the arrow next to niosii_hw_dev_tutorial_sw. It will show the contents of your project. Double-click

hello_world_small.c to inspect the code.

Page 9: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

9

Downloading the Hardware Image The Cyclone 10 LP FPGA Evaluation Kit is powered through the USB cable. Connect the USB cable coming

together between the PC and the kit as shown in Figure 1. The kit should be powered up with LEDs on the

board light up. The USB cable will also establish the JTAG connection with the kit.

In Quartus II, launch the Programmer: Tools -> Programmer and then program the .sof into the kit. After

successful programming the kit, you can push PB0 to see if it can turn ON the LED0 as shown in Figure 28.

If yes, it means that your hardware image was downloaded successfully.

Figure 28. Pushing of PB0 to turn ON LED0

Page 10: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

10

Running Software After successfully build the “Hello World from NIOS II”, copy over all the app and bsp files from

software_h_file folder to the respective folder and delete the “Hello_World_Small.c” and refresh it.

Figure 29. Copy app files

Figure 29. Copy bsp files

Page 11: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

11

Figure 30. Rerun the application with NIOS II hardware

Figure 30. SPI slave to Avalon master bridge transaction

Page 12: Cyclone 10 LP SPI Slave to Avalon Master Bridge Hardware ...€¦ · How to Setup the Hardware for Link Test Follow these steps to setup the hardware to run the reference design:

12

Conclusion This tutorial introduces you to the system development flow for the Nios II processor to demonstrates

how to use the SPI Slave to Avalon® Master Bridge to provide a connection between the host and the

remote system for SPI transactions using Cyclone 10 LP FPGA Evaluation Kit.

References • SPI Slave to Avalon Master Bridge Design Example

https://www.altera.com/support/support-resources/design-examples/intellectual-

property/embedded/nios-ii/exm-spi-bridge.html

Revision History Date Version Changes

August 18, 2017 1.0 Initial Release