0 comments Wednesday, January 26, 2011

XMOS Bit Scheme will presented at FOSDEM 2011.

The presentation takes place February 5th at 14h00 and is titled "Advanced Experiments with XMOS Multicore Embedded Hardware."

Embedded systems handle signals from the outside world using either polling or interrupts. While polling is resource consuming, interrupt-driven approaches can introduce bugs which are subtle and difficult to debug. This talk discusses our experience on porting the Scheme programming language to a new event-driven architecture and programming style developed by the XMOS company. The architecture's hardware support for multithreading enables an event-driven style for programming embedded systems which does not suffer from the drawbacks associated with the use of polling and interrupts. To accomplish this, the thread support is implemented in hardware. Each thread has a dedicated set of registers and is assigned a guaranteed amount of CPU cycles. We first describe how we ported a Scheme interpreter to this new architecture. We exploit the multi-threaded nature of this architecture by running multiple interpreters in parallel, concretely one interpreter on each core. In addition, we extended each interpreter with abstractions to manage this concurrency and to exploit features specific of the XMOS hardware. Such abstractions include sending messages between interpreters over channels. Concretely, our effort enables an event-driven style for programming multi-core embedded systems in Scheme. We show how the XMOS architecture helps the programming in overcoming the difficulties associated with polling and interrupt-driven approaches.

0 comments Sunday, October 3, 2010

XMOS Bit Scheme has won the "Project Of The Month" award on XCore.com!

0 comments Monday, September 13, 2010

The XMOS BIT Scheme code is now available on XCore Exchange (under the GPL3 license)!

0 comments Sunday, September 5, 2010

I've recently finished my thesis titled "Implementing Concurrency Abstractions for Programming Multi-Core Embedded Systems in Scheme" in which I've ported Bit Scheme to the XMOS platform. During the project, I switched from the XMOSlisp, mentioned before to Bit Scheme which contains much functionality.

In the following movie you can see a demo application written in Scheme running on an XK-1a development board. This board performs a red-green LED and communicates with another board via XBee. You can find a bit more information about this demo in the presentation below.



I've also uploaded the slides of my defense online in order to show the basic usage of the XMOS Bit Scheme interpreter.

0 comments Monday, March 8, 2010

The XMOSlisp code is now available on xcore.com
http://xcore.com/projects/xmoslisp
Since the last blogpost, a simple garbagecollector has been added too.

0 comments Sunday, February 28, 2010

Intro

Recently I've made progress on having an interpreted language running on the XMOS chip. I've found a small (but incomplete) lisp interpreter which fits in and runs with the limited memory of the chip. By using an interpreted language, programs can be run on the XMOS chip without the need for compilation. Unfortunately it doesn't contain a garbage collector (at this moment), meaning that an inevitable crash awaits a lot of the programs.

Examples

Primitives for ports and timers are added to allow various IO operations.
For example turning some leds on, on the development board:

(pout clockled0 15)

This function returns the value set (in this case 15), allowing to chain multiple outputs:

(pout clockled0 (pout clockled1 (pout clockled2 15)))

Input is also supported using the following methods:
  • simple read: (pin button)
  • pin equal: (peq button 12)
  • pin not equal: (pne button 15)
These methods obviously return the value read from the port allowing combinations like:

(pout clockled0 (pne button 15))

There is also support for timers. These evaluate to an integer value similar to the way they are used in XC. That way delays can easily be created by doing:

(after (+ (timer) 100000000) value)

Using these timers the following demo was made. It is a function which is called recursively generating a small animation using the LEDs on the development board. The initial value (being 1) is multiplied by two on every function call, effectively shifting to the next led. The "mod 15", keeps everything in range.

((lambda x (apply (car x) x))
 (lambda (f n)
  (f f
   (after (+ (timer) 20000000)
    (% (* 2 (pout clockled0 (pout clockled1 (pout clockled2 n)))) 15)
 )))
 1
)

Due to the lack of a garbage collector and the use of recursion, it will run out of memory after about 10-15 seconds.





Parallellism

At this moment there is no way to use the multithreading in the XMOS chip using the lisp interpreter.

0 comments Thursday, December 3, 2009

I've recently worked on using XBee(Zigbee) modules for doing wireless communication with the XMOS XC-1 development board. As you may have noticed on the photo, I'm using Arduino breakout boards. These do the  voltage conversions from 5 to 3.3 Volt. One of them is directly connected with the XC-1 using a breadboard. The other one is plugged in an empty Arduino board. Its jumpers are placed to USB mode to enable direct IO with my PC.



On the XMOS chip runs a program which allows to set the clock leds to different shades of orange (varying from red to green actually). Therefor it reads commands from the XBee module, logically being 'r' and 'g'. In the video below you can see how it looks like:







This is how it works behind the scenes:



On the PC side, the XBee module appears as a serial device thanks to the FTDI chip on the Arduino board. When typing a command ('r' or 'g'), it is automatically sent in ascii by the XBee. The other module receives it and sends it to the XMOS chip. This one supports 10 colors ranging from green (value zero) to red (value 10). When the XMOS chip gets a command it will calculate the new value and send it back to the PC via the wireless connection.
The XMOS chip will drive its red and green leds according to the value mentioned above. For example, value 4 means that red will be on for 4 ms and green for 6 ms, creating a shade of orange.