Nexys2 Nexus Part 1: The EPP Emulator

Posted in Nexys2, Xilinx on 2011-03-04 at 21:59:50 by Chris – 4 Comments

The Digilent Adept tool, in addition to programming the FPGA on the Nexys2 board, also allows you to communicate with your designs over the same USB connection, with Adept setting and reading register values in the FPGA. In order to do this your design must implement the Enhanced Parallel Port (EPP) protocol. Digilent provide a reference design for this, which is a bit clunky, requiring synthesis hints to avoid glitches during state transitions. I rewrote it to be a little cleaner. Once you have built this design using ISE WebPack and used Adept to load it into your Nexys2, you can select Adept's "Register I/O" tab and write some values to the four EPP registers, and see that the values are read back correctly:

So far so good. But those four registers currently do nothing at all. You can write to them and read the values back, but the registers are not wired to anything else in the FPGA. This oversight is fixed with minimal changes in a second example. This time, the behaviour of registers 0x00, 0x01 and 0x02 is the same as before, but any value written to register 0x03 is displayed on the eight LEDs on the Nexys2 board. And when register 0x03 is read, the value returned is not the value previously written, but the current state of the eight switches on the Nexys2 board.

4 Comments

Thank you for posting this!
I've been messing around with the Nexys2 USB communication for a while now, and other than the board verification design NONE of the examples worked for me. Yours does work brilliantly and it is far more compact and beautifully written.

Reply

You might find that my FPGALink library is much better than the Digilent USB communication. With it you can program the FPGA and subsequently read and write single or multiple bytes on up to 128 registers. The throughput is about 24MiB/s on Linux and 18MiB/s on Windows. It is available in source form and binaries for Windows, Linux and MacOSX. The API is documented here; there is also a Python binding.

Reply

Chris, thank you very much for posting the EPP modulator!

I have a question. I work as a physicist at the Institute of Physics, Belgrade, Serbia. I developed a project for controlling my experiment based on Digilent Nexys-2 board. I use slightly amended version of your EPP modulator. I will try to make a publication about this device in some scientific paper. Since I use your idea for FPGA and PC communication, may I cite this webpage? Also, I plan to publish all my code, so can I publish amanded version of you code? (line: Copyright (C) 2011 Chris McClelland still stands, of course)

Thanks a lot!
Stanko.

Reply

Of course you can cite this page, and of course you can publish your changes to my code. I couldn't stop you even if I wanted to: the GPL license is designed to protect your rights as user, not mine as developer.

I ask two things:

  • Please consider using (and citing) FPGALink instead of the stuff on this page. You will be in good company: FPGALink is already used for data acquisition by several researchers in your field around the world.
  • Since my degree was in physics, I am interested in your research and your experiment. So if possible I'd like a copy of your paper when you publish.

Leave a Reply

You may use TWiki syntax in your comment. Your email address will not be published.

| Home | About |

Powered by WordPress & MakeStuff theme, with Silk icons