4 3 1 5 2 1 VDD FB1 BEAD VDD36 R1 33R C3 10nF 560 VDD LED MRESET MIRQ R6 1k OSC1 C7 100pF C10 2n2 GND R7 1M GND 2 1 VDD36 Q2 Murata CSTCR6M00G53 4 VDD 25 26 21 23 24 NC NC NC 37 38 34 PTB0 PTB1 PTB5 U2 GND GND NC NC NC NC 19 17 18 16 13 14 15 16 17 18 19 22 2 3 12 20 1 3 5 TxD RxD GND 2 4 6 VDD36 J3 GND 2 1 L6 4.7nH GND GND CRYSTAL2 C5 10nF C6 10nF GND 2 4 6 RFIN+ RFIN- CRYSTAL1 C8 6.8pF 1 3 5 U1 MC13191FC 26 Q1 VREG33EN CE MOSI MISO SPICLK L5 5.
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’ various debug information mainly on air protocol PC to demo 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.