For this part of the project all tools were made available by Freescale Semiconductor. A Development Kit was made available with 2 Demonstration Boards, Metrowerks CodeWarrior Special Edition software and all the necessary cables and connectors.
The two boards provided are exactly the same. The layout of the board is shown below.
Figure: The Demonstration Board Layout
In addition to the MCU this board has an XY accelerometer chip and a Z-accelerometer chip. These chips were not used for this project. The Maxim 3318E is a 2.5V powered RS-232 compatible transceiver. This chip is required as it allows communication between the board and a PC application.
LEDs on both boards were used but only the switches on the coordinator were utilised.
The figure below(Freescale, 2005) shows the dimensions of the antenna on the demonstration boards. If only all antennas (or antennae?) were so simple as to be wireless internet providers.
Figure: Printed Circuit Board (PCB) antenna dimensions
Background Debug Mode (BDM)
While there is a BDM port on the board, I was unable to obtain a BDM programmer. This meant that I had to use the serial port to flash the MCU. This was accomplished with the aid of Test Tool, described in section 3.5.7. Embedded Bootloader and Test Tool.
The MC9S08 GT60CFB, also referred to as the HCS08 microcontroller, is an 8-bit microcontroller from Freescale Semiconductor. According to the official press release in June of 2003 (freegeeks, 2004), the HCS08 MCU family was developed ‘for applications that sit idle for long periods of time yet must be able to power up quickly and operate at high performance levels upon demand’.
- Multiple power management modes, including a 20 nanoamp (nA) power-down mode
- A zero-component auto-wakeup from “stop” to help reduce costs and reduce power to 0.7 microamp (uA) – Up to 40 MHz CPU/20 MHz bus at 2.1 V and 16 MHz CPU/8 MHz bus at 1.8 V
- A programmable internal clock generator with temperature and voltage compensation (typical drift < 2%) designed for reliable communications, fast start up and reduced system cost
- In-application reprogramming and data storage via third-generation 0.25-micron flash technology
- High integration including four serial communication ports, up to 8 timer/ Pulse Width Modulators (PWM), and an 8-channel 10-bit analog-to-digital converter specified down to 1.8 V.
From the above features it is possible to see that the HCS08 is an ideal MCU for any ZigBee or IEEE 802.15.4 application.
MC13192 from Freescale Semiconductor
The MC13192 operates in the 2.4GHz frequency band and includes a complete packet modem that is compliant with the IEEE 802.15.4 standard. The device interfaces to the HCS08 MCU through a four-wire serial peripheral interface (SPI).
A system level block diagram of this is shown in the figure below.
Figure: System Level block diagram
Eight demonstration programs are provided on the Freescale website and these are suitable for both the coordinator and device. They focus on showing how to develop an IEEE 802.15.4 compliant application. Example 1 is a very basic program and each subsequent example builds upon the previous one. Example 8 provides an application that implements security and beaconing as well as communication with the UART.
Other example code was provided by Freescale, using a Simple MAC (SMAC). Although it has come of the IEEE 802.15.4 MAC features, it is not compliant IEEE 802.15.4.
Header files were provided in addition to the demonstration code. The code supports many Freescale kits and is often updated by the developers at Freescale. For the duration of this project I had to compare all of the 27 header files each time an update was provided. Some errors in the code were discovered by myself and corrected. As soon as I had a working application I no longer updated my code when there was an update to the source/header code.
There was no online support from Freescale for the demonstration boards or for the code. Any difficulties encountered were solved either by myself or, if I was lucky, on a discussion board where someone else had already encountered the same problem. There is no version control in the code they provide and so there was no way to tell what part of which files they update.
Two libraries are provided by Freescale – the PHY library and the MAC library representing the PHY and MAC layers of the IEEE 802.15.4 standard. These libraries are constantly changing as the developers make additions and corrections to the code. I started the project with version 1.051 and finished with version 1.056.
Source code of the PHY library is provided for flexibility in using the different demonstration and evaluation kits from Freescale.
No source code is provided for the MAC library. This means that the only development environment that I was able to use was Metrowerks CodeWarrior. The table below shows the size of the different MAC libraries, depending on the node type.
Table: MAC libraries for different node types
In this project the FFDNBNS library was used for the coordinator node and the RFD library was used for the device node.
Metrowerks CodeWarrior Development Studio
The version of CodeWarrior provided is the Special Edition, and is specifically for the HCS08. I used both Rev 3.0 and Rev 3.1 and found no difference between features I used.
By registering the copies of CodeWarrior that I had I was able to obtain a free license. This license allowed 16K of code to be compiled. However, there is a restriction of 32 files per project. Initially this was a problem as the demonstration programs contain more than this. I was able to reduce the number of files by deleting those that I did not need for this project and by combining some of the smaller header files.
I was still unable to compile the demonstration code but was successful in compiling some of the SMAC examples. This is not what I needed and using MAC libraries with a size of 21k and 29k, a 16k license was useless. I began looking towards other development environments like the Imagecraft ICC08 and the Cosmic Software HCS08 tools before discovering that I could only use the provided MAC libraries with CodeWarrior.
Eventually I was able to attain two 30-day full-version evaluation licenses for CodeWarrior, allowing me 6 weeks to complete this part of the project.
The programming language used was C.
Embedded Bootloader and Test Tool
Embedded Bootloader is located in a protected 4kB flash block in the highest memory area (0xF000-0xFFFF) of the HCS08. A BDM debugger is required to erase the Embedded Bootloader – this helps to prevent accidental erasure.
The Embedded Bootloader provides a way to flash the MCU and was especially helpful since I did not have any BDM tools. Test Tool is a program that utilises the Embedded Bootloader, allowing programming of the MCU via the serial port. This is provided on the Freescale website and also comes in a command prompt version.
The only requirement is a PC with a serial port, running Windows 2000 or XP.