2 Synthesis‎ > ‎Comptronics‎ > ‎


Last Updated 25/10/14

Start Using Papilio Pro with CAE Linux

Certainly not as easy to get started as the Arduino was. in fact frankly its a nightmare and I have to say I doubted my purchase and wondered whether there might be better development kits for Field Programmable Gate Arrays on the market.

What Papilio may have over the others is a lot of software available to simulate retro games that might have run on the ZX spectrum and other micros of that time.

Checking It Works

Most Papilios are shipped with basic software that puts out ASCII characters on the USB. Plug in the Papilio with a USB. Now lets look at the ASCII using a simple comms terminal program like screen. To look at this incoming dataType;

    sudo screen /dev/ttyUSB1 9600

IF screen is not currently installed THEN install screen with;

    sudo apt-get install screen

     followed by repeating;

    sudo screen /dev/ttyUSB1 9600

It provides a terminal to communicate with the papilio and you should see coming in on the serial port;

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

etc etc.

Loading A Bit File

I created a directory called MyPapilio to put all my Papilio files into.

The Bit Files for Papilio are poorly named. They are actually configuration files that tell the Field Programmable Gate Array how to connect its logic gates when it boots up.

I got fed up trying to use Gadget Factory's Papilio Quick Start Guide for a number of reasons not least of which was I have an Papilio Pro LX9 and found myself Using the "Quick Links" on this page to get to the "Download Papilio Pro LX9 QuickStart bit file". Wow a total page of gobbledegook!!! Oh Dear!

OK carry on down the page on Papilio Quick Start Guide to the heading "Install Papilio Loader and Drivers in Linux". After the picture it says "Download the latest version of the Papilio Loader Linux Installer".

Following that link I found myself being asked to login to Gadget Factory and before I could do that I had to set up an account, which took 5 mins. From there it wasn't too hard to get to download "Papilio-Loader-2.6.tar.gz" which which took another 5 mins it being 8.1Mb.

Bare in mind you may have a later version than 2.6 so your version number may be different throughout this tutorial.

I extracted the content of "Papilio-Loader-2.6.tar.gz" by double clicking on the tar directory and then dragging the contained folder "Papilio-Loader-2.6" into my MyPapilio directory I created earlier.

Now you ensure that libftdi-dev and the Java SDK is installed, type;

    sudo apt-get install libftdi-dev default-jdk

This took about 10 mins to install.

I started up a terminal used cd to make "Papilio-Loader-2.6" my current directory and typed;

sudo ./linux-installer.sh

It all seemed to work the /opt/GadgetFactory/papilio-loader directory appeared and the command;


in it. Now try to run it;

sudo /opt/GadgetFactory/papilio-loader/papilio-loader.sh

The window opened! It says "Auto-detect onboard FPGA device". Click "Run".

IF gave back this error in the "Information" box;

"/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"


Now close the window.

Now close the window. Type;

    sudo apt-get install libftdi1:i386

This takes about 3 mins. Try again;
sudo /opt/GadgetFactory/papilio-loader/papilio-loader.sh

IF gave back this error in the "Information" box;

"/opt/GadgetFactory/papilio-loader/programmer/linux32/papilio-prog: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory"


Now close the window. Type;

    sudo apt-get install lib32stdc++6

This takes about 3 mins. Try again;
sudo /opt/GadgetFactory/papilio-loader/papilio-loader.sh

Actually worked or at least the window opened! It says "Auto-detect onboard FPGA device". Clicking "Run" gave back an error in the "Information" box;

IF you get some other error try Googling it as I did to get the above answers and if your nice email me tomdehavas@gmail.com with the solution in the above format.  

Clicking "Run" should give back in the "Information" box;

Using devlist.txt
JTAG chainpos: 0 Device IDCODE = 0x24001093    Desc: XC6SLX9

That Worked! Close it with the cross.

Now we just need a bit file to load into the Papilio. There are some here;


I downloaded one to the current directory cd to MyPapilio directory by cd ing to make MyPapilio the current directory and then typing;

    wget http://papilio.cc/sketches/Quickstart-Papilio_Pro_LX9-v1.5.bit

 It takes a minute to download into the MyPapilio directory. Restart the Papilio Loader;

    sudo /opt/GadgetFactory/papilio-loader/papilio-loader.sh

Use the "Select..." button on the second field to select the bit file you just downloaded and then click on the "Run" button. It takes a little while and finally says "DONE =0". I assume this means the file is in.

Use the instructions above under "Checking it Works" to make sure it is working i.e. just type;

    sudo screen /dev/ttyUSB1 9600

in a terminal window and you should see the returned ASCII again.

Starting with VHDL 

I created a directory called MyXilinx to put all my Xilinx files into. Given that the software I am about to work with could be applicable to more than just the Papilio board.

First register with Xilinx. That takes a while!

Then download  "Full Installer for Linux (TAR/GZIP - 6.09 GB)"  from;


It takes ages so leave it overnight if necessary. You should have downloaded;


or some other version so be careful because all the names below include 14.7 and you will need to change them to your version number.

Bare in mind you may have a later version than 14.7 so your version number may be different throughout this tutorial.

Open the downloaded tar directory with the Archive Manager and drag out the directory;


to the MyXilinx directory.

