Saturday, May 14, 2011

SWAPping packets with my ez430-Chronos


It's been a while since my last post, mainly because I've been working on things that may not be really interesting for the readers of this blog, such as improving the Java library and developing a first version of the opnode panTastic server – and I mean “server”, it still lacks the necessary communication clients in order to do the application really usable.

But finally, I've found the time to work with my new ez430-Chronos kit (868 MHz). As I explained in a precedent post, I had the idea to integrate the Chronos watch into the panStamp ecosystem. This desire has led me to develop a SWAP extension for the Open Chronos platform, on top of the existing MRFI (Minimal Radio Frequence Interface) stack. The availability of the MRFI API has enormously simplified my work since it provides the necessary functions to send and receive wireless packets. However, I've had to tweak this API a bit in order to make it usable with custom protocols, not only with SimpliciTI.


Figure 1: ez430-Chronos kit

My custom ezChronos application is based on the Open Chronos project, an open source implementation of the original Texas Instruments sources, that can be compiled using the open MSPGCC4 compiler. As for the flashing procedure, I'm using MSPDEBUG as serial uploader through the provided USB programmer.

Figure 2: programming the Chronos watch serially

One of the great things about the Chronos is that panStamps can natively communicate with it using FSK and GFSK modulations with all the packet smartness enabled at both ends. CC430 MCU's and CC11XX radios share a common packet structure so the communication between these families of IC's is done quite straightforward.

In my opinion, anyone wanting to develop his own protocol for the Chronos has previously to learn about how the SimpliciTI stack is implemented and how this stack is anchored to the existing display menus. When I started this development I thought that the menu interfaces were a bit more protocol-agnostic that they really are. In fact, I've had to surgically replace some of the current dependencies with the SimpliciTI stack with custom functions that do more or less the same but without the initial stack calls.

Back to the interesting things, porting SWAP to the Chronos platform has been very simple. I'd even say that replacing SimpliciTI by SWAP has saved some Kilobytes of flash so I've finally gained some additional space for the new data browser.

Figure 3: simple benchmark

The above diagram shows the components used in a simple test. The Chronos watch receives and stores temperature and humidity values sent from the humidity&temperature panStamp whilst the PC+modem set is used during configuration only. In fact, everything in the Chronos, including the data pages to be displayed, is configured wirelessly through the use of configuration registers. Again, the basic philosophy of the SWAP protocol, where everything can be represented in form of addressable registers, has vastly simplified things in this development. From the PC, I only had to send a SWAP command addressed to a given configuration register (one per SWAP data page) that simply sets the origin of the data to be displayed, a basic text label and some transformation operands. Then, the watch basically listens for incoming SWAP informations and refreshes the internal data pages when necessary.

Figure 4: Some custom SWAP pages

As you can see, the bottom line of the display, initially reserved for labelling each SWAP endpoint, has some obvious limitations. It's a 6-digit 7-segment area so before writing any text onto it, anyone has to decide which label fits best these limitations. Anyway, for the above test I just wanted to identify each endpoint with some basic alphanumeric identifiers: “hu 1” for Humidity 1 and “tE 1” for Temperature 1.

Anything else? What is this custom application supposed to do apart from displaying external SWAP data? Well, the new Chronos firmware includes pretty much the same functionality than the stock firmware:

  • Date and time
  • Time alarm
  • Stopwatch
  • Temperature sensor
  • Pressure sensor and altimeter
  • 3-axis accelerometer

Moreover, my current implementation updates an internal SWAP register with the values extracted from the temperature and pressure/altimeter sensors. Thus, anyone may query this register wirelessly whilst the SWAP mode is active on the Chronos. I wanted to do the same with the accelerometer values but then I realized that the initial TI approach is much more usable so I'll surely work on developing a similar function using SWAP instead of SimpliciTI. Once completed, this feature will let us manually release a continuous stream of xyz-accelerometer data for any third-party application wanting to exploit (or simply plot) these data.

So... what's next? Some of the above features need to be improved but, apart from that, I still need to solve some issues regarding the consumption on the Chronos and the way the watch stores data after each configuration. I also need to decide the amount of custom pages available on the watch and the way the external endpoints may be controlled from the Chronos. I'll initially work on controlling some binary switches from the up-down buttons but later I'll probably want to control analog setpoints or even RGB data. Finally, I'll want to extend the SWAP device management tool to configure the Chronos from one of its graphical windows instead of having to send the configuration commands manually from a serial console.

I'll try to document these progresses and much more in future posts so please... stay tuned for the next.

No comments:

Post a Comment