Search:  
Gentoo Wiki

HOWTO_Sun_SPOT_Mote


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
Wikipedia has an article on:
Sun SPOT

Contents

Introduction

The aim of this page is to setup a programming environment for the Sun SPOT on Gentoo.

Install

To work with the Sun SPOTs, the kernel driver is needed to communicate with them. The hald and dbus daemons must also be running. The correct versions of the Java jdk and ant must be installed.

Kernel modules

You need the cdc_acm usb modem module to communicate with the Sun SPOTs. In your kernel config make sure you have the following options set.

Linux Kernel Configuration: Enable USB modem support
Device Drivers --->
  USB support --->
    <M> USB Modem (CDC ACM) support

In /usr/src/linux/.config, this option is CONFIG_USB_ACM.

When you plug in your Sun SPOT, the device /dev/ttyACM0 should appear.

HAL and DBUS

You need the hald and dbus daemons running for the Sun SPOT sdk to be able to find the Sun SPOT device. Emerge sys-apps/hal and sys-apps/dbus. These must be started when the computer starts.

rc-update add hald default
rc-update add dbus default

Java and Ant

You need the Sun JDK and ant to be able to build the code for the Sun SPOT. Emerge dev-java/ant and dev-java/sun-jdk with the X and odbc use flags. This was tested with dev-java/ant-1.7.0 and dev-java/sun-jdk-1.5.0.15. You may get different results with different versions of these packages.

You must change your path to take into account the JAVA_HOME and ANT_HOME environment variables. Add this to ~/.bashrc.

File: ~/.bashrc
 PATH="$PATH:$JAVA_HOME/bin:$ANT_HOME/bin"
 export PATH
 

Sun SPOT sdk

Now we will install the Sun SPOT sdk. You need to insert the CD and run the setup jar.

mount /mnt/cdrom
cd /mnt/cdrom
java -jar ./sunspotsdkinstaller.jar

At the Installation Options step, make sure the "Sun SPOT sdk" and "Demos" boxes are selected. Click Install. A box will pop up telling you that you need to set your ANT_HOME and JAVA_HOME environment variables.

Note: This pop up message is not an error. It is just reminding you to set the ANT_HOME and JAVA_HOME environment variables.

After this, the Sun SPOT sdk should be installed to ~/SunSPOT/sdk. Demos of the software for the Sun SPOTs should be installed to ~/SunSPOT/Demos.

Upgrading the sdk

Note: This step is not critical. You may skip it if you want.

There are 3 versions of the sdk. Version 1.0 is called "Green", version 2.0 is called "Orange", and version 3.0 is called "Purple". It is recommended that you upgrade to Purple.

To do this, you need to use the Sun SPOT Manager. You must download this code off the Sun SPOT website and run it.

wget http://sunspotworld.com/spotmanager/SPOTManager.jnlp
javaws SPOTManager.jnlp

After the GUI pops up, and you get to the Sun SPOT Manager Tool screen, look on the right under "Available SDKs". Click on "v3.0 Purple (Latest Available)". Under that list, click on "Install". A new window pops up asking you to confirm your selection. Click "Install" again.

When you get back to the Sun SPOT Manager Tool screen, update the available Demos. Click on the "Demos" button. This brings you to a screen that lets you update everything in ~/SunSPOT/Demos.

After this finishes, exit the GUI.

Upgrading the bootloader on the Sun SPOT

The version of the bootloader on the Sun SPOT must be the same as that of the sdk. If these are not the same, you must install the correct firmware to the Sun SPOT. We will use `ant` to help us with this. Make sure your Sun SPOT is plugged in before you try this.

cd ~/SunSPOT/sdk/
ant upgrade

During this process, it may ask you to reset the Sun SPOT multiple times. Just press the small button on the bottom of the Sun SPOT.

Install a test application

We will try installing the Bouncing Ball application to test our Sun SPOT.

cd ~/SunSPOT/Demos/BounceDemo/BounceDemo-OnSPOT/
ant deploy

This may also ask you to press the reset button on the Sun SPOT. After this command is finished, press the reset button on the Sun SPOT once more. The LEDs will light up and you should be able to bounce a blue LED in between two red LEDs.

Help

When running as a VirtualBox guest, the cdc_acm device does not appear when you plug the Sun SPOT into the computer.

You must not enable EHCI USB support in VirtualBox. To turn this off, run the command VirtualBox and click on your virtual machine on the left side of the screen. Then click on USB on the right side of the screen. Finally, deselect "Enable USB EHCI Controller".

When upgrading the bootloader or installing an application to the Sun SPOT, it says to reset the Sun SPOT, but resetting it does nothing.

This can be caused if the bootloader of the Sun SPOT has somehow become corrupted. To work around this, you must run ant upgrade, but reset the Sun SPOT just before the program is searching for available Sun SPOT. This ways, the corrupt program will not get loaded onto the Sun SPOT.

Limitations

This has been tested on the x86 version of Gentoo. It is known not to work with 64-bit operating systems. See https://www.sunspotworld.com/forums/viewtopic.php?t=383&start=0&postdays=0&postorder=asc&highlight=elfclass64

External links

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Sun_SPOT_Mote"

Last modified: Fri, 05 Sep 2008 10:52:00 +0000 Hits: 431