Author Topic: Beginners guide to Lattice MachXO2 / Diamond?  (Read 12671 times)

0 Members and 1 Guest are viewing this topic.

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Beginners guide to Lattice MachXO2 / Diamond?
« on: October 10, 2014, 08:54:07 pm »
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=678 is 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?
 

Offline Torrentula

  • Regular Contributor
  • *
  • Posts: 91
  • Country: de
    • My blog
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #1 on: October 11, 2014, 08:10:16 am »

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=678 is probably the best I've found)


Well 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 the Free Range VHDL book, I've learned alot about VHDL from that book.


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.

The 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.
 

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #2 on: October 11, 2014, 11:56:17 am »
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 on www.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!
 

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #3 on: October 11, 2014, 02:45:24 pm »
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.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #4 on: October 11, 2014, 02:58:08 pm »

I can create schematics,
Don'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.
Quote
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.

Have you defined both the device and package?
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #5 on: October 11, 2014, 03:00:18 pm »

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.
Avoid 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
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #6 on: October 11, 2014, 06:48:47 pm »
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!
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #7 on: October 11, 2014, 10:33:05 pm »
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!
ISPVM 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
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #8 on: November 25, 2016, 12:54:03 pm »
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_ZsBgM

https://www.youtube.com/embed/SmdEP_ZsBgM

Note: 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.
« Last Edit: November 25, 2016, 12:56:27 pm by Howardlong »
 

Offline Axk

  • Regular Contributor
  • *
  • Posts: 218
  • Country: by
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #9 on: March 15, 2019, 09:07:46 pm »
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.8) diamond programmer does not complain but the design doesn't work after the programmer.

So I thought I might try ispVM.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Beginners guide to Lattice MachXO2 / Diamond?
« Reply #10 on: March 18, 2019, 11:44:39 am »
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.8) diamond programmer does not complain but the design doesn't work after the programmer.

So I thought I might try ispVM.
I use V18 - last time I checked it was still significantly faster than Diamond Programmer
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf