11.26.2008

Parallax Board of Education with Eee PC

I have a Board of Education from Parallax. I use it to program a Basic Stamp 2 microcontroller and perform various experiments in electronics. Today I figured out how to use it with my Eee PC 901. My BoE is has an RS232 port and I have a USB2RS232 adapter, so I can connect the programmer to my Eee PC via a standard USB cable. The adapter is handled by the usbserial kernel module, which is pre-installed to the default system, so I have to just load it as root:

sudo modprobe usbserial


The module creates the /dev/ttyUSB0 device file, but unfortunately the prorammer program looks for the /dev/bstamp device. So I have tweaked with udev to make it properly. I have created a custom udev rule file for this device. For that I have created the file /etc/udev/rules.d/10-custom.rules with this content:
# 10-custom.rules
# My own rules

# for the basic stamp programmer with rs232 - usb converter
KERNEL=="ttyUSB0", SYMLINK+="bstamp", GROUP="users", OPTIONS+="last_rule"

After that I have reloaded the udev rules like this:

udevcontrol reload_rules

And now, when I connect the programmer with thee USB cable, there is the /dev/bstamp device with the proper read/write rigths.
The next step is to install the programmer software. I use the BASIC Stamp Tools for Linux. I have downloaded from their site, and opened the archive. I have compiled the source with make, and installed with sudo make install
To install the proprietary tokenizer library from Parallax properly, I have done this as root:

echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

The previous installation put the tokenizer called libbstamptokenizer.so into the /usr/local/lib directory. These steps make it available for dynamic linking. So now I have two executables installed: bstamp_tokenize compile PBASIC language sourcecode, and bstamp_run download the compiled code to the microcontroller. An example session with compiling and code execution:

> bstamp_tokenize hello.bs2 hello.tok
PBASIC Tokenizer Library version 1.23
> bstamp_run hello.tok
Basic Stamp detected!Model: Basic Stamp 2
Firmware version in BCD = 16
18 characters transmitted
18 characters echoed
18 characters transmitted
18 characters echoed
18 characters transmitted
18 characters echoed
DEBUG OUTPUT: (Press [Control]-[C] to complete sequence)
_____________________________________________________________________
Hello world
Hello world
Hello world
___________________________________________________________________
Received [Control]-[C]!
Shutting down communication!

Success! So now I can use the Board of Education too continue my experiments!

1 comment:

Csaba said...

Update:

udevcontrol reload_rules

is replaced by

udevadm control --reload_rules