Its a royal PITA to specify the pinout of a 144 pin part! So there is no point to doing this more than once -- across the entire internet.
Its unfortunate that Lattice does not provide one, but their Demo project does not specify the IOs since they are not used.
In my code repository is a Diamond project that specifies all XP2 IOs as used by the Brevia board. And it sets the XP2 part up with 3 clocks, 400mhz, 50mhz, and 25mhz. Of course you can change these clock values by editing the "pll" module.
You checkout the entire project (recommended), or browse and pull down the key files to add into your own project:
top.v: the "main" verilog file
starter1.lpf: the file that places the verilog symbols onto particular pins
pll.v: autogenerated pll module that sets up the 3 clocks.
Sunday, October 10, 2010
Tuesday, October 5, 2010
Lattice Diamond on Ubuntu 10.04 64 bit
For some reason, Lattice provides its new Diamond GUI for the second most popular Linux distribution instead of Ubuntu, the most popular distribution.
Here is how to fix their mistake :-). Additionally, they only provide 32 bit binaries but I have a 64 bit system. So this how-to solves that problem as well.
Installing the IDE
Step 1: Download Diamond's .rpm located here, and apply for a license.
Step 2: Install "alien", the .rpm to .deb package converter.
sudo apt-get install alien
Step 3: install "getlibs"
This handy script will install the 32-bit version of libraries even if you are running 64-bit Ubuntu. Since Diamond is 32 bit you will have to install some 32 bit stuff.
click here for info (http://ubuntuforums.org/showthread.php?t=474790)
Step 4: Install 32 bit libraries (if on 64 bit Ubuntu)
apt-get install ia-32libs
sudo getlibs -p libmotif3
I am doing this from memory...if you run diamond (later step) and get a missing .so, please run "getlibs -l" to install that library and post a comment so I can update this HOW-TO!
Step 5: Run alien on the diamond RPM.
When the diamond RPM is downloaded, run alien on it:
alien -d diamond_1_0-base-135-i386-linux.rpm
Wait for a very long time. This will ultimately have an error and drop you back to the Linux prompt. It will not hang (be patient). However you will find that it created a subdirectory called "diamond_1_0-base-1.0" off your current directory. Everything we need is in there. I'll copy it to /usr/local so it is accessible:
sudo cp -r diamond_1_0-base-1.0/usr/local /usr/local
Step 6: Copy the license
You should have gotten a license file in your email stream from step 1.
Save that file into the diamond subdirectory: /usr/local/diamond/1.0/license/license.txt
Step 7: Run it!
/usr/local/diamond/1.0/bin/lin/diamond
if you get any missing libraries, please attempt to "getlibs" (see step 4) and post a comment here so others can benefit from your pain :-).
Installing the Lattice USB Programmer
Before you actually program your board, you'll have to install drivers for the programmer dongle.
The Lattice USB programmer uses libusb so that is convenient as no kernel module needs to be built. I think there is another programmer that uses the FTDI 2232 chip that does require drivers to be installed. This how-to won't cover that one, or the parallel port programmer (which I was unable to get working).
Step 1: install libusb
sudo apt-get install libusb-1.0-0
Step 2: Add the USB device to "udev"
sudo emacs /etc/udev/rules.d/10-local.rules
Append this line:
#lattice
BUS=="usb",ACTION=="add",SYSFS{idVendor}=="1134",SYSFS{idProduct}=="8001",MODE=="0660",OWNER=="root",SYMLINK+="lattice-%n"
Step 3: Plug in the USB device programmer
You should see a device in /dev named "lattice":
~$ ls /dev/lat*
/dev/lattice-6
Step 4: Fix permissions.
Shown here is an impermanent fix. Every time you turn off your computer or remove the programmer you'll have to re-run this, since the device is removed and recreated during these events. I'm sure that some of you Ubuntu/Linux wizards can tell me how to make it permanent...
sudo chmod a+rw /dev/lat*
That's it! The ispVM programming tool should auto-detect the cable now.
Have fun and post some OSS designs!
Here is how to fix their mistake :-). Additionally, they only provide 32 bit binaries but I have a 64 bit system. So this how-to solves that problem as well.
Installing the IDE
Step 1: Download Diamond's .rpm located here, and apply for a license.
Step 2: Install "alien", the .rpm to .deb package converter.
sudo apt-get install alien
Step 3: install "getlibs"
This handy script will install the 32-bit version of libraries even if you are running 64-bit Ubuntu. Since Diamond is 32 bit you will have to install some 32 bit stuff.
click here for info (http://ubuntuforums.org/showthread.php?t=474790)
Step 4: Install 32 bit libraries (if on 64 bit Ubuntu)
apt-get install ia-32libs
sudo getlibs -p libmotif3
I am doing this from memory...if you run diamond (later step) and get a missing .so, please run "getlibs -l
Step 5: Run alien on the diamond RPM.
When the diamond RPM is downloaded, run alien on it:
alien -d diamond_1_0-base-135-i386-linux.rpm
Wait for a very long time. This will ultimately have an error and drop you back to the Linux prompt. It will not hang (be patient). However you will find that it created a subdirectory called "diamond_1_0-base-1.0" off your current directory. Everything we need is in there. I'll copy it to /usr/local so it is accessible:
sudo cp -r diamond_1_0-base-1.0/usr/local /usr/local
Step 6: Copy the license
You should have gotten a license file in your email stream from step 1.
Save that file into the diamond subdirectory: /usr/local/diamond/1.0/license/license.txt
Step 7: Run it!
/usr/local/diamond/1.0/bin/lin/diamond
if you get any missing libraries, please attempt to "getlibs" (see step 4) and post a comment here so others can benefit from your pain :-).
Installing the Lattice USB Programmer
Before you actually program your board, you'll have to install drivers for the programmer dongle.
The Lattice USB programmer uses libusb so that is convenient as no kernel module needs to be built. I think there is another programmer that uses the FTDI 2232 chip that does require drivers to be installed. This how-to won't cover that one, or the parallel port programmer (which I was unable to get working).
Step 1: install libusb
sudo apt-get install libusb-1.0-0
Step 2: Add the USB device to "udev"
sudo emacs /etc/udev/rules.d/10-local.rules
Append this line:
#lattice
BUS=="usb",ACTION=="add",SYSFS{idVendor}=="1134",SYSFS{idProduct}=="8001",MODE=="0660",OWNER=="root",SYMLINK+="lattice-%n"
Step 3: Plug in the USB device programmer
You should see a device in /dev named "lattice":
~$ ls /dev/lat*
/dev/lattice-6
Step 4: Fix permissions.
Shown here is an impermanent fix. Every time you turn off your computer or remove the programmer you'll have to re-run this, since the device is removed and recreated during these events. I'm sure that some of you Ubuntu/Linux wizards can tell me how to make it permanent...
sudo chmod a+rw /dev/lat*
That's it! The ispVM programming tool should auto-detect the cable now.
Have fun and post some OSS designs!
Monday, October 4, 2010
Lattice FPGA -- They are beginning to get OSS
After a quite a bit of comparative evaluation I chose the Lattice XP2 FPGA and the Brevia demo board for a bit of hardware hacking. (In short, I wanted a non-volatile FPGA or large CPLD, and found that the XP2 and MachXO seemed better than the Altera and Xilinx offerings).
And I'm happy to say that unlike my prior complaints about Cypress, I do think that Lattice "gets it" around open source hardware.
Al is not perfect, but they seem to be moving rapidly in the right direction.
First off, they recently obsoleted their old GUI and released their "Diamond" GUI for both Windows and Linux. Its a little crunchy still on Linux. However, this is a major, probably very expensive, initiative and Lattice should be commended for letting Linux be part of it! While they officially only support Red Hat, check out this output coming from the "compiler":
Warning: You are running on an unsupported platform
'synplify_pro' only supports Red Hat Enterprise Linux 4.0 and above
current platform: Ubuntu 10.04.1 LTS
That's right! I managed to get it up on Ubuntu 64 bit (I'll provide a little HOW TO in my next post).
Secondly, they priced the board extremely well at $29.
Third, they provide a lot of free libraries (called "designs" or "IP" in the hardware world) so long as you only use them on Lattice parts. Personally, I can live with that. After all Lattice is in the business of selling chips. And you know if I decide to switch chips, I can implement the underlying library myself and still have benefited from using Lattice's library to get me prototyping my application code faster...
Fourth, the GUI/compiler is free (well, its a 1 year free license so I guess someday they could take that away) and command line accessible.
Fifth, the USB programmer uses libusb, so you don't even need to install a special driver. This makes it a lot easier to run on different linux distros.
This is a great first step!!! Its perfect for OSS hackers and students.
... but there is stuff Lattice needs to work on.
First, my biggest gripe is that the Brevia board ships with a parallel port programmer. But who has parallel ports anymore? And by the way, purchasing a USB->parallel converter WILL NOT work. Those converters do not translate all parallel signals. Lattice FAEs claim some converters work, but will not endorse a particular one so we are left guessing.
In fact I was unable to get the parallel port programmer to work.
Second, the USB programmer purchased separately costs $150!!! This is an evil bait-and-switch. Honestly I haven't priced components out, but in this market I'd bet that USB components are cheaper than parallel because its all about volume. So what is going on here!!?
However its standard JTAG so other programmers should also work...
Third, the ispVM device programming tool was poorly ported to Linux. In particular, you actually specify the old 8088 parallel port number 0x378 (or whatever) to identify the parallel port, not the device name (and again I never got it to work with the parallel programmer).
Fourth, they only offer RPMs. Lattice, even if you don't want to support every distro, its traditional to just jam your program in a big gzipped tarball archive so we can pull it down and install it by hand by coping it to /usr/local or something along those lines.
And finally, Diamond is still a little rough around the edges. For example, sometimes the editor stops working and I have to close and reopen my project. Even worse, I managed to get my project into an inconsistent state where some generated files thought that certain clock resources existed but I had removed them. The easiest way out of that was to create a new project :-(, and copy my source code over.
However Diamond is very new. I expect very good things.
All in all its a great start! Thanks Lattice!
Disclosure: I am in no way affiliated with Lattice, other than having bought their $29 Brevia board...
And I'm happy to say that unlike my prior complaints about Cypress, I do think that Lattice "gets it" around open source hardware.
Al is not perfect, but they seem to be moving rapidly in the right direction.
First off, they recently obsoleted their old GUI and released their "Diamond" GUI for both Windows and Linux. Its a little crunchy still on Linux. However, this is a major, probably very expensive, initiative and Lattice should be commended for letting Linux be part of it! While they officially only support Red Hat, check out this output coming from the "compiler":
Warning: You are running on an unsupported platform
'synplify_pro' only supports Red Hat Enterprise Linux 4.0 and above
current platform: Ubuntu 10.04.1 LTS
That's right! I managed to get it up on Ubuntu 64 bit (I'll provide a little HOW TO in my next post).
Secondly, they priced the board extremely well at $29.
Third, they provide a lot of free libraries (called "designs" or "IP" in the hardware world) so long as you only use them on Lattice parts. Personally, I can live with that. After all Lattice is in the business of selling chips. And you know if I decide to switch chips, I can implement the underlying library myself and still have benefited from using Lattice's library to get me prototyping my application code faster...
Fourth, the GUI/compiler is free (well, its a 1 year free license so I guess someday they could take that away) and command line accessible.
Fifth, the USB programmer uses libusb, so you don't even need to install a special driver. This makes it a lot easier to run on different linux distros.
This is a great first step!!! Its perfect for OSS hackers and students.
... but there is stuff Lattice needs to work on.
First, my biggest gripe is that the Brevia board ships with a parallel port programmer. But who has parallel ports anymore? And by the way, purchasing a USB->parallel converter WILL NOT work. Those converters do not translate all parallel signals. Lattice FAEs claim some converters work, but will not endorse a particular one so we are left guessing.
In fact I was unable to get the parallel port programmer to work.
Second, the USB programmer purchased separately costs $150!!! This is an evil bait-and-switch. Honestly I haven't priced components out, but in this market I'd bet that USB components are cheaper than parallel because its all about volume. So what is going on here!!?
However its standard JTAG so other programmers should also work...
Third, the ispVM device programming tool was poorly ported to Linux. In particular, you actually specify the old 8088 parallel port number 0x378 (or whatever) to identify the parallel port, not the device name (and again I never got it to work with the parallel programmer).
Fourth, they only offer RPMs. Lattice, even if you don't want to support every distro, its traditional to just jam your program in a big gzipped tarball archive so we can pull it down and install it by hand by coping it to /usr/local or something along those lines.
And finally, Diamond is still a little rough around the edges. For example, sometimes the editor stops working and I have to close and reopen my project. Even worse, I managed to get my project into an inconsistent state where some generated files thought that certain clock resources existed but I had removed them. The easiest way out of that was to create a new project :-(, and copy my source code over.
However Diamond is very new. I expect very good things.
All in all its a great start! Thanks Lattice!
Disclosure: I am in no way affiliated with Lattice, other than having bought their $29 Brevia board...