Beginners guide to Lattice MachXO2 / Diamond? - Page 1
Forum section: electronics / general

author: mc
author_rank: Regular Contributor
timestamp: October 10, 2014, 08:54:07 pm
content: So following on from my previous thread, I bought one of the Lattice MachXO2 Pico boards, figuring it was reasonably cheap, and it would help me figure out the world of FPGA/CPLDs.Now having spent a couple evenings this week, I'm only marginally further forward, and have a lot less hair!Various searches have not really turned up any good getting started guides/tutorials, however I have found a couple that have pointed me in the right direction. (http://blog.bastelhalde.de/?p=678is probably the best I've found)I can create schematics, however I'm unable to allocate pins via the spreadsheet view. When I goto spreadsheet view, I can't even scroll down. A lot of the options in the spreadsheet view are greyed out, and I'm not sure if it's something not installed or I've not configured something right.So I've had to rely on manually editting the LPF constraints file, but I'm more or less guessing and relying on copying from the example files, as Lattice seem to have everything spread across seemingly endless documents.So, does anybody have any good guides for Lattice, or any tips?To get going, I'd be happy with an example to flash an LED, as I am struggling to get my head around the whole process.Or should I just order something Xilinx based, as tutorials/examples for them seem to be far more plentiful?

author: Torrentula
author_rank: Regular Contributor
timestamp: October 11, 2014, 08:10:16 am
content: Quote from: mc on October 10, 2014, 08:54:07 pmWell an FPGA is just a "dumb" blob of silicon with many unconnected LUTs/logic that you configure with your design, usually through an HDL, either Verilog or VHDL. You could try theFree Range VHDL book, I've learned alot about VHDL from that book.Quote from: mc on October 10, 2014, 08:54:07 pmThe Spreadsheet View will only show inputs and outputs of your top level entity. First you have to at least synthesize your design so the software can figure out which inputs and outputs are really used and connected.BTW if you expect some output to show up in the spreadsheet view and it doesn't, chances are your design is flaky and the input/output has been optimized out because it is not being used.

author: mc
author_rank: Regular Contributor
timestamp: October 11, 2014, 11:56:17 am
content: Thanks for the reply Torrentula.I do understand that FPGAs are dumb blobs that need need configured/programmed, it's just I was struggling with getting a functioning process for doing that.I had found what look to me to be a couple good verilog/vhdl guides/links over onwww.fpga4fun.com, however having had a quick read of the first couple chapters of the Free Range VHDL book, it looks a bit more comprehensive for learning VHDL.Anyway, I solved the issue I was having. It turned out that Synplify hadn't installed correctly, so the Synthesize steps weren't happening, which in turn meant the Translate Design couldn't happen, resulting in the Spreadsheet View not working. A complete reinstall with the virus checker disabled seems to have things working how they should.I'm now of to try getting this Pico board to do something, so I'm sure I'll be back with more questions!

author: mc
author_rank: Regular Contributor
timestamp: October 11, 2014, 02:45:24 pm
content: Woohoo!Finally managed to acheive something. I've got an LED that turns off when you press a button!I did have another couple issues getting there, but I'm happy I've got the basic process sorted, so can now move on to doing something more involved.For anybody else trying to get going, here's a couple notes-If you're using Schematic designs, you must use Synplify as the active synthizer, as Lattice LSE doesn't give the Translate Design process step.Also, it could possibly be a bug, but when using the programmer for the first time in a project, make sure you select create blank file, otherwise it'll try to read the existing project from the board, which in my case crashed Diamond and I had to do a complete reboot to get things working again.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 11, 2014, 02:58:08 pm
content: Quote from: mc on October 10, 2014, 08:54:07 pmDon't bother with schematic entry - I don't know to what extent Diamond supports it but it isn't used much so may well have unresolved issues.QuoteHave you defined both the device and package?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 11, 2014, 03:00:18 pm
content: Quote from: mc on October 11, 2014, 02:45:24 pmAvoid the Diamond programmer, use ISPVM instead.Even if they've fixed the "sometimes programs garbage" issue I found with 2.x , it's still a factor or 2-3x slower than ispvm last time I compared

author: mc
author_rank: Regular Contributor
timestamp: October 11, 2014, 06:48:47 pm
content: Thanks for the comments Mike.I only used schematic entry for the purpose of getting something simple working, which in the above example was just an inverter, an input, and an output. I'm now reading the Free Range book recommended above to acheive the same thing but in VHDL, and then I'll work on some more complex examples.Device and package were defined when I created the project. I eventually figured out the problem when I checked the Tcl Console, and it was showing an error that it couldn't locate synpwrap. I checked the folder where it should of been according to the default settings, and it wasn't there. When I originally installed Diamond, Avast kept scanning files, so I'm guessing it upset the install and files were missed. Reinstalling with the Avast sheilds disabled fixed that issue.Interesting to know about the programmer. The inbuilt Diamond programmer does seem pretty slow, as it hangs for a good few seconds just prior to actual programming, then suddenly springs into life and is pretty quick after that. I'll tolerate it for now, as it does seem to work well with the Pico boards built in programmer, and I don't think I could face breaking the development chain just as I've got it working!

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 11, 2014, 10:33:05 pm
content: Quote from: mc on October 11, 2014, 06:48:47 pmISPVM is no less convenient to use once set up, which is just a case of selecting device, programming mode and file - single button to program. For a 1200 device, about 2 secs for SRAM, 8 secs for flash program

author: Howardlong
author_rank: Super Contributor
timestamp: November 25, 2016, 12:54:03 pm
content: Well yes, this is a necropost, but I have just had a bit of a eureka moment.I came across the video and blog below on YouTube yesterday for the MachXO2 breakout board. Bugger me, if it didn't work, and, for the first time ever after years of false starts on FPGAs, since following this video I've actually been able to hack my own Verilog without being a script monkey or ending up at a dead end.If you already have reasonable experience in digital electronics but lack programmable logic skills, I can happily recommend this.http://farrellf.com/projects/hardware/https://youtu.be/SmdEP_ZsBgMhttps://www.youtube.com/embed/SmdEP_ZsBgMNote: make sure you download the same version of Lattice Diamond development environment used in the tutorial, v3.6, Google "lattice archive" to find it, click "Downloadable software" in the page. The current version, 3.8, I couldn't even get to install on Windows 10 x64, giving me a Windows 2008 update error code 0x80070002 for some bizarre reason, I don't have a huge amount of faith in Lattice's Diamond builds, the last time I gave this a go it transpired that their supplied FTDI driver was broken, wasting hours of effort trying to diagnose.

author: Axk
author_rank: Regular Contributor
timestamp: March 15, 2019, 09:07:46 pm
content: mikeselectricstuff,This is an old thread now, but are you still using the ispVM programmer for MachXO2 FPGAs?Which exact version of ispVM is this?I was trying to find a version that supports the MachXO2 family in Lattice's software archive but failed.Trying to program LCMXO2-256HC-4SG32C with the latest diamond programmer and it fails with an obscure error of "ERROR - function CHECK_SECURITY_PROTECT_KEY", an older (v3.diamond programmer does not complain but the design doesn't work after the programmer.So I thought I might try ispVM.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 18, 2019, 11:44:39 am
content: Quote from: Axk on March 15, 2019, 09:07:46 pmI use V18 - last time I checked it was still significantly faster than Diamond Programmer