Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Altera DE2 Board

DE2 Development and Education Board

User Manual

Version 1.6 Copyright © 2012 Altera Corporation


Altera DE2 Board

CONTENTS
Chapter 1 DE2 Package.....................................................................................................................1
1.1 Package Contents .................................................................................................................1
1.2 The DE2 Board Assembly....................................................................................................2
1.3 Getting Help.........................................................................................................................3

Chapter 2 Altera DE2 Board.............................................................................................................4


2.1 Layout and Components ......................................................................................................4
2.2 Block Diagram of the DE2 Board........................................................................................5
2.3 Power-up the DE2 Board .....................................................................................................9

Chapter 3 DE2 Control Panel ......................................................................................................... 11


3.1 Control Panel Setup ........................................................................................................... 11
3.2 Controlling the LEDs, 7-Segment Displays and LCD Display .........................................13
3.3 Switches and Push-buttons.................................................................................................16
3.4 SDRAM/Flash Controller and Programmer ......................................................................17
3.5 USB Monitoring.................................................................................................................18
3.6 PS/2 Device........................................................................................................................19
3.7 SD Card..............................................................................................................................20
3.8 RS-232 Communication.....................................................................................................21
3.9 VGA ...................................................................................................................................22
3.10 Overall Structure of the DE2 Control Panel ......................................................................23

Chapter 4 Using the DE2 Board .....................................................................................................25


4.1 Configuring the Cyclone II FPGA .....................................................................................25
4.2 Using the LEDs and Switches............................................................................................27
4.3 Using the 7-segment Displays............................................................................................31
4.4 Clock Inputs .......................................................................................................................33
4.5 Using the LCD Module......................................................................................................34
4.6 Using the Expansion Header..............................................................................................36
4.7 Using VGA ........................................................................................................................38
4.8 Using the 24-bit Audio CODEC ........................................................................................42
4.9 RS-232 Serial Port .............................................................................................................43
4.10 PS/2 Serial Port ..................................................................................................................43
4.11 Fast Ethernet Network Controller ......................................................................................44
4.12 TV Decoder........................................................................................................................45
4.13 Implementing a TV Encoder..............................................................................................46
4.14 Using USB Host and Device..............................................................................................47
4.15 Using IrDA.........................................................................................................................49
4.16 Using SDRAM/SRAM/Flash.............................................................................................50
ii
Altera DE2 Board

Chapter 5 Examples of Advanced Demonstrations ......................................................................55


5.1 DE2 Factory Configuration................................................................................................55
5.2 TV Box Demonstration ......................................................................................................56
5.3 USB Paintbrush..................................................................................................................58
5.4 USB Device........................................................................................................................60
5.5 A Karaoke Machine ...........................................................................................................62
5.6 Ethernet Packet Sending/Receiving ...................................................................................64
5.7 SD Card Music Player........................................................................................................66
5.8 Music Synthesizer Demonstration .....................................................................................68

iii
DE2 User Manual

Chapter 1
DE2 Package
The DE2 package contains all components needed to use the DE2 board in conjunction with a
computer that runs the Microsoft Windows software.

1.1 Package Contents


Figure 1.1 shows a photograph of the DE2 package.

Figure 1.1. The DE2 package contents.

1
DE2 User Manual

The DE2 package includes:


• DE2 board
• USB Cable for FPGA programming and control
• CD-ROM containing the DE2 documentation and supporting materials, including the User
Manual, the Control Panel utility, reference designs and demonstrations, device datasheets,
tutorials, and a set of laboratory exercises
• CD-ROMs containing Altera’s Quartus® II Web Edition and the Nios® II Embedded Design
Suit Evaluation Edition software.
• Bag of six rubber (silicon) covers for the DE2 board stands. The bag also contains some
extender pins, which can be used to facilitate easier probing with testing equipment of the
board’s I/O expansion headers
• Clear plastic cover for the board
• 9V DC wall-mount power supply

1.2 The DE2 Board Assembly


To assemble the included stands for the DE2 board:
• Assemble a rubber (silicon) cover, as shown in Figure 1.2, for each of the six copper stands
on the DE2 board
• The clear plastic cover provides extra protection, and is mounted over the top of the board
by using additional stands and screws

Figure 1.2. The feet for the DE2 board.

2
DE2 User Manual

1.3 Getting Help


Here are the addresses where you can get help if you encounter problems:

• Altera Corporation
101 Innovation Drive
San Jose, California, 95134 USA
Email: [email protected]

• Terasic Technologies
9F., No.176, Sec.2, Gongdao 5th Rd, East Dist, Hsinchu City, 30070. Taiwan
Email: [email protected]
Web: DE2.terasic.com

• Arches Computing
Unit 708-222 Spadina Ave
Toronto, Ontario, Canada M5T3A2
Email: [email protected]
Web: DE2.archescomputing.com

A BBS (Bulletin Board System) Forum for the DE2 board has been created at the address shown
below. This Forum is meant to serve as a repository for information about the DE2 board, and to
provide a resource through which users can ask questions, and share design examples.

• BBS forum: http://www.terasic.com/english/discuss.htm

3
DE2 User Manual

Chapter 2
Altera DE2 Board
This chapter presents the features and design characteristics of the DE2 board.

2.1 Layout and Components


A photograph of the DE2 board is shown in Figure 2.1. It depicts the layout of the board and
indicates the location of the connectors and key components.

Figure 2.1. The DE2 board.

The DE2 board has many features that allow the user to implement a wide range of designed
circuits, from simple circuits to various multimedia projects.

The following hardware is provided on the DE2 board:


• Altera Cyclone® II 2C35 FPGA device
• Altera Serial Configuration device - EPCS16
• USB Blaster (on board) for programming and user API control; both JTAG and Active Serial
(AS) programming modes are supported
4
DE2 User Manual

• 512-Kbyte SRAM
• 8-Mbyte SDRAM
• 4-Mbyte Flash memory (1 Mbyte on some boards)
• SD Card socket
• 4 pushbutton switches
• 18 toggle switches
• 18 red user LEDs
• 9 green user LEDs
• 50-MHz oscillator and 27-MHz (from TV decoder) for clock sources
• 24-bit CD-quality audio CODEC with line-in, line-out, and microphone-in jacks
• VGA DAC (10-bit high-speed triple DACs) with VGA-out connector
• TV Decoder (NTSC/PAL) and TV-in connector
• 10/100 Ethernet Controller with a connector
• USB Host/Slave Controller with USB type A and type B connectors
• RS-232 transceiver and 9-pin connector
• PS/2 mouse/keyboard connector
• IrDA transceiver
• Two 40-pin Expansion Headers with diode protection

In addition to these hardware features, the DE2 board has software support for standard I/O
interfaces and a control panel facility for accessing various components. Also, software is provided
for a number of demonstrations that illustrate the advanced capabilities of the DE2 board.

In order to use the DE2 board, the user has to be familiar with the Quartus II software. The
necessary knowledge can be acquired by reading the tutorials Getting Started with Altera’s DE2
Board and Quartus II Introduction (which exists in three versions based on the design entry method
used, namely Verilog, VHDL or schematic entry). These tutorials are provided in the directory
DE2_tutorials on the DE2 System CD-ROM that accompanies the DE2 board and can also be
found on Altera’s DE2 web pages.

2.2 Block Diagram of the DE2 Board


Figure 2.2 gives the block diagram of the DE2 board. To provide maximum flexibility for the user,
all connections are made through the Cyclone II FPGA device. Thus, the user can configure the
FPGA to implement any system design.

5
DE2 User Manual

Figure 2.2. Block diagram of the DE2 board.

Following is more detailed information about the blocks in Figure 2.2:

Cyclone II 2C35 FPGA


• 33,216 LEs
• 105 M4K RAM blocks
• 483,840 total RAM bits
• 35 embedded multipliers
• 4 PLLs
• 475 user I/O pins
• FineLine BGA 672-pin package

Serial Configuration device and USB Blaster circuit


• Altera’s EPCS16 Serial Configuration device
• On-board USB Blaster for programming and user API control
• JTAG and AS programming modes are supported

6
DE2 User Manual

SRAM
• 512-Kbyte Static RAM memory chip
• Organized as 256K x 16 bits
• Accessible as memory for the Nios II processor and by the DE2 Control Panel

SDRAM
• 8-Mbyte Single Data Rate Synchronous Dynamic RAM memory chip
• Organized as 1M x 16 bits x 4 banks
• Accessible as memory for the Nios II processor and by the DE2 Control Panel

Flash memory
• 4-Mbyte NOR Flash memory (1 Mbyte on some boards)
• 8-bit data bus
• Accessible as memory for the Nios II processor and by the DE2 Control Panel

SD card socket
• Provides SPI and 4-bit SD mode for SD Card access
• Accessible as memory for the Nios II processor with the DE2 SD Card Driver

Pushbutton switches
• 4 pushbutton switches
• Debounced by a Schmitt trigger circuit
• Normally high; generates one active-low pulse when the switch is pressed

Toggle switches
• 18 toggle switches for user inputs
• A switch causes logic 0 when in the DOWN (closest to the edge of the DE2 board) position
and logic 1 when in the UP position

Clock inputs
• 50-MHz oscillator
• 27-MHz clock input
• SMA external clock input

7
DE2 User Manual

