Back to the roots with StickOS(TM)

Remember the times when home computers had only a BASIC interpreter?

You can have this feeling back, combined with the speed of a modern microcontroller by using StickOS.

The link is here:

http://www.cpustick.com/

What is it?

It’s not only a basic interpreter with a serial terminal user interface, it’s an embedded programming environment with editor, transparent BASIC compiler, debugger, profiler, flash filesystem, communication interfaces, USB client and host,

analog I/O, servo control, interrupts, timers, etc.

It has tons of nice features, like direct pin manipulation, I2C and SPI routines, firmware update via terminal, support for ZigBee modules, etc.

Supported micros are Freescale 8, 16 and 32 bit variants and PIC32.

Here you can see my PIC32 board that runs StickOS:

Up to now nothing more than the micro on a converter board, a USB connector for power and communication, a 3.3V regulator, and a heartbeat LED.

The interesting things happen inside.

When you connect it to a computer’s USB, it enumerates as a virtual serial port (CDC).

Linux and MacOS should detect it immediately, Windows needs an .inf file that you can download from the StickOS site.

Once connected, you should see this welcome message (after pressing enter):

Welcome to StickOS for Microchip PIC32MXx-F512L v1.80c!

Copyright (c) 2008-2010; all rights reserved.
http://www.cpustick.comsupport@cpustick.com

(checksum 0x7ae)

The ‘help’ command gives a first overview about the possibilities:

help
for more information:
help about
help commands
help modes
help statements
help blocks
help devices
help expressions
help strings
help variables
help pins
help zigflea

Let’s have a look at the ‘pins’ command:

> pins
heartbeat re0
safemode* re6
qspi_cs* re1
clone_rst* none
zigflea_rst* re2
zigflea_attn* re3
zigflea_rxtxen re4

Heartbeat maps the heartbeat LED. When StickOS is in idle mode, it blinks slowly, when a program is running, it blinks faster.
Now lets remap it to something else:
pins heartbeat ra0

The LED on re0 stops blinking. This setting is permanent, The micro remembers it even if power is removed.

Now let’s do some pin manipulation:
> dim led as pin re0 for digital output
> let led = 1
>

The LED is lit!

> let led = 0
LED is off!

The interesting thing is, if you turn off the terminal prompt (‘modes prompt off’), you can use the StickOS board as a USB I/O board for your PC, just by sending BASIC commands and getting the results back.
Even using the SPI, I2C, driving servos, measuring voltages, manipulating controller registers is possible!

Let’s now write some code. The unavoidable blink program.
> 10 dim led as pin re0 for digital output
> 20 while 1 do
> 30 let led = 1
> 40 sleep 100 ms
> 50 let led = 0
> 60 sleep 600 ms
> 70 endwhile
> save blink

Beautiful, isn’t it? Those were the days…

The “save” command saves the program to the internal flash of the micro.
You can list the saved programs by typing ‘dir’ and load one of them with ‘load ‘.

One word about speed.
One may think that BASIC is necessarily slow.
It isn’t. This is a BASIC compiler that feels like a BASIC interpreter, and the PIC32 is damn fast.
I’m pretty sure that a PIC32 with StickOS outperforms most 8 and 16 bit micros with native code.
Also, PIC32 micros are surprisingly cheap, so there’s no need to buy 8 bit micros anymore, especially not for the hobbyist.

I think that StickOS is a very good thing. It’s easy enough for beginners and it’s powerful enough for pretty things that you would otherwise use an arduino or another 8/16 bit micro for.

BTW: This board is also compatible to Pinguino / Chipkit(TM).

About these ads
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

3 Responses to Back to the roots with StickOS(TM)

  1. Steve Scutt says:

    Hi. My name is Steve. I am also a fan of Rich Testardis Stickos. I currently have two Freescale DEMOJM boards running stickos and have made two zigflea boards fit onto the DEMOJM with perfboard. I have been doing some experiments with wireless MIDI and have had some success. Stickos is great. I would like to ask, how did you burn the Stickos environment onto your PIC32 chip. The reason I am asking is because I have 2 PIC32MX440512H 64 pin TQFP chips arrivng soon and would like to implement them with Stickos so I can make some boards from scratch (LIKE YOU!!)
    Any info would be very much appreciated.
    Again, thanks and love your work,
    regards,
    Steve.

    • uhrheber says:

      Steve,
      I used this nice TQFP adaptor board from ebay, that has a PICKit compatible programming header. I used a PICKit2 to flash StickOS. But you should better buy a PICKit3, because the 2 doesn’t support the new MX2 micros.
      But I also managed to flash PIC32′s via JTAG, using OpenOCD and a USB Jtagger.
      It’s been reported that this even works with a parallel port wiggler clone.
      Also cheap Altera USB blaster clones should work.

  2. Guido says:

    Hi,
    I did buy a CUI32 Board and a Chipkit Uno32 for testing StickOS (Now 1.92) and a Chipkit Uno32.
    The Basic is fine and easy. Another fine boards are the Duinomite which good itself a fine Basic and more connectors AND could be programmed to execute StickOS.
    see http://www.cpustick.com/forum1/viewtopic.php?f=3&t=43
    And the boards are cheap like from watterott.com . The minimal board for breadboard is the PIC32-T795H at http://www.watterott.com/de/PIC32-T795H which comes with Duinomite-Bootloader…somebody should check if it also can run StockOS :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s