Zstar

Freescale ZSTAR

We have a Freescale Wireless Sensing Triple Axis Reference Design (ZSTAR). This is two boards connected by a radio. The reference design lists for about $100, we can probably get them for less.

MMA7260QT 3-Axis Acceleration Sensor

Using the Zstar

  1. Insert the CD, which will bring up a web page
  2. Read the ZSTAR Reference Design Demo Quick Start
  3. Plug the USB Device in
  4. When prompted for drivers, select Advanced and then browse to D:\Drivers
  5. I had to change my port to COM2
  6. To start the demo, go back to the web page that came up and click on ZSTAR GUI

Java and the Zstar

On the CD there is D:\ZSTAR_files\Java-games. See the README.txt file. The game runs on a simulator of a cell phone, which requires version 2.2 of the j2me: http://java.sun.com/products/j2mewtoolkit/download-2_2.html.

The application consists of a jar file that has many images and a few classes. The classes have been obfuscated, but jad, the Java Decompiler shows that c.class contains

   public static boolean a(int i1)
    {
        String s1 = "comm:com" + i1
                + ";baudrate=38400;parity=none;bitsperchar=8;blocking=off;autocts=on;autorts=on";
        byte byte0 = 0;
        try
        {
            a_javax_microedition_io_CommConnection_static_fld =
                   (CommConnection)Connector.open(s1);
            a_java_io_DataInputStream_static_fld =
                   a_javax_microedition_io_CommConnection_static_fld.openDataInputStream();
Presumably, we could write a Ptolemy actor to connect to the serial port and grab data.

Programming the Zstar

Programming the Sensor Board

ZSTARRM - Wireless Sensing Triple Axis Reference Manual says

3.4.3 BDM (Background Debug Mode) Connections
A J2 connector is a non-standard footprint primarily intended for in-factory programming and testing via “spring-needle” type of connections. The J2 connector carries all standard signals for Background Debug Mode communication so if required, one may solder wires and a standard 2x3 pins 2.54mm (100mil) pitch header for regular BDM re-programming. The pin numbering is shown on Figure 3-5

Chapter 5, "Software Design", of the ZSTARRM - Wireless Sensing Triple Axis Reference Manual discusses the Simple Media Access Controller (SMAC). See also the Simple Media Access Controller (SMAC) User's Guide

Zstar serial protocol

Section 5.4 of ZSTARRM - Wireless Sensing Triple Axis Reference Manual discusses the serial protocol.

  • To connect via Windows, use HyperTerminal
    • Start -> All Programs -> Accessories -> Communications -> HyperTerminal
    • In the New Connection window, enter any name and then hit OK
    • In the Connect To window, go to the Connect Using window and select your comm port, such as COM2
    • Change the Bits per second to 38400
  • Send a R, get an N back - Communication Handshake
  • Send a r, get an Z back - Getting a Z indicates that a Zstar is connected, not a Star.
  • Send a V, get back x,y,z data
    The PC sends the Values ‘V’ command, the demo responds with 6 bytes (or 9 bytes in 16-bit mode) in the following sequence: 'x', X-value, 'y', Y-value, 'z', Z-value, simply an ‘x’ character followed by the actual X-axis accelerometer binary value, then a ‘y’ followed by the actual Y-axis accelerometer binary value and a ‘z’ followed by the actual Z-axis accelerometer binary value. Since the ZSTAR demo caches the last (over the air)
    transmitted values, these values are immediately provided to the PC.
    * Send a @@v@@, get back x, y, z, buttons, raw temperature, raw bandgap.
    * Send an @@I@@, get back info (:source:)
    $Version: 1.0.41.0$
    $Date: Sep-5-2006$
    $Author: r30323$
  • Send a U, turn on debugging, send a u to turn it off.

There is a model in the eecs124 CVS repository as eecs124/src/zstar/ptolemy/ZstarDisplay.xml. This model uses Ptolemy II SerialComm actor to connect to the serial port and display the results.

  • Sometimes the model has "Actor not ready to fire".
    • Try rerunning the model
    • Use rV to put the device in Zstar mode and get back 16 bit data.

eecs124/src/zstar/ptolemy/ZstarPlot.xml will plot the data!

Multiple versions of the SerialComm actor.

The message is PortInUseException: Port owned by Ptolemy

Zstar problems

  • The data is unchanging.
    • Try rebooting.
    • Unplug and plug the USB back in. It may help to wait?
    • Try running the demo that comes with the model
    • Take the battery out and put it back in
    • Replace the battery, it is probably weak. This was our problem
    • See the freescale 8bit forum

Other programming resources

Other Local Wiki Pages