Wireless Sensing Triple Axis Reference design (ZSTAR) Designer Reference Manual ZSTARRM Rev. 0.9 8/2006 freescale.
USA: This device complies with Part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference Canada: This Class [*] digital apparatus complies with Canadian ICES-003. Cet appareil numériqué de la classe [*] est conformé à la norme NMB-003 du Canada.
Wireless Sensing Triple Axis Reference design Designer Reference Manual by: Pavel Lajšner and Radomír Kozub Freescale Czech Systems Laboratories Rožnov pod Radhoštěm, Czech Republic To provide the most up-to-date information, the revision of our documents on the World Wide Web will be the most current. Your printed copy may be an earlier revision. To verify you have the latest information available, refer to: http://www.freescale.
Revision History Wireless Sensing Triple Axis Reference design, Rev. 0.
Table of Contents Chapter 1 Introduction 1.1 1.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 MMA7260Q 3-axis Accelerometer Sensor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Chapter 2 Wireless Sensing Triple Axis Reference design introduction 2.1 2.2 2.2.1 2.2.2 2.2.3 2.2.4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3 MC13191 to MCHC908JW32 microcontroller interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . Oscillator and clocking options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LED indicators connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Button connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5.1 5.5.2 5.5.2.1 Bootloading procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Dualboot guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Dualboot applications switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Chapter 6 Application Setup 6.1 6.1.1 6.1.2 ZSTAR Installation Procedure . . . . . . . . . . . . . . .
Table of Contents Wireless Sensing Triple Axis Reference design, Rev. 0.
Chapter 1 Introduction 1.1 Introduction This paper describes the design of a Wireless Sensing Triple Axis Reference design (ZSTAR), a demo for wireless demonstration of the 3-axis accelerometer MMA7260Q sensors from Freescale. The reference design will enable you to see how Freescale's accelerometers can add additional functionality to applications in various industries.
Introduction Wireless Sensing Triple Axis Reference design, Rev. 0.
Chapter 2 Wireless Sensing Triple Axis Reference design introduction 2.1 Introduction The Wireless Sensing Triple Axis Reference design (ZSTAR) has been designed as a wireless complement to the previous STAR (Sensing Triple Axis Reference design) RD3112MMA7260Q demo. A 2.4GHz radio-frequency (RF) link based on the low-cost MC13191 family is used for connection from the sensor to PC, allowing the visualization of key accelerometer applications.
Wireless Sensing Triple Axis Reference design introduction MC13191 MC13191 S08QG8 HC908JW32 MMA7260Q Figure 2-2ZSTAR Block diagram 2.2 Featured products This demo consist of several Freescale products whose main features are listed below. 2.2.1 Triple Axis Accelerometer MMA7260Q The ZSTAR board is a demonstration tool for the MMA7260Q, a 3-Axis Low-g accelerometer.
Featured products emulation interface. It also features a programmable 16-bit timer/pulse-width modulation (PWM) module (TPM), that is one of the most flexible and cost-effective of its kind. The compact, tightly integrated MC9S08QG8 delivers a versatile combination, from wealth of Freescale peripherals and the advanced features of the HCS08 core, including extended battery life with a maximum performance down to 1.8V, industry-leading Flash and innovative development support.
Wireless Sensing Triple Axis Reference design introduction – – – – – 16-bit, 2-channel timer interface module (TIM) with selectable input capture, output compare, PWM capability on each channel, and external clock input option Timebase module PS/2 clock generator module Serial Peripheral Interface Module (SPI) Universal Serial Bus (USB) 2.
Chapter 3 Sensor Board description 3.1 Board overview The Sensor Board utilizes a small footprint size dual-layer printed circuit board (PCB) containing all the necessary circuitry for MMA7260Q accelerometer sensing and transferring data over a radio frequency (RF).
Sensor Board description SPI receive antenna CR2032 or CR2477 Lithium battery MC9S08QG8 MCU IRQ MC13191 2.4GHz RF transmit antenna XYZ sleep g-select MMA7260Q accelerometer Figure 3-2Sensor board block diagram Figure 3-3 shows in more detail, how different software and hardware modules co-operate with each other.
A/D conversion of XYZ levels MC9S08QG8 software calibration data ZSTAR RF protocol handler Sensor data SMAC Analog-to-Digital converter (ADC) module GPIO IRQ Serial Peripheral Interface (SPI) module sleep MMA7260Q g-select MC13191 Figure 3-3ZSTAR Sensor board software overview For the Sensor board operation, several of the MC9S08QG8’s hardware modules are used: Analog to Digital Converter (ADC), Synchronous Peripheral Interface (SPI), External Interrupt Request module (IRQ) and General Purpose I
Sensor Board description is measured 128 times. By default, POWSUM is 0, for 1 measurement of each channel. Before result values are provided, the accumulated values are scaled back to the 8-bit range and inverted where necessary (may be required depending on the physical MMA7260Q device orientation relative to the Earth gravity). Raw (i.e. not calibrated) values are actually sent, the calibration and calculation of an exact g value is done internally in the PC software. 3.2.
Power management • 8-bit microcontroller MC9S08QG8 – in Stop mode, 750nA – in Wait mode, 1mA – in Run mode, 3.5mA • low-g triaxial sensor MMA7260Q – in Sleep mode, 3µA – in Normal mode, 500µA It is obvious that in a battery operated application care must be taken to ensure the lowest possible current consumption, especially when the maximum current (provided by the battery) is somehow limited. A CR2032 Lithium battery cannot provide current in the range of 40mA for long periods of time.
Sensor Board description The reception window is larger to fit any incoming receive data and the current consumption is also higher during reception, so this portion of current consumption would be one of the largest if the acknowledgment was received in every loop cycle. The “optional receive” feature allows huge power savings, still keeping the reception of acknowledgment data from the data-receiving side.
ZSTAR Sensor Board hardware overview 3.4 ZSTAR Sensor Board hardware overview This section describes the Sensor board in terms of the hardware design. The MC9S08QG8 microcontroller drives both the MMA7260Q sensor and the MC13191 RF transceiver. 3.4.1 Analog connections The MMA7260Q sensor is connected to AD0, AD1, and AD2 inputs to analog-to-digital converter via RC filters formed by R3, C3, R4, C2, R5, C1.
SLEEP g-Sel2 g-Sel1 + 10k R5 13 C11 10nF GND VDD C12 10nF GND D1 LED GND VDD LED2 GND C8 6.8pF GND C9 6.
ZSTAR Sensor Board hardware overview 3.4.5 Button connections Two buttons (S1 and S2) are connected directly to pins PTB6 and PTB7. Both have internal pull-up resistors, but are not part of the Keyboard interrupt module, therefore don’t allow a direct microcontroller wake-up from the Stop modes. 3.4.6 MC13191 to MC9S08QG8 microcontroller interface In order to fit all the necessary circuitry onto a 16-pin microcontroller, the full recommended MC13191 interface has had to be reduced.
Sensor Board description Figure 3-7ZSTAR antenna layout The matching is provided by L3 (transmit antenna) and L4 (receive antenna) coils. L1 and L2 coils bias the transmitter output transistors to the VDDA level. The inductors used in this design are from TDK: L3 (5.6nH) MLG1608B5N6DT L4 (4.7nH) MLG1608B4N7ST and L1, L2 (22nH) MLG1608B22NJT. 3.4.
ZSTAR Sensor Board hardware overview 3.4.10 Power supply The Sensor board is powered by a Lithium coin-sized battery. The primary choice was the popular CR2032, with a PCB layout provision made for the CR2477 size. This bigger battery holds roughly 4 times more charge (~1000mAh), but it is not as popular as CR2032 size. A surface mounted SMTU series battery holder from RenataTM is placed on the underside of the PCB.
Sensor Board description 3.5 Bill of Materials Table 3-1. Sensor board bill of materials Item Quantity Reference Part Manufacturer Manufacturer order code 1 1 BATT1 battery holder CR2032 Renata SMTU 2032-1 2 3 C1,C2,C3 100nF TDK C1608JB1H104K 3 1 C4 100pF TDK C1608CH1H101J 4 7 C5,C6,C7,C10, C11,C12,C13 10nF TDK C1608CH1E103J 5 2 C8,C9 6.8pF TDK C1608CH1H070D 6 1 L3 5.6nH TDK MLG1608B5N6DT 7 1 L4 4.
Chapter 4 USB stick board description 4.1 Board overview The USB stick board utilizes the same small footprint as Sensor Board is also a dual-layer printed circuit board (PCB). It contains the minimalistic design of the MC13191 RF transceiver connected through an 8-bit MCHC908JW32 microcontroller to the USB. It’s main task is to receive data from the Sensor Board and transfer it to the PC over the USB link.
USB stick board description +5V USB voltage regulators USB SPI receive antenna MCHC908JW32 MCU IRQ ATTN RST RXTXEN MC13191 2.4GHz RF transmit antenna +5V USB Figure 4-2USB stick board block diagram Figure 4-3 shows, in more detail, how different software and hardware modules co-operate with each other.
Board overview MCHC908JW32 software Sensor & Button data simple STAR protocol handler ZSTAR RF protocol handler “virtual serial port” or mouse USB protocol handler SMAC low-level USB protocol driver Serial Peripheral Interface (SPI) module KBI GPIO USB 2.0 Full Speed module MC13191 USB connection to PC Figure 4-3ZSTAR USB stick board software overview For the USB stick board operation, several MCHC908JW32 hardware modules are used: USB 2.
USB stick board description 4.2 ZSTAR USB stick Board hardware overview This section describes the USB stick board in terms of the hardware design. The MCHC908JW32 microcontroller drives the MC13191 RF transceiver and communicates over USB with PC. 4.2.1 USB connections Two USB communication lines are connected directly via R1 to PTE2/D+ and R2 to PTE3/Dmicrocontroller pins. There, the R1 and R2 resistors define the output impedance of both drivers (ZDRV as per chapter 7 of the USB 2.0 specifications).
ZSTAR USB stick Board hardware overview Enable Operation - Enable pin of 3.3V regulator (for MC13191) is connected to PTC3 pin of the microcontroller. This way, the microcontroller may completely turn off the RF part of the application to minimize power consumption in USB suspend modes. Alternatively, power down of the MC13191 RF transceiver may be done by forcing it into Off mode by pulling the RST pin low. 4.2.
USB stick board description 4.2.6 Button connection One button is implemented on the USB stick board. It is connected to the IRQ microcontroller pin that has internal pull-up and allows an easy software interrupt. 4.2.7 MON08 interface For MCHC908JW32 in-circuit programming, a MON08 interface is required. Several pins must be connected to specific voltage levels in order for the MCHC908JW32 to enter the Monitor mode. The details are described in the MCHC908JW32 datasheet, Chapter 7 Monitor ROM (MON).
C10 2n2 R6 1k VDD VDD VDD 1 GND LED D3 LED D2 LED D1 GND 560 560 R4 R5 3 5 GND R7 1M OSC1 1 MRESET MIRQ GND RxD IRQ VDD36 PTA0 Q2 Murata CSTCR6M00G53 2 560 R3 MIRQ Q3 EPSON-SG310 4.0MHz OSC.
USB stick board description 4.3 Bill of Materials Table 4-1USB stick bIll of materials Item Quantity Reference Part Manufacturer Manufacturer order code 1 5 C1,C2,C3,C5,C6 10nF TDK C1608CH1E103J 2 2 C4,C7 100pF TDK C1608CH1H101J 3 2 C8,C9 6.
Chapter 5 Software Design 5.1 Introduction This section describes the design of the ZSTAR software blocks. The software description comprises these topics: • SMAC (Simple Media Access Controller) modifications description • ‘Air’ ZSTAR RF protocol protocol description • Serial STAR protocol and ZSTAR extensions (over USB) protocol description • AN2295 Bootloader (over USB) implementation notes 5.
Software Design 5.2.2.1 MC9S08QG8 SMAC modifications (Sensor Board) Here the modifications of the SMAC are very minimal, since the core, peripherals and naming conventions are the same as in the MC9S08GB/GT code (originally in the SMAC 4.1a code). The main changes are listed below: drivers.c: • void MC13192Wake (void) function not implemented, ATTN pin not connected to the microcontroller.
SMAC (Simple Media Access Controller) Further changes are relevant to the ZSTAR JW32 platform and specific connections: drivers.h: • CLEAR_IRQ_FLAG macro changed to reflect KBI module serving IRQ requests from MC13191. mcu_hw_config.c: • void UseExternalClock(void) and void UseMcuClock(void) functions no implemented, no external clock available to the microcontroller. • LED toggling added into void MCUInit(void) during waiting for MC13191 to initialize.
Software Design 5.3 ZSTAR RF protocol The ZSTAR demo uses very simple protocol to transfer the accelerometer, button and calibration data between the Sensor Board and the USB stick over the RF medium. The protocol is built on top of SMAC (Simple Media Access Controller) drivers that are available for the MC13191 transceivers family. The protocol is bidirectional allowing the set up of independent connections amongst numerous pairs of ZSTAR demos. All data is transferred in so-called Zpackets.
ZSTAR RF protocol 5.3.1.1 Network number The network number is randomly generated at the beginning of the connection between the USB stick and the Sensor Board. It is used to determine between various connections. Packets with different Network numbers are simply ignored. This field is 16 bits long. 5.3.1.2 RX strength This field reports the strength of the last received packet on the other end of the connection. This value simply tells us how well the other side receives ‘our packets’.
Software Design 5.3.2 ZSTAR protocol Zcommand description 5.3.2.1 ZSTAR_BROADCAST This command is sent when the USB stick tries to establish connection with the Sensor Board. The USB stick first generates a new random network number which is then ‘broadcast’ to any Sensor Board that is not yet connected to a USB stick. The USB stick transmits this command on a free channel, while the Sensor Board searches all available channels. Once a Sensor Board receives this command, it responds with a ZSTAR_CONNECT.
ZSTAR RF protocol 5.3.2.4 ZSTAR_ACK This command is sent as the data acknowledgement so the Sensor Board board knows that the connection is still alive. If the receive window is opened by the Sensor Board and the ZSTAR_ACK has not been received, the operation (periodic transmission of a ZSTAR_DATA packet) continues but the Sensor Board will try to receive an acknowledgement more frequently.
Software Design 5.4 STAR protocol and ZSTAR extensions (over USB) The ZSTAR demo uses a subset of the original STAR demo protocol commands. This way, most of the software originally developed for the RD3112 (STAR) is also usable with the ZSTAR. The STAR demo communicates over the RS232 serial line with a simple text-based protocol. The same protocol is used in ZSTAR for communication between the USB stick and a PC (over a virtual serial port).
STAR protocol and ZSTAR extensions (over USB) ‘V’ PC to demo ‘x’ X-axis value ‘y’ Y-axis value ‘z’ Z-axis value demo to PC Figure 5-6Accelerometer data transfer ‘V’ (0x56) 5.4.2.1 Extended Accelerometer data transfer ‘v’ (0x76) The ZSTAR demo has also two buttons designed on the Sensor Board.
Software Design ‘K’ PC to demo ‘X’ x(0g) x(1g) ‘Y’ y(0g) y(1g) ‘Z’ z(0g) z(1g) demo to PC Figure 5-8Calibration data ‘K’ (0x4B) 5.4.4 Calibration process ‘k’ (0x6B) The calibration process is initiated by a ‘k’ command from the PC, followed by 6 bytes of calibration data. These are to be stored in the Flash memory of the Sensor Board being used. More in chapter 5.3.2.5 ZSTAR_CALIB.
STAR protocol and ZSTAR extensions (over USB) ‘G’ PC to demo g-select value demo to PC Figure 5-10g-select reading ‘G’ (0x47) 5.4.5.2 g-select setting ‘g’ (0x67) To select the g-range of the sensor on the ZSTAR Sensor Board, a ‘g’ command is issued. It needs to be followed by the required g-range (‘0’, ‘1’, ‘2’ or ‘3’). The USB stick board then communicates this selection to the Sensor Board over the air (see more in 5.3.2.6 ZSTAR_STATUS). No response from the demo is provided.
Software Design and the reported USB stick packet level are shown, as well as command names, etc. This can be useful in determining the communication range between the USB stick and the Sensor Board. The debug information is no longer displayed after issuing a ‘u’ command or Communication handshake ‘R’ (0x52). ‘U’ ‘u’ PC to demo various debug information mainly on air protocol no debug info demo to PC Figure 5-13Debug on ‘U’ (0x55) and Debug off ‘u’ (0x75) 5.4.6 Further debug and test commands 5.4.6.
Bootloader 5.5 Bootloader There’s bootloader software implemented in MCHC908JW32 microcontroller. The bootloader is based on AN2295 Application note - Developer’s Serial Bootloader for M68HC08 and HCS08 MCUs and AN2295SW accompanied software.
Software Design 5.5.1 Bootloading procedure 1. Find on the installation CD the folder with binaries: 2. Start (double-click) the CMD.EXE shortcut, a command line window should appear: Wireless Sensing Triple Axis Reference design, Rev. 0.
Bootloader 3. Now type: hc08sprg [bootloader com port number] [binary (S file) that you want to bootload], just like this: hc08sprg.exe com8 accelerometer_v2_ZSTARJW32-new-DUALBOOT.S19 4. Press ENTER and initial bootloader communication will start: If this screen does not appear, remove the USB stick and start from the beginning. Wireless Sensing Triple Axis Reference design, Rev. 0.
Software Design 5. Just confirm with Y, and the binary will be loaded onto the USB stick: The bootloader disappears (in Device Manager) and the newly loaded software starts to execute. Using this procedure the software in the USB stick can be changed anytime. Wireless Sensing Triple Axis Reference design, Rev. 0.
Bootloader 5.5.2 Dualboot guidelines NOTE: The USB stick already comes from factory with two dualboot-aware applications pre-programmed. USB stick and AN2295 Bootloader software provide a way of having two different software (devices) in one USB stick. In order to do this, two dualboot-aware versions of the software needs to be consecutively bootloaded onto the USB stick: Follow the sequence of instructions in the 5.5.1 Bootloading procedure for two dualboot versions of software: 1.
Software Design 5.5.2.1 Dualboot applications switching Having both dualboot-aware applications programmed in the USB stick, they can be switched just by quickly pressing the button (having the USB stick inserted into the USB slot). The applications will appear and disappear accordingly. The ‘tilt’ mouse application in order to work must have sensor board calibrated correctly (e.g. using RD3152MMA7260Q_SW.exe or 5.4.6.2 Semiautomatic self-calibration procedure).
Chapter 6 Application Setup 6.1 ZSTAR Installation Procedure 6.1.1 USB stick installation First of the all, we have to install the USB stick to your PC. Please follow the next steps. 1. Plug the USB stick into a USB slot.The ‘Found New Hardware’ announcement should appear: Wireless Sensing Triple Axis Reference design, Rev. 0.
Application Setup 2. Then the installation wizard starts for new hardware. Choose “Install from a list or special location“ Wireless Sensing Triple Axis Reference design, Rev. 0.
ZSTAR Installation Procedure 3. Point to the Installation CD as the driver path: Wireless Sensing Triple Axis Reference design, Rev. 0.
Application Setup 4. Installation should continue: Wireless Sensing Triple Axis Reference design, Rev. 0.
ZSTAR Installation Procedure 5. If you are using Windows XP SP2, you will be asked to stop or continue installation because the drivers are not certified by Microsoft. Select the “Continue Anyway” button 6. Installation should succesfully finish. Wireless Sensing Triple Axis Reference design, Rev. 0.
Application Setup 7. Check whether a new serial port (ZSTAR Triaxial Demo) has appeared in your Device Manager (My Computer, right click, Manage, Device Manager): 8. If required, the ZSTAR Triaxial Demo COM port maybe renumbered using the standard procedure in Windows operating system: Right click for Properties, Port Settings tab, Advanced button and change the COM port number accordingly. Wireless Sensing Triple Axis Reference design, Rev. 0.
ZSTAR Installation Procedure 9. Launch the RD3152 software “RD3152MMA7260QSW.exe" and select the COM port number which you may have assigned in Device Manager. Figure 6-1 If no error message appears, the COM port is opened correctly and software communicates with the USB stick. 10. Now lets go and check data from the ZSTAR Sensor Board. Raw data, 2D/3D screen, or Scope work should be used for this purpose.
Application Setup 6.1.2 AN2295 Bootloader Drivers installation This procedure assumes that ZSTAR Demo drivers are already installed. The drivers are alse common for the bootloader (= are already present in Windows folders). If not, the procedure will be identical to the ZSTAR drivers installation. 1. Press the Button on the USB stick and insert it into a USB connector (keeping the button pressed when inserted). The following window appears: Wireless Sensing Triple Axis Reference design, Rev. 0.
ZSTAR Installation Procedure 2. The PC searches for an appropriate driver (as the ZSTAR Demo, in some instances a folder with drivers (zstar.inf and usbser.sys) needs to be selected), then the following window should appear: 3. Just click Yes, and the bootloader port will be installed (as seen in the Device manager): 4. Right click My computer on the Desktop > Properties, Hardware tab, Device Manager button. Wireless Sensing Triple Axis Reference design, Rev. 0.
Application Setup 5. A similar setup should be observed: 6. Note down the COM port number (here, COM8); this is the port number of the Bootloader Once the software in the USB stick needs to be updated, the Bootloader can be invoked anytime, just by pressing the button while inserting the USB stick into the USB slot. Wireless Sensing Triple Axis Reference design, Rev. 0.
Appendix A References The following documents can be found on the Freescale web site: http://www.freescale.com. 1. 2. 3. 4. 5. 6. AN2295 Application note - Developer’s Serial Bootloader for M68HC08 and HCS08 MCUs AN3153 Application note - Using the Full-Speed USB Module on the MCHC908JW32 MC9S08QG8 Datasheet MCHC908JW32 Datasheet MMA7260Q Datasheet MC13191 Datasheet Wireless Sensing Triple Axis Reference design, Rev. 0.
Wireless Sensing Triple Axis Reference design, Rev. 0.
How to Reach Us: Home Page: www.freescale.com E-mail: support@freescale.com USA/Europe or Locations Not Listed: Freescale Semiconductor Technical Information Center, CH370 1300 N. Alma School Road Chandler, Arizona 85224 +1-800-521-6274 or +1-480-768-2130 support@freescale.