Getting started with the Papilio Pro and Xilinx ISE on Linux

Papilio Pro with LEDs and OV2640 camera module
Overview
My Papilio Pro arrived some days (weeks...) ago, let’s get started^^
First have a look at the Papilio Quick Start Guide: http://papilio.cc/index.php?n=Papilio.GettingStarted
Check that the Hardware is OK
If I get new hardware the first thing I always do is to check if its working properly. Sometimes you have to flash a basic Hello World example yourself but the Papilio Pro should have been flashed with a bitstream file already that:
- Toggles all of the even numbered pins
- Configures all of the odd number pins as inputs. When a odd number pin is asserted it will cause the even pin next to it to stop blinking and stay at 3.3V.
- Sends the ASCII table at 9600 8N1 over the serial port in a continuous loop.
Lets check that, connect the Papilio via USB to your PC and use screen to open the serial port:
[chris@thinkpad ~]$ sudo screen /dev/ttyUSB1 9600
ASCII Table ~ Character Map
!, dec: 33, hex: 21, oct: 41, bin: 100001
", dec: 34, hex: 22, oct: 42, bin: 100010
#, dec: 35, hex: 23, oct: 43, bin: 100011
$, dec: 36, hex: 24, oct: 44, bin: 100100
%, dec: 37, hex: 25, oct: 45, bin: 100101
&, dec: 38, hex: 26, oct: 46, bin: 100110
', dec: 39, hex: 27, oct: 47, bin: 100111
(, dec: 40, hex: 28, oct: 50, bin: 101000
), dec: 41, hex: 29, oct: 51, bin: 101001
*, dec: 42, hex: 2A, oct: 52, bin: 101010
+, dec: 43, hex: 2B, oct: 53, bin: 101011
,, dec: 44, hex: 2C, oct: 54, bin: 101100
-, dec: 45, hex: 2D, oct: 55, bin: 101101
., dec: 46, hex: 2E, oct: 56, bin: 101110
/, dec: 47, hex: 2F, oct: 57, bin: 101111
0, dec: 48, hex: 30, oct: 60, bin: 110000
1, dec: 49, hex: 31, oct: 61, bin: 110001
2, dec: 50, hex: 32, oct: 62, bin: 110010
3, dec: 51, hex: 33, oct: 63, bin: 110011
4, dec: 52, hex: 34, oct: 64, bin: 110100
5, dec: 53, hex: 35, oct: 65, bin: 110101
6, dec: 54, hex: 36, oct: 66, bin: 110110
7, dec: 55, hex: 37, oct: 67, bin: 110111
8, dec: 56, hex: 38, oct: 70, bin: 111000
9, dec: 57, hex: 39, oct: 71, bin: 111001
:, dec: 58, hex: 3A, oct: 72, bin: 111010
;, dec: 59, hex: 3B, oct: 73, bin: 111011
<, dec: 60, hex: 3C, oct: 74, bin: 111100
=, dec: 61, hex: 3D, oct: 75, bin: 111101
>, dec: 62, hex: 3E, oct: 76, bin: 111110
?, dec: 63, hex: 3F, oct: 77, bin: 111111
@, dec: 64, hex: 40, oct: 100, bin: 1000000
A, dec: 65, hex: 41, oct: 101, bin: 1000001
B, dec: 66, hex: 42, oct: 102, bin: 1000010
C, dec: 67, hex: 43, oct: 103, bin: 1000011
Really kill this window [y/n]
[screen is terminating]
[chris@thinkpad ~]$
So this looks good, now the pins, you can easily check this if you connect an LED with a series resistor to 5V and PIN14 like seen in the tittle image. Then the LED should blink. Yippee!
Install the Papilio Loader and Drivers for Linux
Download the Papilio Loader and Drivers http://forum.gadgetfactory.net/index.php?/files/file/10-papilio-loader-gui/ and select Download (Linux Recommended) V2.6.tar.gz.
You will get a file Papilio-Loader-2.6.tar.gz. Extract it, ensure that libftdi-dev and the Java SDK are installed and run the installer:
[chris@thinkpad Papilio]$ tar -xf Papilio-Loader-2.6.tar.gz
[chris@thinkpad Papilio]$ sudo yum install libftdi.i686 libftdi-devel.i686 java-1.7.0-openjdk
[chris@thinkpad Papilio]$ cd Papilio-Loader-2.6/
[chris@thinkpad Papilio-Loader-2.6]$ ./linux-installer.sh
Be sure there is a Java installed. For ubuntu do a sudo apt-get install default-jdk
Be sure libftdi is installed. For ubuntu do a sudo apt-get install libftdi-dev
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[chris@thinkpad Papilio-Loader-2.6]$
Ubuntu
root@dockapp:/# dpkg --add-architecture i386
root@dockapp:/# apt-get update
root@dockapp:/# apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
root@dockapp:/# apt-get install libftdi-dev:i386 default-jdk
Note
It looks like everything can be build from source except data2mem, see here for a statement from the developer: http://forum.gadgetfactory.net/index.php?/topic/1569-wheres-the-sourcecode-for-the-papilio-arduino-15-plugin/
Now download the example bitstream file and try to flash it to the Papilio:
[chris@thinkpad Papilio]$ wget http://papilio.cc/sketches/Quickstart-Papilio_Pro_LX9-v1.5.bit
[chris@thinkpad Papilio]$ papilio-loader-gui
The first time I got an error because there were some missing 32-bit libraries (libftdi.i686 libftdi-devel.i686 libusb.i686 libusbx.i686):
/opt/GadgetFactory/papilio-loader/programmer/linux32/papilio-prog: error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory
If everything is working as expected the board should start printing the ASCII table on the serial port again.
Using Xilinx ISE WebPack IDE with the Papilio
I’m following http://papilio.cc/index.php?n=Papilio.GettingStartedISE.
I’ve already installed Xilinx ISE WebPACK inside a Docker Container, so I will skip this here.
Import the Example Code
Click on “Webpack_Quickstart.vhd” and replace the file contents with the code from below:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Webpack_Quickstart is
Port ( A : out STD_LOGIC_VECTOR (15 downto 0);
B : out STD_LOGIC_VECTOR (15 downto 0);
C : out STD_LOGIC_VECTOR (15 downto 0);
clk : in STD_LOGIC);
end Webpack_Quickstart;
architecture Behavioral of Webpack_Quickstart is
signal counter : STD_LOGIC_VECTOR(47 downto 0) := (others => '0');
begin
--Counter to drive blinking pins
count: process(clk)
begin
if rising_edge(clk) then
counter <= counter+1;
end if;
end process;
--Pins are connected to the counter
--to cause blinking at varying frequencies
A <= counter(35 downto 20);
B <= counter(31 downto 16);
C <= counter(15 downto 0);
end Behavioral;
https://github.com/GadgetFactory/VHDL_Example_Code/tree/master/WebPack_QuickStart
Synthesize the Design
First we need to modify the “Process Properties” a little bit. The generic UCF file that we are using has more pins defined then necessary for this project, by default the syntheses tool will generate an error when this happens. That’s why we have to change the settings so that those pins are ignored.
Put a check mark in “Allow Unmatched LOC Constraints”:
Warning
Be careful with this setting, it can mask problems such as a typo in your ucf file. The safest practice is to comment out unused lines from your ucf file. –http://papilio.cc/index.php?n=Papilio.GettingStartedISE
Comment out all line that have a PULLUP defined inside the UCF file:
Double click “Generate Programming File”:
And if you see Process "Synthesize - XST" failed, then you have done something wrong^^
Started : "Synthesize - XST".
Running xst...
Command Line: xst -intstyle ise -ifn "/share/home/app/VHDL/Webpack_Quickstart/Webpack_Quickstart.xst" -ofn "/share/home/app/VHDL/Webpack_Quickstart/Webpack_Quickstart.syr"
Reading design: Webpack_Quickstart.prj
=========================================================================
* HDL Parsing *
=========================================================================
ERROR:Xst:2927 - "/share/home/app/VHDL/Webpack_Quickstart/Webpack_Quickstart.prj" line 1: Source file ../../../../share/home/app/VHDL/Webpack_Quickstart/Webpack_Quickstart.vhd does not exist
-->
Total memory usage is 306180 kilobytes
Number of errors : 1 ( 0 filtered)
Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)
Process "Synthesize - XST" failed
OK, after trying differnt things I’ve found the error, don’t use a path with symlinks...
Load the Bitstream to the FPGA
Now we have to use the papilio-loader-gui and select the Webpack_Quickstart.bit file from the project directory.
Verify the Design
Now verify that the design works as expected. First I thought something was wrong, because the LED was constantly on...
But the LEDs are blinking at quite different frequencies, so just connect the LEDs to different pins and see what’s happening ;)
So now comes the hard work, to get further with my camera project...