VEEK-MT2S Control Panel
VEEK-MT2S Control Panel
VEEK-MT2S i www.terasic.com
Control Panel May 2, 2017
7.2 TEST FPGA CONFIGURATION FILE ........................................................................................................................ 103
7.3 MORE ON THE QUARTUS PROJECT......................................................................................................................... 104
VEEK-MT2S ii www.terasic.com
Control Panel May 2, 2017
Chapter 1
Overview
The purpose of this document is to develop a QT based GUI application running on
DE1-SoC-MTL2 LXDE Linux. The control panel is a QT based GUI utility running on Linux and
communicating with peripherals connected to the FPGA side. This document describes how to
rebuild its Quartus project and QT project. Users will learn how to setup the environment of QT
development on Linux and develop their GUI software base on the control panel example given.
Figure 1-1 shows the block diagram of the Control Panel where user can see the Control Panel
program is running on Linux on the left-hand side. The program GUI is built based on Qt library
and it can access the FPGA resources through the AXI bus. The Linux Frame Buffer Display
hardware is implemented based on Altera VIP suite and HPS DDR3 SDRAM memory is used as
frame buffer. The Nios II processor is implemented to configure the VIP when the system is booted.
The Nios II program runs on the on-chip memory.
VEEK-MT2S 1 www.terasic.com
Control Panel May 2, 2017
1.2 Lear ning Topics
To give users an outline what they will learn in this manual, here we provide a list of topics that will
be covered and explained:
VEEK-MT2S 2 www.terasic.com
Control Panel May 2, 2017
1.3 System Requirements
Before starting this tutorial, please note that the following items are required to complete the
Control Panel project:
A x64 PC
VEEK-MT2S FPGA board
Linux Ubuntu 16.04 x64 Installer
Options if Windows Host is preferred
MS Windows Installer
VMware Workstation Player Installer
Qt 5.7.0 for Linux 64-bit Installer
Qt 5.5.1 open source
Quartus Prime 16.1 or later installer
Our Control Panel program GUI is built using the Qt library. Considering that most users might not
be familiar with the Qt library, we believe it would be most helpful to first list all the steps required
to complete the control panel project in the following:
This section describes how to set up the Control Panel program on the VEEK-MT2S Development
Kit. There are five major steps involved. Please carefully follow the instructions below. If you
already have the MicroSD card for LXDE Desktop, skip first two steps.
VEEK-MT2S 3 www.terasic.com
Control Panel May 2, 2017
1. Download microSD card writer utility – Win32 Disk Imager
2. Download the compressed LXDE Desktop image file. Then, decompress the compressed
image file, and write the file into a microSD card (at least 4GB) with an ImageWriter
Utility
3. Insert the microSD card intro VEEK-MT2S FPGA Development Board, connect a USB
keyboard and mouse to the USB host port, connect a LCD monitor to the VGA-output
port, then power on the board to boot Linux System.
4. Boot LXDE Desktop.
5. Double click "ControlPanel" icon on LXDE Desktop to launch the Control Panel Utility.
If a confirm dialog appears, please click the "Execute" button.
To write the microSD card image into a microSD card, a writing tool is required. In this tutorial,
Win32 Disk Imager utility is used. This utility is a shareware, users can download it from the web:
(http://sourceforge.net/projects/win32diskimager/)
On the download page as shown in Figure 1-2, click "Download" to start the download process.
The downloaded filename is "Win32DiskImager-0.9.5-install.exe".
Install the Win32DiskImage by executing the installer and execute Win32DiskImage.exe to launch
the tool as shown in Figure 1-3.
VEEK-MT2S 4 www.terasic.com
Control Panel May 2, 2017
Figure 1-3 Win32 Disk Imager
The "LXDE Desktop" microSD card image is available from the website:
http://veek-mt2s.terasic.com/cd
Please download the microSD card image "Linux LXDE Desktop" under the Linux BSP section.
The filename is VEEK_MT2S_LXDE.zip. The archive needs to be decompressed to extract the
image named VEEK_MT2S_LXDE.img.
Then, insert a microSD card (at least 8GB) into the host Windows. Launch Win32 Disk Imager,
select the inserted microSD card in the Device list box and click on the Folder icon to select the
image file VEEK_MT2S_LXDE.img. Click "Write" to start writing the image file into the
microSD card as shown in Figure 1-4.
Before writing, a "Confirm overwrite" dialog appears as shown in Figure 1-5. Make sure the device
is the microSD card, and click "Yes" to close the window.
VEEK-MT2S 5 www.terasic.com
Control Panel May 2, 2017
Figure 1-5 Confirm to Continue
When the writing process is complete, a "Complete" dialog appears as shown in Figure 1-6. Click
"OK" to close the window.
Connect the following items to the VEEK-MT2S development board as shown in Figure 1-7.
Linux LXDE Desktop microSD Card
PAL/NTSC video signal from a Media Player
Speaker
Ethernet (option, only needed on Section 6.3 and Section 8.4)
DC Power for VEEK-MT2S
VEEK-MT2S 6 www.terasic.com
Control Panel May 2, 2017
Figure 1-7 VEEK-MT2S Development Board Setup
Please also make sure that MSEL[4:0]=01010 located on the back of the VEEK-MT2S FPGA
development board as shown in
Figure 1-8.
VEEK-MT2S 7 www.terasic.com
Control Panel May 2, 2017
Figure 1-8 MSEL[4:0] on the VEEK-MT2S FPGA Development Board
After connecting the above peripherals, power on the VEEK-MT2S board. The LCD monitor will
now display Penguin Linux Logo as shown in Figure 1-9.
When the Linux boot process is complete, LXDE Desktop will appear as shown in Figure 1-10.
VEEK-MT2S 8 www.terasic.com
Control Panel May 2, 2017
Figure 1-10 Launch the Control Panel
After successful boot, the Control Panel execution file "ControlPanel" is pre-built in the desktop.
Please double click "ControlPanel" icon and click "Execute" button to launch the Control Panel as
shown in Figure 1-11. Note that Qt library has been preinstalled in the microSD card image
therefore users can simply launch the Control Panel without installing the Qt library.
The Control Panel window will appear on the LCD monitor as shown Figure 1-11. Now, you can
use the USB mouse to operate the Control Panel.
Choosing the LED tab leads to the window in Figure 1-12. Here, you can directly turn the LEDs on or
off individually or by clicking “Light All” or “Unlight All”.
VEEK-MT2S 9 www.terasic.com
Control Panel May 2, 2017
Figure 1-12 Controlling LED
Choosing the 7-SEG tab leads to the window shown in Figure 1-13. From the window, directly use the
up-down arrows to control the 7-SEG patterns on the VEEK-MT2S board which are updated
immediately. Note that the dots of the 7-SEGs are not enabled on VEEK-MT2S board.
Choosing the Switches tab leads to the window in Figure 1-14. 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.
VEEK-MT2S 10 www.terasic.com
Control Panel May 2, 2017
Choosing the G-Sensor tab leads to the window in Figure 1-15. The function is designed to monitor the
status of G-Sensor in real time and show the status graphically. It can be used to verify the functionality
of the G-Sensor chip.
Choosing the LCD tab leads to the window in Figure 1-16. The LCD backlight can be turned on or off
by checking or unchecking the LCD Backlight checkbox from this window. The display on the LCD can
be updated immediately according to the demo pattern form the pull-down list. .
Choosing the Video-In tab leads to the window in Figure 1-17. This demonstration requires connect
PAL/NTSC video signal to the RCA-in port on the VEEK-MT2S. The decoded PAL/NTSC video will
display on the Control Panel in real time.
VEEK-MT2S 11 www.terasic.com
Control Panel May 2, 2017
Figure 1-17 Testing the video-on of TV decoder
Choosing the Audio-In tab leads to the window in Figure 1-18. This demonstration requires connect
speaker to the line-out port on the VEEK-MT2S board. Then, click the tone buttons on the dialog, the
speaker will play an associated tone sound immediately.
From the control panel, we can test the IR receiver on the VEEK-MT2S by sending scan code from a
remote controller. Figure 1-19 depicts the IR receiver window when the IR tab is pressed. When the
scan code is received, the information will be displayed on the IR Receiver window represented in
hexadecimal. The “press button” on the remote controller on the IR receiver window. Note that there are
several encoding forms among different brands of remote controllers. Only the remote controller
included with the kit is confirmed to be compatible with this software.
VEEK-MT2S 12 www.terasic.com
Control Panel May 2, 2017
Figure 1-19 Testing the IR receiver using remote controller
From the control panel, we can test the 8 Mega Pixel Camera on the VEEK-MT2S. Figure 1-20 depicts
the Camera display window with Focus control. The display window will display the captured camera
image in real time. The Focus control can be used to control the Focus Distance in the camera module.
Choosing the MPU9250 tab leads to the window in Figure 1-21. The function is designed to monitor
the status of MPU9250 9-axis sensor in real time. It can be used to verify the functionality of the
MPU9250 sensor chip.
VEEK-MT2S 13 www.terasic.com
Control Panel May 2, 2017
Figure 1-21 Monitoring MPU9250 9-axi sensor measured value
Choosing the Light tab leads to the window in Figure 1-22. The function is designed to monitor the
status of ADC9300 light sensor in real time. It can be used to verify the functionality of the ADC9300
light sensor chip.
VEEK-MT2S 14 www.terasic.com
Control Panel May 2, 2017
Chapter 2
The Control Panel is a GUI-based program and Qt Creator is a convenient tool to help create such
GUI-based programs. Regarding the Linux installation, users might ask if it is possible to install
Cygwin Linux in Microsoft Windows instead of installing Linux x64 on VMware Workstation
Player running on Microsoft Windows. Note that Qt Creator, software meant for GUI-based
programs, can’t be successfully installed on Cygwin in Microsoft Windows.
Running Linux x64 on VMware Workstation Player in Microsoft Windows is an easier way when
users wish to create a GUI application, such as oscilloscopes or logic analyzers, without the need to
have a Desktop Linux. Users can simply follow our GUI application development method explained
in this tutorial for more user-based GUI applications.
Before starting the Linux installation on a virtual machine, please make sure and check if these
following items are in place:
VEEK-MT2S 15 www.terasic.com
Control Panel May 2, 2017
2.2 Install VMware Wor kstation Player
Now, we proceed to install the virtual machine under Microsoft Windows. This section shows (1)
where to download VMware Workstation Player and (2) how to install it under Microsoft Windows.
VEEK-MT2S 16 www.terasic.com
Control Panel May 2, 2017
Figure 2-2 VMware Workstation Player Download Web Page
Install VMware
VEEK-MT2S 17 www.terasic.com
Control Panel May 2, 2017
In the End-User License Agreement dialog as shown in Figure 2-4, check "I accept the terms in
the license agreement" and click "Next >" button to go to the next step.
In the Custom Setup dialog as shown in Figure 2-5, keep the default destination or specify desired
installation folder, then click "Next >" button to go to the next step.
VEEK-MT2S 18 www.terasic.com
Control Panel May 2, 2017
In the User Experience Settings dialog as shown in Figure 2-6, check on the "Check for product
updates on startup" and click "Next" to continue.
In the Shortcuts dialog as shown in Figure 2-7, keep the default setting, then click "Next >" button
to go to the next step
VEEK-MT2S 19 www.terasic.com
Control Panel May 2, 2017
In the Ready to install VMware Workstation 12 Player dialog as shown in Figure 2-8, click
"Next >" button to go to the next step
When the installation is complete, Completed the VMware Workstation 12 Player Setup Wizard
dialog appears as shown in Figure 2-9. Click "Finished" button to finish the setup process.
Figure 2-9 Completed the VMware Workstation 12 Player Setup Wizard Dialog
VEEK-MT2S 20 www.terasic.com
Control Panel May 2, 2017
2.3 Launch VMware
Once VMware Workstation Player is completely installed, a program shortcut icon will appear on
the desktop in Windows, as shown in Figure 2-10. Double-click the shortcut icon to launch the
VMware Workstation Player. Figure 2-11 shows the main window of VMware Workstation Player.
Now we have downloaded and installed the VMware Workstation Player, we are ready to download
Ubuntu image file and install it on the VMware Workstation Player. Note that the "Easy Install"
mode is automatically applied when VMware Workstation Player detects if the installed OS is
Ubuntu 16.04.
VEEK-MT2S 21 www.terasic.com
Control Panel May 2, 2017
Download Ubuntu Linux Image
The Ubuntu Desktop can be downloaded from the web link provided below, as shown in Figure
2-12
http://releases.ubuntu.com/16.04/
On the download page, click "64-bit PC (AMD64) desktop image" link to start the download
process. The downloaded image filename is "ubuntu-16.04.1-desktop-amd64.iso".
VEEK-MT2S 22 www.terasic.com
Control Panel May 2, 2017
Create a Ubuntu Virtual Machine on the VMware Workstation Player
Launch the VMware Workstation Player as shown in Figure 2-13. Click the "Create a New Virtual
Machine" icon to create a virtual machine accordingly.
VEEK-MT2S 23 www.terasic.com
Control Panel May 2, 2017
When the Welcome to the New Virtual Machine Wizard dialog appears as shown in Figure 2-14,
select the "installer disk image file (iso):" radio button, and click "Browse" button to specify the
location of the Ubuntu Linux image file "ubuntu-16.04.1-desktop-amd64.iso" which has been
downloaded in the previous step. Note that the "Easy Install" mode is enabled for Ubuntu 16.04.1.
Click "Next >" to go to the next step.
VEEK-MT2S 24 www.terasic.com
Control Panel May 2, 2017
When the Easy Install Information dialog appears as shown in Figure 2-15, please specify your
username and password. In this tutorial, the user name "terasic" and the password "123" are used.
Click "Next >" button to go to the next step. Please remember your username and password, as
they will be frequently used throughout the tutorial.
VEEK-MT2S 25 www.terasic.com
Control Panel May 2, 2017
When the Name the Virtual Machine dialog appears as shown in Figure 2-16, you can change the
virtual machine name as you wish. In this example, a machine name "Ubuntu 64-bit" is used. Click
the "Browse" button to specify a folder location for the virtual disk of the virtual machine. Finally,
click "Next > " button to go to the next step.
Figure 2-16 Name the Virtual Machine Dialog of the New Virtual Machine Wizard
VEEK-MT2S 26 www.terasic.com
Control Panel May 2, 2017
When the Specify Disk Capacity dialog appears as shown in Figure 2-17, please specify the
maximum disk size and click "Next >" button to go to the next step.
VEEK-MT2S 27 www.terasic.com
Control Panel May 2, 2017
When the Ready to Create Virtual Machine dialog appears as shown in Figure 2-18. Click the
"Customize Hardware …" button to modify memory allocated to the virtual machine.
VEEK-MT2S 28 www.terasic.com
Control Panel May 2, 2017
The Hardware dialog appears as shown in Figure 2-19. Modify memory for this virtual machine to
2048MB or more. Then, click "Close " button to return to the Ready to Create Virtual Machine
dialog.
VEEK-MT2S 29 www.terasic.com
Control Panel May 2, 2017
Finally, the Ready to Create Virtual Machine dialog appears as shown in Figure 2-20. Click the
"Finish" button to start installation progress.
While installing, the Software Updates dialog appears as shown in Figure 2-21. Click the
"Download and Install" button to proceed.
VEEK-MT2S 30 www.terasic.com
Control Panel May 2, 2017
Figure 2-22 shows a screenshot of the installation progress.
VEEK-MT2S 31 www.terasic.com
Control Panel May 2, 2017
When the installation is completed, Ubuntu login dialog appears as shown in Figure 2-23. In the
Password edit box, key in the password specified in the previous step (in this tutorial, password is
"123"), and press "ENTER" on the keyboard.
VEEK-MT2S 32 www.terasic.com
Control Panel May 2, 2017
After successful login, Ubuntu Desktop appears as shown in Figure 2-24.
VEEK-MT2S 33 www.terasic.com
Control Panel May 2, 2017
Shut Down Linux System
Click the Power icon and select the "Shut Down…" as shown in Figure 2-25.
VEEK-MT2S 34 www.terasic.com
Control Panel May 2, 2017
Then, select "Shut Down" as shown in Figure 2-26 to turn off the Linux system.
VEEK-MT2S 35 www.terasic.com
Control Panel May 2, 2017
Restart Ubuntu
To restart Ubuntu after it has been shut down, here is the step-by-step instruction:
VEEK-MT2S 36 www.terasic.com
Control Panel May 2, 2017
2.5 Upgrade Linux x64 Software Package
After Linux x64 has been completely installed, we also need to upgrade the system to make sure the
system is the most up-to-date.
Please follow carefully with the installation procedures in this section. First, press "CTRL+ALT+T"
on keyboard to launch a terminal as show in Figure 2-28.
VEEK-MT2S 37 www.terasic.com
Control Panel May 2, 2017
In the terminal, type the following command and press ENTER.
The system will prompt users to input a password. Please input your password (in this tutorial, the
password is "123") and press ENTER as shown in Figure 2-29.
VEEK-MT2S 38 www.terasic.com
Control Panel May 2, 2017
After finishing typing in "sudo apt update’ and the password, now type in the following command
and press ENTER, as shown in Figure 2-30. The upgrade process will take about 10~15 minutes.
VEEK-MT2S 39 www.terasic.com
Control Panel May 2, 2017
Figure 2-31 shows the screenshot after the upgrade process has been complete. Type "exit" to close
the terminal.
After Linux system has been upgraded, we also need to copy files from Windows host by using
VMware Workstation Player’s Shared Folder features. Note, a software patch is applied to fix
known bugs.
Please follow carefully with the installation procedures in this section. First, press "CTRL+ALT+T"
on keyboard to launch a terminal as show in Figure 2-32.
VEEK-MT2S 40 www.terasic.com
Control Panel May 2, 2017
Figure 2-32 Linux Terminal
In the terminal, execute the following commands to download and install VMware Tools Patches.
$ wget https://codeload.github.com/rasa/vmware-tools-patches/zip/master \
-O vmware-tools-patches.zip
$ unzip vmware-tools-patches.zip
$ cd vmware-tools-patches-master/
$ sudo ./patched-open-vm-tools.sh
VEEK-MT2S 41 www.terasic.com
Control Panel May 2, 2017
Figure 2-33 shows the screenshot of patches download finish after typing in the wget command.
VEEK-MT2S 42 www.terasic.com
Control Panel May 2, 2017
The downloaded file is in the compressed format, so we need to decompress it before we can use it.
Figure 4-2 shows the screenshot after patches download has been finished and has been extracted
by the unzip command. After extraction, the patches is located in the folder
"~/vmware-tools-patches-master"
VEEK-MT2S 43 www.terasic.com
Control Panel May 2, 2017
In order to fix VMware Tools bug, installing patches is required. Figure 2-35 shows the screenshot
of installing the patches. The system will prompt users to input a password. Please input your
password (in this tutorial, the password is "123") and press ENTER.
VEEK-MT2S 44 www.terasic.com
Control Panel May 2, 2017
Shared Folder Setup
In order to modify virtual machine setting. First, shut down Linux system. Launch the VMware
Workstation Player, select the "Ubuntu 64-bit", and click "Edit virtual machine settings", as shown
in Figure 2-36.
VEEK-MT2S 45 www.terasic.com
Control Panel May 2, 2017
When the Virtual Machine Settings dialog appears as shown in Figure 2-37, please select
"Options" tab, click "Shared Folders" icons, check "Always enabled" radio button, and then click
"Add…".
VEEK-MT2S 46 www.terasic.com
Control Panel May 2, 2017
Add Shared Folder Wizard is launched for shared folder settings. A Welcome dialog appears as
shown in Figure 2-38, please click "Next >" to go to the next step.
VEEK-MT2S 47 www.terasic.com
Control Panel May 2, 2017
When the Name the Shared Folder dialog appears as shown in Figure 2-39, click "Browse…" to
select a folder as the shared folder, gives a name to the shared folder(in this tutorial, shared is
used ), and click "Next >" to proceed.
VEEK-MT2S 48 www.terasic.com
Control Panel May 2, 2017
When the Specify Shared Folder Attributes dialog appears as shown in Figure 2-40, check
"Enable this share" checkbox and click "Finish".
VEEK-MT2S 49 www.terasic.com
Control Panel May 2, 2017
When going back to the Virtual Machine Settings dialog as shown in Figure 2-41, check "OK" to
complete the settings. Now the Shared Folder feature is applied.
VEEK-MT2S 50 www.terasic.com
Control Panel May 2, 2017
Chapter 3
Qt Creator Installation
The Control Panel is a GUI-based program and Qt Creator is a convenient tool to help create
GUI-based programs. Users can simply follow our GUI application development explained in this
tutorial to develop needed GUI applications.
Chapter 3 illustrates how to install Qt Creator on the Linux x64 which has been installed in previous
chapters. Also, we will show how to create, compile, and build a hello program running on the
Linux x64. In order for Qt Creator to be able to build a project correctly, we also provide steps of
installing necessary x86_64 GCC toolchain needed for the Qt Creator.
In order for the Qt Creator to be able to build a project correctly, a proper toolchain is required. Use
the following command to install the required toolchain:
VEEK-MT2S 51 www.terasic.com
Control Panel May 2, 2017
Figure 3-1 Install Software Package
VEEK-MT2S 52 www.terasic.com
Control Panel May 2, 2017
Figure 3-2 shows the screenshot after the installation has been completed. Type "exit" to close the
terminal.
VEEK-MT2S 53 www.terasic.com
Control Panel May 2, 2017
3.2 Download and Install Qt Installer
Download Qt Installer
As shown in Figure 3-3, click the Firefox web browser to open the web page
http://download.qt.io/archive/qt/5.7/5.7.0/
Then click "qt-opensource-linux-x64-5.7.0.run" to download the Qt installer.
VEEK-MT2S 54 www.terasic.com
Control Panel May 2, 2017
When an Opening dialog appears as shown in Figure 3-4, click "Save File".
VEEK-MT2S 55 www.terasic.com
Control Panel May 2, 2017
Figure 3-5 shows the download progress.
VEEK-MT2S 56 www.terasic.com
Control Panel May 2, 2017
The file is saved as "qt-opensource-linux-x64-5.7.0.run", and saved under the folder
"~/Download". When download is completed, click the Close icon, located on the top-left corner as
shown in Figure 3-6, to close the Firefox web browser.
VEEK-MT2S 57 www.terasic.com
Control Panel May 2, 2017
Install Qt
Type in the following commands to locate and launch the Qt Installer, as shown in Figure 3-7.
$ cd ~/Downloads/
$ ls
$ chmod a+x qt-opensource-linux-x64-5.7.0.run
$ ./qt-opensource-linux-x64-5.7.0.run
The 2nd command line ls is used to check whether the qt-opensource-linux-x64-5.7.0.run existed or
not while the 3rd command line chmod a+x is used to add "execution" attribute to the file such that
it can be executed.
VEEK-MT2S 58 www.terasic.com
Control Panel May 2, 2017
Figure 3-8 shows the Welcome dialog of the Qt Installer.
VEEK-MT2S 59 www.terasic.com
Control Panel May 2, 2017
In the Qt Account – Your unified login to everything Qt dialog, click "Skip" to skip Qt account
log in and go to the next step, as shown in Figure 3-9.
VEEK-MT2S 60 www.terasic.com
Control Panel May 2, 2017
In the Setup – Qt 5.7.0 dialog, click "Next >" to go to the next step, as shown in Figure 3-10.
VEEK-MT2S 61 www.terasic.com
Control Panel May 2, 2017
In the Installation Folder dialog, please specify the folder where you wish to install Qt 5.7.0 and
click "Next >" to go to the next step, as shown in Figure 3-11.
VEEK-MT2S 62 www.terasic.com
Control Panel May 2, 2017
In the Select Components dialog, keep default settings and click "Next >" to go to the next step, as
shown in Figure 3-12
VEEK-MT2S 63 www.terasic.com
Control Panel May 2, 2017
In the License Agreement dialog, select a license and select the "I have read and agree ..." radio
button. Click "Next >" to go to the next step, as shown in Figure 3-13
VEEK-MT2S 64 www.terasic.com
Control Panel May 2, 2017
In the Ready to Install dialog, as shown in Figure 3-14, click "Install" to go to the next step.
VEEK-MT2S 65 www.terasic.com
Control Panel May 2, 2017
In the Completing the Qt 5.7.0 Wizard dialog, as shown in Figure 3-15, unselect "Launch Qt
Creator" and click "Finish" to close the window.
VEEK-MT2S 66 www.terasic.com
Control Panel May 2, 2017
3.3 Launch Qt Creator and Check Configure
This section describes how to launch Qt Creator in Linux and where to check its Build & Run
configuration settings.
Launch Qt Creator
VEEK-MT2S 67 www.terasic.com
Control Panel May 2, 2017
Check Build & Run Configuration Settings
When Qt Creator is launched, browse the menu and click "ToolsOptions..." as shown in Figure
3-17, to open the Option dialog.
VEEK-MT2S 68 www.terasic.com
Control Panel May 2, 2017
In the Options dialog, first click "Build & Run" on the left and select the "Compilers" tab on the
right to check if the "GCC" is detected as shown in Figure 3-18.
VEEK-MT2S 69 www.terasic.com
Control Panel May 2, 2017
Next, select "Qt Versions" tab (to the left of the "Compilers" tab) to check if the "Qt 5.7.0 GCC
64bit" is detected as shown in Figure 3-19.
VEEK-MT2S 70 www.terasic.com
Control Panel May 2, 2017
Similarly, select "Kits" tab to check if the "Desktop Qt 5.7.0 GCC 64bit" is detected as shown in
Figure 3-20.
VEEK-MT2S 71 www.terasic.com
Control Panel May 2, 2017
Finally, click "OK" to close the dialog as shown in Figure 3-21.
VEEK-MT2S 72 www.terasic.com
Control Panel May 2, 2017
3.4 Hello Program
Now we are ready to create, build, and run our first program "Hello" in Qt Creator. Please follow
carefully with the following instructions.
After launching the Qt Creator, browse the menu and select item "FileNew File or Project…" as
shown in Figure 3-22 to open a new dialog.
VEEK-MT2S 73 www.terasic.com
Control Panel May 2, 2017
In the New dialog, select "Applications" under Projects, and choose "Qt Widgets Application" as
shown in Figure 3-23. Click "Choose…" to go to the next step.
VEEK-MT2S 74 www.terasic.com
Control Panel May 2, 2017
In the Qt Widgets Application Dialog, specify the project name and project location, then click
"Next >" as shown in Figure 3-24.
VEEK-MT2S 75 www.terasic.com
Control Panel May 2, 2017
In the Kit Selection dialog, keep default settings and click "Next >" to go to next step as shown in
Figure 3-25.
VEEK-MT2S 76 www.terasic.com
Control Panel May 2, 2017
In the Class Information dialog, click "Next >" as shown in Figure 3-26 to proceed.
VEEK-MT2S 77 www.terasic.com
Control Panel May 2, 2017
In the Project Management dialog, click "Finish" as shown in Figure 3-27 to proceed.
VEEK-MT2S 78 www.terasic.com
Control Panel May 2, 2017
Figure 3-28 shows the hello project now has been created and the mainwindow.cpp and main.cpp
files are included in the Sources folder under the hello project.
VEEK-MT2S 79 www.terasic.com
Control Panel May 2, 2017
Build & Run
Click on the "Run" icon to build and run the Hello program. The GUI program should appear as
shown in Figure 3-29.
VEEK-MT2S 80 www.terasic.com
Control Panel May 2, 2017
Chapter 4
Download the Linaro ARM cross compiler toolchain and extract the file
Include Toolchain path into the system environment variable $PATH
Launch Linux terminal on the Linux x64 (CTRL+ALT+T) and execute the following commands to
download and extract the Linaro ARM cross compiler toolchain,
$ cd ~
$ wget -c https://releases.linaro.org/components/toolchain/binaries/\
5.2-2015.11-2/arm-linux-gnueabihf/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
$ tar xvf gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
Figure 4-1 shows the screenshot of toolchain download progress after typing in the wget command.
It will take about 10 minutes to download the file.
VEEK-MT2S 81 www.terasic.com
Control Panel May 2, 2017
Figure 4-1 Linaro ARM cross compiler toolchain Download Progress
The downloaded file is in the compressed format, so we need to decompress it before we can use it.
Figure 4-2 shows the screenshot after toolchain download has been finished and has been extracted
by the tar command. After extraction, the toolchain is located in the folder "~/
gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf"
VEEK-MT2S 82 www.terasic.com
Control Panel May 2, 2017
Figure 4-2 Toolchain Download Finished and Extracted by the Tar Command
Now, the toolchain path needs to be defined and added into the system variable $PATH. We use the
system editor tool gedit to add the path. Please refer to the following for more details to set up the
toolchain path.
Launch terminal (CTRL+ALT+T) and type in the following command to edit the personal
initialization file "~/.bashrc"
$gedit ~/.bashrc
Figure 4-3 shows the screenshot that the "~/.proifle" opened by gedit. Please add the following line,
export PATH=~/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin:$PATH
to the end of the initialization file. Click "save" icon to save the file followed by clicking "close"
icon (red circle with a x on the upper left corner) to terminate gedit tool.
VEEK-MT2S 83 www.terasic.com
Control Panel May 2, 2017
Figure 4-3 .bashrc Opened by gedit
In order for the path setting to take effect immediately, please type in "source ~/.bashrc" in the
terminal or restart the OS.
VEEK-MT2S 84 www.terasic.com
Control Panel May 2, 2017
Chapter 5
Copy the prebuilt Qt library compressed file from the System CD to the shared folder, which is
specified as in Figure 2-39, on Windows host. on Windows host. Then, launch the "Ubuntu 64-bit"
virtual machine. After logging in Linux x64, launch a terminal (CTRL+ALT+T) and type the
following command to go to the shared folder on Linux x64:
$cd /mnt/hgfs/shared
Now type in
$ ls
VEEK-MT2S 85 www.terasic.com
Control Panel May 2, 2017
Figure 5-1 ‘qt5.5.1_for_intel_soc.tar.gz’ File of Prebuilt Qt Library
After copy prebuilt Qt library to the shared folder, we need to install prebuilt Qt library to system
path.
The system will prompt users to input a password. Please input your password (in this tutorial, the
password is "123") and press ENTER as shown in Figure 5-2.
VEEK-MT2S 86 www.terasic.com
Control Panel May 2, 2017
Figure 5-2 Decompress Prebuilt Qt Library
VEEK-MT2S 87 www.terasic.com
Control Panel May 2, 2017
Chapter 6
Compiler Setup
First launch the Qt Creator, and select the menu item "ToolsOptions…" as shown in Figure 6-1
to open the Option dialog.
VEEK-MT2S 88 www.terasic.com
Control Panel May 2, 2017
Figure 6-1 Open Option Dialog
To add the "GCC" compiler, in the Option dialog, select "Build & Run" item on the left and then
select "Compilers" tab. Now you can select "GCC" item from the "Add" pull down menu as shown
in Figure 6-2.
VEEK-MT2S 89 www.terasic.com
Control Panel May 2, 2017
Next, you need to specify the GCC compiler details. First, please type in "GCC (Intel SoC)" in the
Name option box and click "Browse…" to select the location of the compiler of Intel SoC ARM.
The compiler is located at "/home/terasic/
gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++". Note that in
the path string, you should replace "terasic" with your linux user name. Then click "Apply" to finish
the Compiler setup as shown in Figure 6-3.
Qt Verisons Setup
To add Qt Versions, first click on the "Qt Versions" tab and click "Add" as shown in Figure 6-4.
When an Open File dialog appears to ask the location of qmake executable, please specify the
location as: "/opt/qt5/qt5.5.1/bin/qmake".
VEEK-MT2S 90 www.terasic.com
Control Panel May 2, 2017
Figure 6-4 Add Qt Version
Finally, click "Apply" to complete the Qt Versions setup as shown in Figure 6-5.
VEEK-MT2S 91 www.terasic.com
Control Panel May 2, 2017
Kits Setup
To add Kits, first click on the "Kits" tab and click on "Add" as shown in Figure 6-6. Specify the kit
detail as below:
Name: Intel SoC FPGA Kit
Device Type: Select "Generic Linux Device"
Compiler: Select "GCC (Intel SoC)"
Qt Version: Select "Qt 5.5.1 (qt5.5.1)"
Then, click "Apply" to finish Kits setup and click "OK" to finish Options setup.
VEEK-MT2S 92 www.terasic.com
Control Panel May 2, 2017
6.2 Cross-Compile the Hello Project
Now, after properly setting up "Build & Run" settings, we are ready to cross-compile the Hello
project. First, please launch the Qt Creator, and select the menu item "FileRecent Projects" to
open the hello project as shown in Figure 6-7.
VEEK-MT2S 93 www.terasic.com
Control Panel May 2, 2017
To add "Intel SoC FPGA Kit" into the Hello project, click on the "Projects" icon and select "Intell
SoC FPGA Kit" from the "Add Kit" pull-down menu, as shown in Figure 6-8.
Figure 6-8 Add Intel SoC FPGA Kit into the Hello Project
VEEK-MT2S 94 www.terasic.com
Control Panel May 2, 2017
To select Release type, click on "Release" icon and select "Intel SoC FPGA Kit" item under the Kit
list menu and "Release" in Build list menu, as shown in Figure 6-9.
VEEK-MT2S 95 www.terasic.com
Control Panel May 2, 2017
To compile the hello project, click on "Compile Output" item on the bottom toolbar of the Qt
Creator and select the menu item "BuildRebuild All" as shown in Figure 6-10. While compiling,
the system message will be simulaneously displayed on the "Compile Output" Windows.
VEEK-MT2S 96 www.terasic.com
Control Panel May 2, 2017
When the build process has been completed, the output execution file can be found under the folder
"/home/terasic/my_hello/build-hello-Intel_SoC_FPGA_Kit-Release/hello". Note that in the path
string, you should replace "terasic" with your linux user name as shown in Figure 6-11.
To execute the Hello program on the VEEK-MT2S FPGA board, we need to copy the hello
execution file to the Intel SoC FPGA Board which runs on Linux. In this demonstration, we use
Linux "scp" command to remote copy these files from host PC to the VEEK-MT2S FPGA
development board.
First, use a RJ45 cable to connect the Intel SoC FPGA development board to an Ethernet network
with a DHCP server, like Figure 6-12.
VEEK-MT2S 97 www.terasic.com
Control Panel May 2, 2017
Figure 6-12 Connect Intel SoC FPGA Board To the Ethernet Network
Then, use the microSD card which Linux LXDE Desktop image is written to, described in chapter 1,
to boot the Intel SoC FPGA development board. After booting LXDE Desktop, launch a terminal on
the LXDE Desktop (CTRL+ALT+T) and type in "dhclient -v eth0" command to request an Ethernet
IP Address from the DHCP server as shown in Figure 6-13.
To get a IP address from the DHCP server, type Linux "ifconfig" command to find the assigned IP
address, as shown in Figure 6-14. In this case, the assigned IP address is "192.168.1.191".
VEEK-MT2S 98 www.terasic.com
Control Panel May 2, 2017
Figure 6-14 Use Linux ifconfig Command to Check Assigned Ethernet IP Address
Now, back to the host PC part. Please make sure the host PC is connected to the Ethernet which
VEEK-MT2S FPGA development board also is connected to. Launch a terminal on the Linux x64,
and type in:
$ cd /home/terasic/my_hello/build-hello-Intel_SoC_FPGA_Kit-Release
to go to the directory where the hello execution file is located, as shown in Figure 6-15. Note, in the
path string, you should replace "terasic" with your linux user name.
Then, type:
$ scp hello [email protected]:/home/root
To remote copy the hello program to the /home/root directory of the file system of VEEK-MT2S
FPGA development board, as shown in Figure 6-16. Note that the IP address 192.168.1.191 should
be changed to the actual IP address assigned.
During the first time of the connection, system will ask "Are you sure you want to continue
connecting (yes/no)?". Please type in "yes" and press ENTER. After confirming, the system will ask
you to input password for the remote machine, please type "terasic" (the default setting with the
microSD image) and press ENTER.
VEEK-MT2S 99 www.terasic.com
Control Panel May 2, 2017
Figure 6-16 Remote Copy the Hello Program
Please double click "hello" icon and click "Execute" button to launch the Control Panel as shown in
Figure 6-17.
Quartus Prime 16.1 or later which supports Cyclone V Device on Windows is required in the
Control Panel Quartus Project can be downloaded from
https://www.altera.com/downloads/download-center.html or as shown in Figure 7-1.
When Intel SoC FPGA boots from the microSD Card, it also reads soc_system.rbf in the microSD
Card to configure the FPGA. Therefore, we now show how to translate the .sof to .rbf.
Generate soc_system.rbf
First, we need to translate the .sof to .rbf with the following command
$ quartus_cpf -c -o bitstream_compression=on \
DE10_Stabdard_FB.sof soc_system.rbf
Next, we need copy the soc_system.rbf to the microSD Card with the following procedures:
1. Insert the microSD Card in the Windows Host
2. Delete soc_system.rbf in the microSD Card if there is one
3. Copy your soc_system.rbf into the microSD Card
Test
Finally, boot the VEEK-MT2S FPGA development board with the updated microSD Card. When
the Linux boot process is complete, Double click "ControlPanel" icon and click "Execute" button to
test if everything works well.
The Control Panel circuit is built by Qsys. The HPS Linux program accesses Avalon Memory
Mapped Bus through the HPS component. Also, the FPGA controller can use HPS resource, like
DDR3 SDRAM, through the HPS component. The HPS configuration is board-peripheral-
dependent, so users don’t need to modify the HPS setting if the board has not been changed. The
top Qsys is implement in soc_system.qsys. The TV decoder sub system is implement in the
tv_decoder.qsys.
The HPS Linux program accesses Avalon Memory Mapped Slave port through HPS AXI Master
port as shown Figure 7-3. If you wish that Linux program can access a Qsys instance, just connect
its Avalon Memory Mapped Slave port of the controller to HPS AXI Master port.
Linux program access specific Avalon Memory Mapped Slave port based on its port address, so
please make sure the port address are not overlapped with each other. We strongly recommend that
the developer properly defines the port addresses and lock port addresses in Qsys.
In this tutorial, the slave port of LED, Button, Switch, IR, 7-segment, audio, VIP frame reader, VIP
clocked video input, VIP Mixer II and tv_decoder are connected to the to the mm_bridge_0 HPS
h2f_lw_axi_master AXI Master port. Use Qsys "Address Map" tab can view the connection
summary and associated address, as shown in Figure 7-4.
The TV decoder is implemented in tv_decoder.qsys as shown in Figure 7-5 tv_decoder sub Qsys.
The SRAM acts as video buffer for the VIP frame buffer.
VIP Frame Reader is used to implement the Frame Buffer Display of Linux. The Frame Reader uses
HPS’s DDR3 SDRAM as frame buffer, so we need to connect the Avalon Memory Mapped
Master port of Frame Reader instance to the AXI Slave port of HPS instance, as shown in Figure
7-6.
Figure 7-7 shows Frame Reader instance setting. The display resolution is set as 1024x768.
Control Panel Qt project uses Intel SoC FPGA hwlib library source code which is included in the
Intel SoC EDS (Embedded Development Suite). Therefore make sure to install Intel SoC EDS
before compiling the Qt Project.
When the installer is launched, a Welcome dialog appears as shown in Figure 8-4. Click "Next >"
to go to the next step.
When the License Agreement dialog appears as shown in Figure 8-5, please select the "I accept
the agreement" radio button if you agree with the license and click "Next >" to go to the next step.
Copy the prebuilt Qt library compressed file from the System CD to the shared folder on Windows
host. Then, launch the "Ubuntu 64-bit" virtual machine. After logging in Linux x64, launch a
terminal (CTRL+ALT+T) and type the following command to go to the shared folder on Linux:
Copy the Control Panel Qt project folder "ControlPanel_QT" from the System CD to the shared
folder on Windows host. Then, launch a terminal (CTRL+ALT+T) and type the following command
to go to the shared folder on Linux:
$ cd /mnt/hgfs/shared
to go to the shared directory on Linux.
Now type in
$ ls
To see the "ControlPanel_QT" directory of Control Panel Qt Project, as shown in Figure 8-11.
Now, we can launch the Qt Creator, and select the menu item "FilesOpen File or Project…" as
shown in Figure 8-12.
If Configure Project appears as shown in Figure 8-15, please check "Intel SoC FPGA Kit" and click
"Configure Project".
Click on the "Release" icon, and select "Intel Soc FPGA Kit" and "Release" Build as shown in
Figure 8-18.
Then, select menu item "BuildRebuild All", as shown in Figure 8-19, to build the Control Panel
Project.
To run the "ControlPanel" execution file on the VEEK-MT2S FPGA development board, we need
to copy it to the Linux on Intel SoC FPGA Board. This is similar to what we have done in Section
6.3 "Execute Hello Program" where we use Linux "scp" command to remote copy.
After "ControlPanel" execution file has been remotely copied to the "/home/root" directory of Linux
running on Intel SoC FPGA Board, double click "ControlPanel" icon and click "Execute" button to
launch the Control Panel in the LXDE Desktop of Intel SoC FPGA board. If you can see the
ControlPanel windows as shown in Figure 8-21, it means you had successfully built the Control
Panel Qt Project.
Control Panel controls the FPGA Qsys components through the memory-mapped method. The
device driver "/dev/mem" is used to access the physical address space which is mapped to Qsys
address space.
Below shows how to turn on the 10 LEDs, which is controlled by Qsys PIO Controller, whose
address is 0x10040 in the Qsys system. Based on "/dev/mem" device driver and "mmap" function,
we can calculate the LED address led_base. With the address, we can directly write the value of the
address to control the PIO Controller. Constant ALT_LWFPGASLVS_OFST is defined
"socal/hsp.h"
#include "socal/hps.h"
The way to control HPS LEDs is similar to the way to control FPGA LED. The register files of both
PIO controllers are different. Macro alt_setbits_word is used to set value to the specific address.
The HPS LED is controlled by GPIO1 GPIO Controller.
#include "socal/socal.h"
#include "socal/hps.h"
FPGA Class
All of FPGA control functions are encapsulated in the FPGA class and it is implemented in fpga.c
and fpga.h. Below shows the public functions of this class.
HPS Class
Except for LCD, all of HPS control functions are encapsulated in the HPS class and it is
implemented in hps.cpp and hps.h. Below shows the public functions of this class:
LCD_GRAPHIC Class
The LCD_GRAPHIC class is designed to provide graphic function for the LCD. It provides line,
rectangle, and circle geometric drawing function, as well as font drawing function. It is
implemented in lcd_graphic.cpp and hps.h. These two files are located in the hps_lcd folder. The
code below shows the public functions of this class. The drawing result will not be displayed on the
LCD until Refresh function is called. Below shows the public functions of this class:
The LCD_GRAPHIC class is derived from the LCD_WCG12864 class. The LCD_WCG12864
class is derived from the TERASIC_SPI class. The TERASIC_SPI class uses Altera hwlib to
control the Master SPI controller in HPS(Hard Process System) directly. The font bitmap data is
stored in the font.cpp.
MPU9250 Class
The MPU9250 class is designed to configure the MPU9250 9-axis sensor and read the measured
values through the SPI interface. The class is implement in the MPU9250.cpp and MPU9250.h.
Developers can call the initialize function to initialize the MPU9250 chip, then call getMotion9 or
to getMotion6 to read the measured values. Below shows the public functions of this class:
void calib_acc();
void calib_mag();
void read_temp();
void read_acc();
void read_gyro();
void read_mag();
void read_all();
The MPU9250 class uses the SPIdev class to handle the low level data transmission with the
MPU9250 chip. The SPIdev class is implemented in the SPIdev.h file.
ADC9300 Class
The AD9300 class is designed to configure the ADC9300 light sensor and read the measured values
through the I2C interface. The class is implemented in the ADC9300.cpp and ADC9300.h.
Developers can call the Set_PowerSwitch function to power on the MPU9250 chip, then call
Get_ADCData0 and Get_DCData1 to read the measured values. Below shows the public
functions of this class:
bool IsReady(void);
bool Get_ADCData0(uint16_t *pData16
bool Get_ADCData1(uint16_t *pData16
The ADC9300 class use the I2C driver to handle the low level data transmission with the ADC9300
chip. In the VEEK-MT2 LXDE BSP, the ADC9300 I2C device is mapped to the file named
"/dev/i2c-5".
HPS_AUDIO Class
The HPS_AUDIO class is designed to provide audio output function. The function is implemented
in the hps_audio.cpp and hps_audio.h. The ALSA Audio API is used to perform audio relative
function. Below shows the public functions of this class: