Parallax Propeller Chip Overview

Ahh the propeller chip, something I have a love/hate relationship with.
I've worked with the BASIC Stamp for about 10 years now and have been
working with the propeller chip for about the last 6 months. The two are
very different. As for the propeller chip, it is in no way a beginners
chip. Having experience with any microcontroller is pretty much a must
before moving on to the propeller chip. This is partly because Spin, the
programming language you would normally use with the propeller, is
rather unusual. You may think that with both the BS2 and the propeller
coming form the same company that they would have lots in common, but
you would be wrong. What you have learned on the BS2 though makes moving
on to other microcontroller easier. The real question is, is the
propeller chip right for what you want to do.

Having spent some time with the propeller and seeing that it is new to a
lot of the ChiBots members I'll spend some time looking at what I see as
bad and good about the chip. First off. it is a very interesting
The basic specs are:
32 I/O pins four are used for programming and boot but can be used as
general I/O after that
32KB RAM (program and variable storage)
32KB ROM (SPIN interpreter, character set storage, Log tables and the like)
8 processors called Cogs
internal or external clock speeds from 20KHz to 80MHz (no the K in 20KHz
is not a typo)
3.3 Volt
Comes as a 40-pin DIP or 44-pin surface mount chips

The 8 cogs is the part that attracted my attention, it has some real
advantages but maybe isn't all it seems. It's not like having 8 BS2s,
more on this later.

The chip can be programmed in two languages, assembly and Spin. The
assembly language is pretty typical other than it includes commands for
controlling the cogs. Most people will work in Spin though. Spin is
unlike any other programming language and at the same time like many
other programming languages. The creator took what he though was the
best parts of many other languages. You use indents like python to
control flow, assignments use := like Pascal and it goes on and on.

Spin is a very simple language in the RISC way. All the commands are
very simple in what they do. If you are use to the BS2, gone are things
all the "higher" level control type things. What you have is something
between assembly and BASIC, I'm still not sure if this is good or bad,
it just is what it is. This is combined with the hardware end of the
chip that has no real PWM, UART, interrupts, ADC, or timers per se. You
build up serial communication, PWM, VGA drivers, TV drivers, all from
simple program objects. Fortunately many of these objects have been
created for you and can be used without understanding just how that
object works. All in all this way of doing things works, it just takes
looking at the problem in a new way.

The Spin objects can be used like black boxes or changed to suit you own
needs. An example of this is the collection of BS2 functions. This
object lets you add many of the BS2s commands as objects in Spin. They
all work pretty much as type do with the BS2. This object is something
like 1KB in size though and you may only be using one or two of the
functions. If I need just a SEROUT command you can take just that part
of the object code out and use it in your program.

The cogs are one of the more interesting parts of the chip. They are
truly independent processor all with assess to the same I/O pins and in
some ways the same memory. Access to the I/O pins must be managed by the
programmer as you can simply have eight cogs trying to output to the
same pin. For the most part memory access is controlled by the Spin
language, but there are ways of getting to any part of memory from any
cog at any time, so you have to use some care if you go out of your way
to access memory directly.

Here is what I see as the strong and the weak of the chip.

The lack of any really good debug system is the chips biggest problem.
There is no debugger in the editor, or at all for that matter. With the
BS2 you could at least plug a DEBUG statement into the code anywhere you
want and get a value out of any part of the code. With the prop chip you
have to use a serial object to output to a pin, and then use something
like Hyper Terminal to see the result. Because this is so clumsy you
almost have to hook the chip up to a dedicated VGA monitor or a small
LCD TV screen. This does work okay though and there are full object
included that support both.

The cogs are good but gone too fast. The cogs are really nice, you can
really have one cog receiving and parsing a GPS, one cog watching
sensors, another calculating location, and another controlling the
motors. You may think that 8 would be more than you would ever need, but
they go really really fast. For example to read and display data from a
GPS you may need four cogs. The first cog is the control program
handling all the traffic and basic program logic. The second cog is is
the TV or VGA control object. The third cog is the GPS parser. And the
forth cog is the serial control object for the GPS connection. If you
need to complex floating point math there is another cog as a FPU. As
you can see they can go fast. Fortunately you can share the cogs to some
degree. In this example you can use the TV or VGA for all display, and
because the GPS serial is slow you can bit bang the serial in the same
cog that does the parsing, but you get the idea. You still have to be
smart with resources.

The documentation is good but could be better. The manual is 400+ pages,
there are over 150 pages of tutorials other than the manual available.
But for example with all of this, there isn't any real mention of how to
do full floating point math, even though there is a package of math
objects from Parallax. A page of real examples would have been helpful.
I think the problem stems from the fact that this chip isn't intended
for beginners and the object needed to do may things are not really
built in. You're expected to understand how IEEE-754 standard math is
done, or at least to know where to find out how.

Having to interface the 3.3 volt prop chip with 5 volt sensors isn't as
bad as it could be, but it is one more thing to think about each time
you wire something.

The price is okay for a powerful chip, $12 for a single, cheep by
Parallax standards. There is a nice dev board for $20 but it needs a
special USB to serial converter that fits the board for $25 or so.

All in all it is a very interesting option for a robot, and I think the
8 cogs push it into the "should at least think about it" side of the
equation. Just don't expect it to be a simple plug it in a push the
button thing.

Mike Davey