I've never bought an Arduino, but now I have 1,000 of them.

Posted by: Dave Vandenbout 6 years ago

(4 comments)

My confession: I've never owned an Arduino; I've never used an Arduino. There, I said it.

It's not that I dislike the Arduino. Some people disparage it as a "toy", but anything that helps you get your project done quicker is fine by me. I just haven't worked on anything that would benefit from it.

So it surprised me when I found out I actually had an Arduino. In fact, I had thousands of them! Let me explain.

People use the XESS XuLA and XuLA2 FPGA boards for a variety of applications, some of which might be better served by a microcontroller. No problem, you could use Xilinx's Picoblaze or Microblaze uC cores for that. But the Picoblaze is really small and limited, while the Microblaze is very capable and complicated (especially the IDE). One of my customers got into a conversation with Alvaro Lopes about using his microcontroller core instead.

Several years ago, Alvie developed the ZPUino: an open source, 32-bit microcontroller core written in VHDL. In addition, it has an Arduino-like IDE, also open source. Alvie offered to port his new ZPUino-2.0 to the XuLA2 board if I would send him one. Get a complete 32-bit microcontroller and IDE ported in exchange for a $69 FPGA board? You bet I sent him one!

Within a few months, Alvie had something workable that I could try. It's not in a form that's suitable for mass distribution yet (no pretty installer, for instance), but I thought I'd show a bit about it so maybe some brave souls could also give it a go. Here's what you do:

  1. First, download a ZPUino 2.0 bitstream file for the FPGA on the XuLA2-LX9 board. Use the GXSLOAD utility to store the bitstream into the configuration flash of the XuLA2 board. (Don't store it directly into the FPGA because that will get erased if the board ever loses power.)

  2. Next you'll need the ZPUino 2.0 IDE beta distribution. I selected the Windows archive, but linux versions are also available. (It's 111 MB, so be prepared for that.) Then, you just extract the distribution into a folder. (I used C:\temp\ZPUino-2.0.0.)

  3. Now you have to provide a channel for the IDE to communicate with the ZPUino. This is where things get kludgy. Because the IDE doesn't currently understand the protocol used by the XuLA2, you'll need to connect the TCK (orange) and TDI (yellow) leads of an FTDI cable to the chan0 and chan1 I/O pins of the board. (In my case, I use a C232HM-DDHSL-0 cable although cheaper alternatives exist.)

  4. Once the FTDI cable is connected, just fire up Alvie's Arduino-like IDE. (It's zpuino.exe in the top level of the extracted distribution.) Let the IDE know what board it's working with by clicking Tools => Board => ZPUino 2.0 (32-bit) Boards => ZPUino 2.0 on XuLA2 (LX9) in the menus. You'll also need to select the communication port using the Tools => Port menu item (my FTDI cable shows up as COM6 on my PC).

  5. Once all the setup is done, you can type some code into the IDE, compile it, and then download it to the XuLA2 board. But as an initial test, open the simple blinker example by selecting `File => Examples => 0.1Basics => BLink. Then click the File => Upload menu item and the example code will be compiled and loaded into the board. Connect an LED to the chan13 pin of the XuLA2 and you should see it blinking once every two seconds.

Here's a video that shows the entire process:

(As an added incentive to watch, there are some instructions embedded partway through the video on how you can enter to win a free XuLA2-LX9 board.)

So every XuLA2 board in my inventory, every one I've ever sold, can now be turned into one of the smallest Arduino-like systems out there using an open and free microcontroller core and IDE. But, what now? It only runs on the Spartan-6 LX9 FPGA. And it's circuitry is fixed! In my following posts, I'll show you how to:

  • Recompile the ZPUino 2.0 so you can run it on a XuLA2-LX25 board.
  • Add new circuitry in the FPGA to enhance the ZPUino.

I'll also be working on some software that will allow the IDE to communicate with the ZPUino over the XuLA2 USB link. Then you won't need an extra $25 cable that takes up two of the XuLA2's precious I/O pins.

And as a final thought, if you like the ZPUino and want to see more stuff like that, consider making a donation to support Alvie's development efforts. These things aren't magically placed under your pillow by faeries during the night; it takes hard work. A donation to Alvie tells him you value what he's doing and helps him keep doing it.

Current rating: 4.9


Comments

  • Marcelo Correa 5 years, 9 months ago

    Hi there,
    Is it possible to be used with a xula 200?

    Link / Reply
  • Dave Vandenbout 5 years, 9 months ago

    The ZPUino-2.0 uses a large chunk of the Spartan-6 LX9 FPGA, so I imagine it would not fit into the smaller Spartan-3A FPGA on the XuLA-200 without a bit of paring.

    Link / Reply
  • Francois Charbonneau 5 years, 5 months ago

    Hey Dave,

    Just wondering if you ever got around to working on the software to program the ZPUino via USB. I was very curious to see how you were going to implement it. I have been working on a similar idea the past few days, I got my design to accept sketches through your USB-JTAG interface by interrupting the ZPU processor core....basically the FPGA can switch between "programming" mode and "ZPU" mode with a custom instruction that I send. When it is in programming mode, I get access to all the resources using your standard sdram and flash controllers, then I can switch back to ZPU mode and the cpu reboots from RAM or from flash, whichever one I programmed. Anyway, that's how I decided to do it because I can get full access to the rest of my FPGA at will...and I no longer need the annoying FTDI cable.

    Essentially, that was the easiest way I found....without also having to modify the main branch, but I still can't wait to see your design, you're a much more skilled designer and I'll probably end up tossing my project!

    Keep us posted!

    Thank you for the excellent work as always.

    Link / Reply
    • Dave Vandenbout 5 years, 5 months ago

      Hi, Francois. Interesting concept! I hope you'll provide some links to it for others.

      I just published a blog post about providing terminal communications to FPGA designs (http://www.xess.com/blog/terminal-velocity/). This is the precursor to doing that for the ZPUino. Next blog post, I swear!

      Link / Reply

New Comment

required
required (not published)
optional

Recent Posts

Archive

2016
2015
2014
2013
2012
2011

Categories

Authors

Feeds

RSS / Atom