Audio CODEC
• Wolfson WM8731 24-bit sigma-delta audio CODEC
• Line-level input, line-level output, and microphone input jacks
• Sampling frequency: 8 to 96 KHz
• Applications for MP3 players and recorders, PDAs, smart phones, voice recorders, etc.

VGA output
• Uses the ADV7123 140-MHz triple 10-bit high-speed video DAC
• With 15-pin high-density D-sub connector
• Supports up to 1600 x 1200 at 100-Hz refresh rate
• Can be used with the Cyclone II FPGA to implement a high-performance TV Encoder

NTSC/PAL TV decoder circuit


• Uses ADV7180 Multi-format SDTV Video Decoder
• Supports worldwide NTSC/PAL/SECAM color demodulation
• One 10-bit ADC, 4X over-sampling for CVBS
• Supports Composite Video (CVBS) RCA jack input.
• Supports digital output formats (8-bit/16-bit): ITU-R BT.656 YCrCb 4:2:2 output + HS, VS,
and FIELD
• Applications: DVD recorders, LCD TV, Set-top boxes, Digital TV, Portable video devices

10/100 Ethernet controller


• Integrated MAC and PHY with a general processor interface
• Supports 100Base-T and 10Base-T applications
• Supports full-duplex operation at 10 Mb/s and 100 Mb/s, with auto-MDIX
• Fully compliant with the IEEE 802.3u Specification
• Supports IP/TCP/UDP checksum generation and checking
• Supports back-pressure mode for half-duplex mode flow control

USB Host/Slave controller


• Complies fully with Universal Serial Bus Specification Rev. 2.0
• Supports data transfer at full-speed and low-speed
• Supports both USB host and device
• Two USB ports (one type A for a host and one type B for a device)
• Provides a high-speed parallel interface to most available processors; supports Nios II with a
Terasic driver
• Supports Programmed I/O (PIO) and Direct Memory Access (DMA)
8
DE2 User Manual

Serial ports
• One RS-232 port
• One PS/2 port
• DB-9 serial connector for the RS-232 port
• PS/2 connector for connecting a PS2 mouse or keyboard to the DE2 board

IrDA transceiver
• Contains a 115.2-kb/s infrared transceiver
• 32 mA LED drive current
• Integrated EMI shield
• IEC825-1 Class 1 eye safe
• Edge detection input

Two 40-pin expansion headers


• 72 Cyclone II I/O pins, as well as 8 power and ground lines, are brought out to two 40-pin
expansion connectors
• 40-pin header is designed to accept a standard 40-pin ribbon cable used for IDE hard drives
• Diode and resistor protection is provided

2.3 Power-up the DE2 Board


The DE2 board comes with a preloaded configuration bit stream to demonstrate some features of
the board. This bit stream also allows users to see quickly if the board is working properly. To
power-up the board perform the following steps:

1. Connect the provided USB cable from the host computer to the USB Blaster connector on
the DE2 board. For communication between the host and the DE2 board, it is necessary to
install the Altera USB Blaster driver software. If this driver is not already installed on the
host computer, it can be installed as explained in the tutorial Getting Started with Altera's
DE2 Board. This tutorial is available on the DE2 System CD-ROM and from the Altera
DE2 web pages.
2. Connect the 9V adapter to the DE2 board
3. Connect a VGA monitor to the VGA port on the DE2 board
4. Connect your headset to the Line-out audio port on the DE2 board
5. Turn the RUN/PROG switch on the left edge of the DE2 board to RUN position; the
PROG position is used only for the AS Mode programming
6. Turn the power on by pressing the ON/OFF switch on the DE2 board

9
DE2 User Manual

At this point you should observe the following:


• All user LEDs are flashing
• All 7-segment displays are cycling through the numbers 0 to F
• The LCD display shows Welcome to the Altera DE2 Board
• The VGA monitor displays the image shown in Figure 2.3.
• Set the toggle switch SW17 to the DOWN position; you should hear a 1-kHz sound
• Set the toggle switch SW17 to the UP position and connect the output of an audio player to
the Line-in connector on the DE2 board; on your headset you should hear the music played
from the audio player (MP3, PC, iPod, or the like)
• You can also connect a microphone to the Microphone-in connector on the DE2 board; your
voice will be mixed with the music played from the audio player

Figure 2.3. The default VGA output pattern.

10
DE2 User Manual

Chapter 3
DE2 Control Panel
The DE2 board comes with a Control Panel facility that allows users to access various components
on the board from a host computer. The host computer communicates with the board through a USB
connection. The facility can be used to verify the functionality of components on the board or be
used as a debug tool while developing RTL code.

This chapter first presents some basic functions of the Control Panel, then describes its structure in
block diagram form, and finally describes its capabilities.

3.1 Control Panel Setup


The Control Panel Software Utility is located in the directory “DE2_control_panel” in the DE2
System CD. It's free of installation, just copy the whole folder to your host computer and launch the
control panel by executing the “DE2_ControlPanel.exe”.

