Skip to content

Getting started with Lattice ECP3 Versa Dev Kit

Henryk Paluch edited this page Dec 14, 2017 · 20 revisions

Here is an guide how to get started using Lattice ECP3 Versa Dev Kit

Hardware requirements:

  • having Lattice ECP3 Versa Dev Kit card and USB to Mini cable (note that USB Mini connector is less common - today most devices have USB Micro)
  • having PC (or PC with VirtualBox) with at least:
    • USB 2.0 port
    • 2GB RAM or more (used 1.8GB for VM in VirtualBox, to avoid warning - because ZOTAC has 3.8GB of memory and VM should use no more than 1/2 of host physical memory)
    • 30GB of free disk space or more

In my case I used:

Software setup

Download and install Diamond 3.10 64-bit for Windows to your guest OS. Keep all components selected.

Request Diamond LatticeECP3 Versa Kit Free License. You should receive license.dat (valid for 1-Year) to your registration e-mail.

Copy your license.dat to C:\lscc\diamond\3.10_x64\license\license.dat.

NOTE: verify your own environment setting in CMD.EXE in case of problems:

echo %lm_license_file%
C:\lscc\diamond\3.10_x64\license\license.dat;

USB Passthrough setup

If you are using VirtualBox VM (recommended for flexibility and easy backups) then you need to prepare USB 2.0 Passthrough:

  • Do NOT insert Dev-Kit Card into PC (PCI Express slot!) - leave that card alone
  • Connect 12V Power Supply to Dev-Kit Card (it is included in Dev-Kit)
  • Connect Card to USB 2.0 port via USB Mini cable (it is included in Dev-Kit)

In VirtualBox:

  • select your VM and click on Settings
  • click on USB
  • check-on Enable USB
  • select USB 2.0 (EHCI) Controller
  • click on USB Socket icon with +
  • select device FTDI Dual RS232-HS [0700] (this is our Dev-Kit card)

Installing FTDI Drivers

  • Disconnect your Dev-Kit Card from USB
  • Start your Guest OS
  • From Start Menu run All Programs -> Lattice Diamond 3.10 (64-bit) -> Accessories -> Install&Uninstall Cable Drivers
  • Use same Setup as in Getting started with ispMACH 4256ZE Breakout Board, that is:
    • select radio-button FTDI Windows USB Driver
    • click on Install
    • when requested - connect your Dev-Kit card to USB
    • wait for a few second (until "Driver installation failed" appears on Windows systray)
    • than click on Yes (that you have connected USB cable)
    • after a while there should appear dialog that Installation was successful
    • click on Close button of installation dialog.

Your system is now ready for Development/Programming

Programming LED demo

  • Download nice tutorial from Lattice Diamond Tutorial
  • you should get LatticeDiamondTutorial310.pdf from above link
  • this file contains full LED tutorial exactly for our Versa Dev-Kit board
  • follow instructions in this tutorial.

Also I strongly recommend to download LatticeECP3VersaEvaluationBoardUsersGuide.pdf from LatticeECP3 Versa Evaluation Board User's Guide. There is lot of important information (for example how is demo hardware connected to FPGA etc.).

Notes

Make program persistent in FPGA

By default, programmed FPGA is transient (program is lost on power-off!!!). This is because FGPA itself (unlike CPLD - including ispMach) does not contain persistent Flash Memory.

Fortunately there is solution - there is connected external Flash via SPI interface.

If you referenced LED tutorial you just need to:

  • Boot your Guest OS with installed software
  • Connect 12V Power Supply to Dev-Kit
  • Connect Dev-Kit card to USB
  • Run All Programs -> Lattice Diamond 3.10 (64-bit) -> Accessories -> Diamond Programmer
  • Open XCF created by Diamond Programmer in LED tutorial
  • Just to ensure that there is correct BIT file - in my case C:/projects/LEDtest/LEDtest/LEDtest_LEDtest.bit
  • Ensure that DIPs J1 to J5 are ON.
  • You may J7 also turn ON, and J6 turn OFF (counter in Up mode)
  • click on Design -> Program to download LED demo to FPGA (again transient) It takes 5s on my hardware.

To program SPI Flash memory we try to follow When you look at LatticeECP3VersaEvaluationBoardUsersGuide.pdf there are basic instructions on Page 5, chapter Programming Serial SPI Flash Memory. However we need to adapt that guide from ispVM to Diamond Programmer:

IMPORTANT! Do not use more than one Device line in Programmer - it behaves VERY strangely...

  • Save/Close your current XCF project used for transient programming of FPGA - for example to C:\projects\LEDtest\LEDtest\fpga_ram.xcf
  • in Diamond Programmer click on New File...
  • keep default Cable: and Port: (should be OK)
  • click on OK
  • confirm close of previous XCF project
  • fill in:
    • Device Family: LatticeECP3 (should be already selected)
    • Device: LFE3-35EA (must be selected manually)
  • Right-click on this new row and select Device Properties...
    • change Access Mode: to SPI Flash Background Programming
    • Operation: should be kept SPI Erase, Program, Verify
    • change SPI Flash Options to:
      • Family: SPI Serial Flash (should be already selected)
      • Vendor: STMicro
      • Device: SPI-M25P64 (notice missing P in original guide)
      • Package: 16-lead SOIC (should be already selected)
  • change Programming File: to same file as above - in my case C:/projects/LEDtest/LEDtest/LEDtest_LEDtest.bit
  • notice, that SPI Programming part of dialog box changes automatically (fields like Data file size and End Address)
  • click on OK
  • press Ctrl+S to save your XCF configuration
  • name it for example fpga_flash.xcf

To program SPI Flash do now:

  • select the only row in Diamond Programmer ( it has Operation: SPI Flash Erase, Program, Verify)
  • and in menu again Design -> Program
  • it takes 30s on my hardware

How to verify that your program is in SPI Flash:

  1. press PROGRAMN button - after few seconds (3s or so) it should reset counter to default 0 and start counting if DIP switch J7 is OFF
  2. you can try to
    • disconnect USB
    • disconnect 12V Supply
    • after few seconds connect 12V Supply
    • after few seconds (3s or so) there should appear again LED Counter demo...

Uuuffff!

Here are additional documents about Lattice ECP SPI programming:

More info on LED demo

The information in LatticeDiamondTutorial310.pdf is a bit terse, however you can easily explore this demo. Most important files are (copied from directory C:\lscc\diamond\3.10_x64\docs\tutorial\Diamond_tutorial\):

  • pin_assignments.lpf there you can see that:
    • J7 DIP Switch is reset signal (active when in OFF because of negative logic). Therefore counter counts up/or down when J7 is ON only.)
    • J6 DIP is called direction.
  • LEDtest.v contains LED logic:
    • when direction is active (J6 in OFF) than counter is counting Up and is shown on 14 segment LED display only
    • when direction is inactive (J6 is ON) than counter is counting down on both 14 segment LED display and also there is "moving light" on LEDs (for some mysterious reason these pins are assigned in strange order)
    • this module uses 14 segment LED display like ordinary 7 segment, so D hex letter looks same as 0 number and B hex letter looks same as 8 number, oops.
  • topcount.v top-level Verilog HDL module - all input/outputs are there and also calls clock division (you can see that default FPGA clock is too fast for our eyes :-)
Clone this wiki locally