Thursday, July 4, 2013

Adventures with the Terasic DE0 Nano

I have for a long time been fascinated by the idea of programmable logic as a complement to standard MCU's. Ideas like running 32 pwm channels and as many quadrature detectors on one chip for servo control is definitely beyond todays MCU's, powerful as they are.

I have previously played a bit with the Terasic Trac C1 and the Dallas Logic Quickgate EP2C8 Cyclone II boards, trying to learn VHDL and how to build things like an audio synthesizer with them.  So when I saw the Terasic DE0 Nano I simply couldn't resist the urge to buy one. At €74 from Mouser it is not dirt cheap, but for an FPGA board of this kind it is very good value.

Designing FPGA logic is quite different from ordinary C/C++ microprocessor programming. The best book I have found to help me is "Rtl Hardware Design using VHDL" by Pong P. Chau.

So after reviving some old VHDL projects I started to install the Quartus software on my Fedora 18 system. Quartus 13 refused to run without frequent crashes even after I changed and added several system libraries to conform to the ones coded into the Quartus 13 executables. After this I tried installing Quartus Free Web Edition 11, and it seems to run perfectly,  this might be because of the changes done to make Q 13 run, or not, but at the moment it works. Older Quartus versions can be found at  ftp://ftp.altera.com/outgoing/release/.

Most of the get started manuals for complex systems like this tells you to install some precoded development package and just click menu boxes in a specified sequence without giving the logic for that. For me this is not really learning a new tool. So I try to build small things from scratch to see what happens before using the heavyweight preprogrammed IP in the component libraries.



Right now I have a Serial Port echo running on the DE0 Nano that displays incoming serial bytes on the 8 LED's and then echoes them back, the small chip is a Teensy 3 that acts as a Serial-USB bridge. Its not very advanced yet but writing the logic from scratch is fun and rewarding.  Next step is SPI and some PWM.


2 comments:

Woo Yan san said...

hi
can you describe the step to connect with the uart serial communication?
bcoz i'm working on a gps wit de0-nano
and i need to receive the data from the gps which is ttl into the de0-nano

Magnus Lundin said...

I did that work two and a half years ago, and unfortunately the project files was lost in a hard drive crash :( , and I have not used that board since.

There are uart vhdl components to be found on the internet:
https://www.youtube.com/watch?v=fMmcSpgOtJ4
https://github.com/pabennett/uart