Inside Xilinx_ISE_DS_Lin_14.7_1015_1 you will see xsetup but this needs to be run in supervisor mode so open a terminal and type;

I started up a terminal used cd to make "Xilinx" my current directory and typed;

    sudo ./Xilinx_ISE_DS_Lin_14.7_1015_1/xsetup

During the setup execution I had a couple of error dialogue boxes which I ignored;

Failed to execute default Web Browser. Input/output error.Close

Driver installation failed. Please check the /.xinstall/install.log file for more information on the cause of the installation failure.

Then finally I got the message "Install Completed" and the following;

The environment variables are written to settings[32|64].(c)sh at "/opt/Xilinx/14.7/ISE_DS". To launch the Xilinx tools, first source the settings script:

C-shell 64 bit environment...

source /opt/Xilinx/14.7/ISE_DS/settings64.csh

Shell, Bash shell, Korn Shell 64 bit environment...

. /opt/Xilinx/14.7/ISE_DS/settings64.sh

C-shell 32 bit environment...

source /opt/Xilinx/14.7/ISE_DS/settings32.csh

Shell, Bash shell, Korn Shell 32 bit environment...

. /opt/Xilinx/14.7/ISE_DS/settings32.sh

in the terminal cd your way to the following directory;

    cd /opt/Xilinx/14.7/ISE_DS

Change the scripts in it to be executable by typing;

    chmod u+x *.csh *.sh

Run the environment variable setup script, type;

    sudo bash settings64.sh

Start the program by typing;


And it tells you you don't have a licence but it runs. Other runnable programs are but I didn't try them


(Found help here http://stackoverflow.com/questions/15119734/how-to-launch-xilinx-ise-web-pack-under-ubuntu after googling "ISE WebPack won't start ubuntu linux")

It won't do much without a licence although it seems to run.

Eventually after scouring the web by googling "How the fuck do you get papilio working" I found out that to get a licence I need to look here http://xilinx.com/getlicense of course nobody bothered to say that did they!? Once you get there its fairly clear how to get a licence for ISE_WebPACK the software we are using. They send you an email with a licence file attached.

What to do with your licence? Type the 'vlm' command says the email but there isn't one on my system.

Someone else says the licence management menu items in the ISE don't work so,
run the licence manager from the command line type;


IF that throws up this error;

/opt/Xilinx/14.7/ISE_DS/common/bin/lin64/_xlcm: error while loading shared libraries: libQt_Network.so: cannot open shared object file: No such file or directory
The libQt_Network.so library is missing with the SDK standalone installation.

Try installing shared libraries from here. Oh God this goes on and on.

So I download  libQt_Network.zip. Look inside and move "libQt_Network_lin64.so" to MyXilinx directory then rename it;

    mv libQt_Network_lin64.so libQt_Network.so

Then move it to the right place;

    sudo mv libQt_Network.so /opt/Xilinx/14.7/ISE_DS/common/lib/lin64

Now run the licence manager from the command line again;

Assuming it works choose "Locate existing Licences".

Use the load Licence button to select the file you downloaded earlier.

It should then tell you that the licence has been loaded successfully so you can now close the licence manager.

Now you should be able to start the program again. Here is the full path command so that you can start it no matter what your current directory is;


Similarly here is the full path command for starting the Papilio Downloader;

sudo /opt/GadgetFactory/papilio-loader/papilio-loader.sh

Here is roughly how I got my first VHDL programs up and running. First I ignored Gadget Factory's tutorial but instead downloaded IntroToSpartanFPGABook.pdf and another one at Free Range VHDL and watched the video below.

WARNING: IntroToSpartanFPGABook is for the Papilio One so when you set up the ISE you need to put in the right info, Spartan6, XC6SLX9, TQG144, -2. Here is the pin map I've been using: http://papilio.cc/in....PapilioPinouts as pins are different on the Papilio One.

Just for your info I found a 330 Ohm Resister in series with my LEDs was perfect and it appears that inputs go low when not connected.

Essentially I messed about a bit with the example in IntroToSpartanFPGABook which is also what the guy in the video has done.

Sorry not to be much more helpful on this but I want to get on and have some fun and I think I have done my bit for society now!! ;-)

YouTube Video

Plan Ahead

Now it just so happens that downloaded with the ISE software is an alternative development environment called Plan Ahead. I read about the comparison here http://www.xilinx.co...s/planahead.htm

To set it up and start it type;

    sudo /opt/Xilinx/14.7/ISE_DS/PlanAhead/bin/setupEnv.sh

to set the environment variables,

    sudo /opt/Xilinx/14.7/ISE_DS/PlanAhead/bin/planAhead

to start the application. You will need to tell it which FPGA your using.

Moan (1) My feeling is that although IntroToSpartanFPGABook.pdf starts out well he soon starts skipping stuff, i.e. showing you lines of code to add but not where to put them. Then in the VGA chapter he resorts to pseudo code and tells you to write it yourself! i.e. holds your hand, takes you half way across the swamp and leaves you there! This is infuriating since actually its the syntax that is the hard part for a beginner and personally I have never had problems coming up with the algorithm for anything so this kind of thing is a nuisance. 

Joy (1) Ah! here is some really good tutorial material for the technically minded like me.


© Tom de Havas 2011. The information under this section is my own work it may be reproduced without modification but must include this notice.

Subpages (1): Notes