Specific control circuit should be downloaded to your FPGA board before the control panel can
request it to perform required tasks. The program will call Quartus II tools to download the control
circuit to the FPGA board through USB-Blaster[USB-0] connection.

To activate the Control Panel, perform the following steps:

1. Make sure Quartus II 12.0 or later version is installed successfully on your PC.
2. Set the RUN/PROG switch to the RUN position
3. Connect the supplied USB cable to the USB Blaster port, connect the 9V power supply,
and turn the power switch ON.
4. Start the executable DE2_ControlPanel.exe on the host computer. The Control Panel user
interface shown in Figure 3.1 will appear.
5. The DE2_ControlPanel.sof bit stream is loaded automatically as soon as the
DE2_control_panel.exe is launched.
6. In case the connection is disconnected, click on CONNECT where the .sof will be
re-loaded onto the board.
7. Note, the Control Panel will occupy the USB port until you close that port; you cannot use
Quartus II to download a configuration file into the FPGA until the USB port is closed.

11
DE2 User Manual

8. The Control Panel is now ready for use; experience it by setting the ON/OFF status for
some LEDs and observing the result on the D1 board.

Figure 3.1. The DE2 Control Panel.

The concept of the DE2 Control Panel is illustrated in Figure 3.2. The “Control Circuit” that
performs the control functions is implemented in the FPGA board. It communicates with the
Control Panel window, which is active on the host computer, via the USB Blaster link. The
graphical interface is used to issue commands to the control circuit. It handles all requests and
performs data transfers between the computer and the DE2 board.

12
DE2 User Manual

Figure 3.2. The DE2 Control Panel concept.

The DE2 Control Panel can be used to light up LEDs, change the values displayed on 7-segment
and LCD displays, monitor buttons/switches status, read/write the SDRAM and Flash Memory,
monitor the status of an USB device, communicate with the PS/2 mouse, output VGA color pattern
to VGA monitor, communicate with PC via RS-232 interface and read SD Card specification
information. The feature of reading/writing a word or an entire file from/to the Flash Memory
allows the user to develop multimedia applications (Flash Audio Player, Flash Picture Viewer)
without worrying about how to build a Memory Programmer.

3.2 Controlling the LEDs, 7-Segment Displays and LCD Display


A simple function of the Control Panel is to allow setting the values displayed on LEDs and
7-segment displays.

Choosing the LED tab leads to the window in Figure 3.3. Here, you can directly turn the LEDs on
or off individually or by clicking “Light All” or “Unlight All”.

13
DE2 User Manual

Figure 3.3. Controlling LEDs.

Choosing the 7-SEG tab leads to the window shown in Figure 3.4. From the window, directly use
the left-right arrows to control the 7-SEG patterns on the DE2 board which are updated immediately.
Note that the dots of the 7-SEGs are not enabled on DE2 board.

14
DE2 User Manual

Figure 3.4. Controlling 7-SEG display.


Choosing the LCD tab leads to the window in Figure3.5. Text can be written to the LCD display by
typing it in the LCD box then pressing the Set button.

Figure 3.5 Controlling the LCD display


15
DE2 User Manual

The ability to set arbitrary values into simple display devices is not needed in typical design
activities. However, it gives the user a simple mechanism for verifying that these devices are
functioning correctly in case a malfunction is suspected. Thus, it can be used for troubleshooting
purposes.

3.3 Switches and Push-buttons


Choosing the Switches tab leads to the window in Figure 3.6. The function is designed to monitor
the status of slide switches and push-buttons in real time and show the status in a graphical user
interface. It can be used to verify the functionality of the slide switches and push-buttons.

Figure 3.6. Monitoring switches and buttons.

The ability to check the status of push-button and slide switch is not needed in typical design
activities. However, it provides users a simple mechanism for verifying if the buttons and switches
are functioning correctly. Thus, it can be used for troubleshooting purposes

16
DE2 User Manual

3.4 SDRAM/Flash Controller and Programmer


The Control Panel can be used to write/read data to/from the SDRAM and Flash chips on the DE2
board. As an example, we will describe how the SDRAM may be accessed; the same approach is
used to access the Flash. Click on the Memory tab and select “SDRAM” to reach the window in
Figure 3.7.

Figure 3.7. Accessing the SDRAM.

A 16-bit word can be written into the SDRAM by entering the address of the desired location,
specifying the data to be written, and pressing the Write button. Contents of the location can be read
by pressing the Read button. Figure 3.7 depicts the result of writing the hexadecimal value 06CA
into offset address 200, followed by reading the same location.

The Sequential Write function of the Control Panel is used to write the contents of a file into the
SDRAM as follows:

1. Specify the starting address in the Address box.

17

You might also like