element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
FPGA
  • Technologies
  • More
FPGA
Blog Getting Started with the TinyFPGA & Lattice Diamond 3.12 on Ubuntu 18.04
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
FPGA requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: knitronics
  • Date Created: 25 Jun 2021 9:49 PM Date Created
  • Views 5524 views
  • Likes 13 likes
  • Comments 3 comments
  • tinyfpga
  • Ubuntu
  • fpga
  • lattice semiconductor
  • summer of fpga
Related
Recommended

Getting Started with the TinyFPGA & Lattice Diamond 3.12 on Ubuntu 18.04

knitronics
knitronics
25 Jun 2021

Install Lattice Diamond

Lattice Diamond is developed on Red Hat and is not officially supported on Ubuntu; however with some persuasion, it can be made to work.

 

Start by downloading the Lattice Diamond Linux package here: https://www.latticesemi.com/Products/DesignSoftwareAndIP/FPGAandLDS/LatticeDiamond

 

The main point of difference is the package management system on Red Hat versus Ubuntu. Red Hat is RPM based (.rpm) while Ubuntu is a Debian system (.deb), so the first step is to convert the .rpm Lattice Diamond software package to a .deb

 

Alien is a common, reliable application for converting files to Debian packages (read more here: https://en.wikipedia.org/wiki/Alien_(file_converter)). If not already present on your system, install it:

 

~$ sudo apt install alien

 

Then point it to the Lattice Diamond software package .rpm for it to convert. Be sure to use the scripts option so that it includes all scripts in the package.

 

~$ sudo alien --scripts ./Downloads/diamond_3_12-base-240-2-x86_64-linux.rpm

 

Unless otherwise specified, alien will output the converted Debian package to the ~ home directory, where you can then use the usually dpkg package manager to install it.

 

~$ sudo dpkg -i ./diamond-3-12-base_3.12-241_amd64.deb 

 

image

 

While Lattice Diamond is free to use, you still need to generate a license file for it which can be done here:

https://www.latticesemi.com/Support/Licensing/DiamondAndiCEcube2SoftwareLicensing/DiamondFreeFloatingLicense

 

Once you’ve received the license file from Lattice in your email, move it to the license folder in the installation directory of the Lattice Diamond software:

 

~$ sudo mv ./Downloads/license.dat /usr/local/diamond/3.12/license

 

The file needs a few tweaks to understand/verify your system. On line 1, replace the nodename variable with the host name of your machine (which is the name that appears between the @ symbol and : in the Linux command line. For example, user@hostname:~$).

 

On line 2, replace the daemon_path variable with the following:

 

/usr/local/diamond/3.12/ispfpga/bin/lin64

 

And finally, on line 18, replace the daemon_path variable with

 

/usr/local/diamond/3.12/modeltech/linuxloem

 

Save and close the license file. Then finally, create a blank log file for the license manager to use:

 

~$ sudo vi /usr/local/diamond/3.12/license/license.log

 

Start the License Manager

Before Lattice Diamond can be launched (whether it be the GUI or from the command line) the license manager must be running to confirm to the software that a valid license is present.

 

~$ /usr/local/diamond/3.12/ispfpga/bin/lin64/lmgrd -l /usr/local/diamond/3.12/license/license.log -c /usr/local/diamond/3.12/license/license.dat

 

However, you might get an error like this:

 

bash: /usr/local/diamond/3.12/ispfpga/bin/lin64/lmgrd: No such file or directory

 

A bash error thrown by an executable in this context usually means that a dependency is missing. To determine what’s missing, use the LDD command to print the shared library dependencies of the executable throwing the error:

 

~$ ldd /usr/local/diamond/3.12/ispfpga/bin/lin64/lmgrd

 

Libraries expected by the executable appear on the left side of the => operator while the corresponding libraries present on the system appear on the right side of the => operator.

 

The LDD command shows that the lmgrd command called by Lattice Diamond is expecting the Linux Standard Base (LSB) library, but it is currently not present on my Ubuntu machine. So I can resolve this by installing it:

 

~$ sudo apt-get install lsb 

 

image

 

Once the missing dependency is resolved, the license manager should start right up and immediate return the command line back for you to then be able to launch the Lattice Diamond software:

 

image

 

Run Lattice Diamond from the Command Line

The Lattice Diamond software can be launched as either its GUI or just have the tools sourced to run in the background and be called from the command line. To launch source the tools and just have them running as a background task, pass the & symbol at the end of the command like below:

 

~$ /usr/local/diamond/3.12/bin/lin64/diamond &

 

Run Lattice Diamond GUI

To launch the GUI itself, simply pass the following command:

 

~$ /usr/local/diamond/3.12/bin/lin64/diamond 

 

image

 

 

 

 

 

 

Create New Project

Click the New... option from the Start Page window to create a new project and follow the prompts:

 

image

 

Name the project and select desired file path location:

 

image

 

Download the TinyFPGA A1 template files here: https://tinyfpga.com/a-series-guide.html Add the top level Verilog file to the project and the pinout file (.LPF) for the TinyFPGA A1.

 

image

 

Select the FPGA part number for the TinyFPGA A1 which is MachXO2, LCMXO2-256HC, performance grade 4, QFN32 package type, commercial, LCMXO2-256HC-4SG32C part name.

 

image

 

Select Lattice LSE for the synthesis tool. 

 

image

 

Finally, review and verify the project settings information before clicking ‘Finish’. 

 

image

 

Add the desired code to TinyFPGA Verilog file, TinyFPGA_A1.v, found under the Input Files folder in the File List tab.

 

image

 

If your custom code changes the top level signal names or the number utilized, be sure to also update the pinout constraints file. It is also found in the File List tab in the LPF Constraints Files folder as template_a1.lpf

 

image

 

After making the desired modifications, save the top level Verilog file and pinout constraints file then run synthesis, place & route, and generate a bitstream. Switch over to the Process tab, right-click on JEDEC File under Export Files and select Rerun All.

 

image

 

Program TinyFPGA

With the bitstream ready, it’s time to program the FPGA on the TinyFPGA board with it. You must use the Python programmer from TinyFPGA versus the Programmer in Lattice Diamond as it doesn’t work in Ubuntu due to conflicts with the USB serial driver and FTDI chip driver.

 

First, make sure the following dependencies are installed on your machine:

 

~$ sudo apt-get install python-tk

~$ pip install serial

~$ pip install pyserial

~$ pip install tinyfpga

 

Then clone the TinyFPGA Programmer Application from its repository:

 

~$ git clone --recursive https://github.com/tinyfpga/TinyFPGA-Programmer-Application.git

 

Supply power to the TinyFPGA and connect it to your host machine:

image

image

image

image

image

image

image

Change directories into the top level file and run the main Python script to launch the programmer:

 

~$ cd ./TinyFPGA-Programmer-Application

~$ python tinyfpga-programmer-gui.py

 

First select the TinyFPGA USB device from the drop down box at the top. Then click the Select File button then navigate to the bitstream file generated in Lattice Diamond, it’ll be located at /<project directory>/impl1/<project_name>.jed

 

image

 

Finally, click Program FPGA and wait for the Success notification text below the status bar. Click Exit Bootloader once done.

  • Sign in to reply

Top Comments

  • knitronics
    knitronics over 1 year ago in reply to DAB +2
    Thank you! Im doing a tutorial series on FPGA basics with this board for now since it’s open source and great for getting started. Regards, Whitney
  • colporteur
    colporteur over 1 year ago +2
    Excellent post! I investigated the requirements for Summer of FPGAs -- Lattice MACHXO3LF Starter Kit and discovered no Ubuntu support. You post is timely because it is the groundwork I needed if I was…
  • DAB
    DAB over 1 year ago +1
    Good post. What are you going to build using the FPGA? DAB
  • colporteur
    colporteur over 1 year ago

    Excellent post!

     

    I investigated the requirements for Summer of FPGAs -- Lattice MACHXO3LF Starter Kit and discovered no Ubuntu support. You post is timely because it is the groundwork I needed if I was to pitch an application.

     

    You indicated that you are developing a tutorial series. Are you looking for any test subjects to review the material? I would offer my services. I have been looking for an avenue to explore FPGA's.Summer of FPGAs -- OrangeCrab Dev Bd I have been discussing it on some posts. Ultra96-V2 Workshop: Session 1: Setup with Xilinx Tools there is a possible session starting but the costs is a little steep for my pocket book. Your project seems like an idea opportunity.

     

    I have no FPGA experience. I do have extensive electronic, system administration and programming skills along with knowledge and experience in developing a variety of tutorials for employers and publications. I would consider purchasing the hardware needed to participate if necessary.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • knitronics
    knitronics over 1 year ago in reply to DAB

    Thank you!

    Im doing a tutorial series on FPGA basics with this board for now since it’s open source and great for getting started.

     

    Regards,

    Whitney

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 1 year ago

    Good post.

     

    What are you going to build using the FPGA?

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube