Enter the XMOS

XMOS XC-2Funny how time flies. It seems like only yesterday I was scrambling around grabbing books, spec’ing parts, and testing components for my MS thesis. In fact it’s been almost a year since I wrapped up my design for a six-DOF laser-based position sensing system. But last September, I was busy pounding my head against a Xilinx Spartan-3AN FPGA development board (and given its numerous header pins, this wasn’t particularly pleasant).

What I needed was an easy way to run four independent 32-bit counters at 100+ Mhz, to communicate with eight discrete serial ADCs, to perform multiple floating-point calculations, and to return all of the resulting data to a control PC using a single high-speed serial line.

I was told, and still believe, that this should be no problem for an FPGA like the Spartan-3AN. Unfortunately, prior to this project, I had no experience with VHDL, Verilog, or anything having to do with FPGAs or CPLDs (besides the blessed CompactRIO). So needless to say, I was having all sorts of weird problems. I started off coding just a single counter in VHDL. It measured the time between digital interrupts and returned a value via a parallel interface. The only problem was that, at high frequencies (above 150Mhz), it would occasionally return bad data. Well, I could go on and on about my troubles with this FPGA, but I’ll cut to the chase. I was running out of time and needed a solution fast. So, I posted on SparkFun’s forum asking for recommendations. One of the guys suggested I look into XMOS. I’d never heard of it before and sortof dismissed the idea at first. I mean, a quad-core microprocessor? That didn’t sound very helpful. But given its ability to handle 10ns pin events and to run an almost unlimited number of counters at 100Mhz, I convinced my advisor to spend $150 on the XC-2:XMOS XC-2And boy am I glad I did. Once I got to writing code for the XMOS, I was an instant fan. Just take a look at the specifications for this powerful chip (the XS1-G4):

  • Four processor cores providing 1600MIPs (at 400Mhz) and up to 32 concurrent, deterministic real-time tasks.
  • Up to 64 input/output pins (per XCore) that can be dynamically configured as input, output or bi-directional.
  • Each port provides 10ns timing resolution for precise interfacing.
  • Next-cycle event servicing from pins, communications or timers.
  • The XMOS-originated XC language extends C to support parallelism and real-time control.
  • 64KBytes single-cycle unified SRAM (per XCore) for code and data storage.

This device was unlike anything I’d worked with in the past. And yet, I could code it in C or the C-like XC language (which supports parallel processing). This fact is what really set my mind at ease. The only slight issue was the lack of standard hardware modules you’d find in most microcontrollers; the XS1-G4 has no built-in hardware to transmit serial data, measure analog inputs, or generate PWM signals. But hey, neither do FPGAs. The plus here is that the XMOS has so much horsepower, you can implement anything in software.

The XC-2 development kit I received even came pre-programmed with a fancy web server demo application. All I had to do was plug it into the network, attach the supplied 5VDC power adapter, and point my browser to the correct address. And of course, the good folks at XMOS provided source code for the entire project, plus code for a generic Ethernet interface, digital audio transmission, UARTs, and more. I also found the XMOS support forums to be very helpful. I was actually able to explain my problem to the support staff and have them detail how it could be accomplished with this development board. Plus, there’s now the XCore Exchange community of users.

Now I imagine this is starting to sound like a paid endorsement of XMOS. But let me assure you, it’s not. I’m just a satisfied customer. The XC-2 helped me finish my thesis work much sooner than if I were to have stuck with the FPGA. In the end, my sensors were able resolve positional changes of less than 1mm in all directions.


So at $150, the XC-2 may be a little bit pricey for most hackers. However, if speed and power are what you’re looking for, you should seriously consider it. The single-core, $99 XK-1 module (pictured above) may also be worth looking into. Multiple XK-1s can also be linked together. I may pick one up myself if I find a good excuse. :) Oh, and did I mention the development tools are free and unlimited? The package even includes a simulator so that you can try out your design without a device. You can download the tools for Windows, Mac, or Linux here. Have fun and let me know what you make!

This entry was posted in Work and tagged , , , . Bookmark the permalink.

One Response to Enter the XMOS

  1. Pingback: Tweets that mention Enter the XMOS | Non-Lexical Vocables -- Topsy.com

Leave a Reply

Your email address will not be published. Required fields are marked *