AVR2015: RZRAVEN Quick Start Guide Features • Introduces the AVR Wireless Services PC Suite. - Wireless Protocol Analyzer. - ZigBee coordinator mode. • Introduces the applications on the RZRAVEN kit. - AirCapture (Back-end for the Wireless Protocol Analyzer). - Send and receive text messages. - Distributed sensor reading. - Over-the-Air firmware upgrade. 8-bit Microcontrollers Application Note 1 Introduction This application note describes how to get started with the RZRAVEN kit. The RZRAVEN kit is built around three main components; the hardware itself, the firmware running in the RZUSBSTICK and AVRRAVENs, and the AVR Wireless Services PC suite. This document describes how to install the AVR Wireless PC Suite, use its different features and how to operate the AVRRAVENs accordingly. An introduction to the hardware platform is given in another document, AVR2016. Figure 1-1. The RZRAVEN Kit. Rev. 8120B-AVR-03/08 2 Getting Started with the RZRAVEN Kit This section gives an introduction to what the RZRAVEN kit contains and its system requirements. Brief instructions are given at end on how to get the kit running in the shortest amount of time. See Figure 2-1 for a system overview of the RZRAVEN kit and AVR Wireless Services software. Figure 2-1 System Overview Personal Computer Socket Socket TCP/IP Socket AVR Wireless Services Suite Socket Local Host or Remote PC RF Services Server USB DRIVER RZUSBSTICK AVRRAVEN 2 USB DRIVER RZUSBSTICK AVRRAVEN AVR2015 8120B-AVR-03/08 AVR2015 2.1 Unpacking the System Kit contents: • • • • • • (2 pcs) AVRRAVEN boards. (1 pc) RZUSBSTICK board. (4 pcs) LR44 batteries (Mounted). (5 pcs) dual row 10-pin headers (50 mil spacing). (1 pc) 50-mil to 100-mil JTAG adapter. Partner Deliverables (Flyers and/or CD). 2.2 System Requirements Before using the AVR Wireless Services application with the RZRAVEN kit, users must observe minimum system requirements in Table 2-1. Table 2-1. Minimum System Requirements Parameter Value Note Hardware PC/CPU Intel Pentium III or higher, 800 MHz PC/RAM 128 MBytes PC/Video 1024x768, SVGA PC/ Hard disk free space 50 Mbytes On-Chip Debugger and programmer AVR JTAGICE mkII The AVR JTAGICE mkII is needed if the user wishes to debug and do custom application development. Operating System Windows2000/XP/Vista 64-bit versions not supported. Vista is supported in XP compatibility mode. IDE AVRStudio 4.12 or newer. Need to program new firmware to the AVR microcontroller. Can also be used to develop user’s custom applications (IAR Ccompiler or AVR-GCC must be installed). Software 2.3 Quick Start Guide This section goes through how to get the RZRAVEN kit and the AVR Wireless Services up and running in the shortest amount of time. 1. Unpack the RZRAVEN kit and ensure that it contains all the components listed in subsection 2.1. 2. Install the latest version of the AVR Wireless Services suite by following the steps described in subsection 3.1. 3. Connect the RZUSBSTICK to one of your PC’s free USB ports. 4. Follow the steps outlined in subsection 3.2 to install the USB driver for the RZUSBSTICK. 3 8120B-AVR-03/08 5. Associate the attached RZUSBSTICK with a new RF Services Server instance. How to start a new RF Services Server is described in subsection 4.1. 6. Start an instance of the AVRWIRELESS Services GUI and chose an operating mode as described in subsection 5.1 and subsection 5.6. 7. Done. See section 6 for a troubleshooting guide. 3 Installation of AVR Wireless Service Suite This chapter describes how to install the AVR Wireless Services Suite and the USB driver necessary to communicate with the RZUSBSTICK. The described steps assume a PC with Windows XP installed. Also ensure that the steps described in section 3.1 are successfully completed before the RZUSBSTICK is attached to the PC. 3.1 Installation The AVR Wireless Services Suite is distributed as a user-friendly self-extracting installer. Follow the steps listed below to ensure that the AVR Wireless Services and RF Services Server is installed correctly on your system: 1. Copy the “AVRWirelessSetup.exe” file to a suitable temporary folder on the PC. 2. Start the installation by double-clicking the .exe file. 3. Click the next button when prompted. 4. Read the license agreement. Select the “I Accept the terms of the license agreement” button if you wish to continue the installation. Press the Next button. 5. Select the folder where you wish to install the AVR Wireless Services and RF Services Server application. The default location is together with any other previously installed Atmel software. 6. Press the Install button. 7. The AVR Wireless Services might need runtime libraries not installed on the setup. If prompted, accept to install these libraries. Press Next. Also press Yes to accept the license agreement from Microsoft. 8. When prompted, make sure that the “Install Jungo USB Driver” option is selected before pressing the Next button. 9. Click Next to install AVR USB on your computer. 10. Read the license agreement. Select the “I Accept the terms of the license agreement” button if you wish to continue the installation. Press the Next button. 11.The default location for the AVR USB driver is preferred. Press the Next button. 12. Press Install. 13. Press the Finish button when prompted. 14. The installation is done. This can be verified by examining the chosen destination folder of the installation. It should contain at least two .exe files; rfservicesserver.exe and AvrWirelessServices.exe. 3.2 Attaching the RZUSBSTICK for the first time Note: Attach one RZUSBSTICK at the time if more than one is available. 4 AVR2015 8120B-AVR-03/08 AVR2015 This section assumes that the installation process outlined in section 3.1 was successful and that the RZUSBSTICK is programmed with the default firmware. Perform the following actions when attaching the RZUSBSTICK for the first time: 1. Attach the RZUSBSTICK to one of the PC’s unused USB ports. 2. After a few seconds the “Found New Hardware Wizard” will pop up. 3. Check the “No, not this time” option. 4. Click the Next button. 5. Verify that “Install the software automatically” option is checked. Press the Next button. 6. Press the Finish button when the installation has completed. 7. Done. 4 RF Services Server This section describes how to start and stop the RF Services Server application. It was installed as a part of the AVR Wireless Services Suite in section 3. The application serves as a gateway binding the USB port that the RZUSBSTICK is attached to and a TCP/IP socket. There is a one-to-one relation between the RZUSBSTICK and the TCP/IP socket (IP address and port number). The chosen communication model is very flexible and makes it possible to interface with both local and remote RZUSBSTICKs. The AVR Wireless Services application, described in section 5, will open a socket and associate itself to one RF Services Server instance. Any valid IP address and port can be used, and hence a RZUSBSTICK anywhere in the world can be accessed. Note: Make sure that a valid IP address is chosen, and that the chosen port does not conflict with other applications such as http or ftp (See http://www.iana.org/assignments/port-numbers for a list of used ports). This quick start guide uses local host (127.0.0.1) and port 27000. 4.1 Starting the Server This is how the RF Services Server is started: 1. Open a new command line shell in Windows: Go to the Run option from the Start menu. Then type “cmd” and press the OK button. 2. Navigate to the folder where AVR Wireless Service was installed (The default installation path is: “C:\Program Files\Atmel\AVR Wireless Services”). 3. Then type in the following command: “rfservicesserver.exe [IP ADDRESS] [PORT]” where the two parameters indicate the following (See Figure 4-1 for a reference): o [IP ADDRESS]: IP address of the machine that the RZUSBSTICK is connected to. This example uses the address of local host (127.0.0.1). o [PORT]: Port that the RF Services Server application and the AVR Wireless Services application are to communicate over. In this example port 27000 is used. 4. Press Enter. 5 8120B-AVR-03/08 5. Verify that the RF Services Server started successfully. See Figure 4-2 for a reference. Figure 4-1 Starting The RF Services Server Figure 4-2 RF Server Successfully Started 4.2 Terminating the Server The following steps must be followed to terminate the RF Service Server correctly: 1. Stop the AVR Wireless Services application if it has been running. 2. Type Ctrl-C and press the Enter button in the command line window where the server instance is running. 3. Close the command line window. 5 AVR Wireless Services The AVR Wireless Server is the graphical user interface that connects to the RF Services Server and utilizes the features available in the RZRAVEN firmware: • ZigBee Coordinator View: o The RZUSBSTICK is acting as a ZigBee coordinator and the AVRRAVENs can join it. o Each node is presented as an entry in a list view. 6 AVR2015 8120B-AVR-03/08 AVR2015 The user can select to; send a text message, read temperature or perform a firmware upgrade on a joined node by right clicking it in the node list. • Wireless Protocol Analyzer View: o The RZUSBSTICK is set in AirCapture mode and all IEEE 802.15.4 frames within radio range and on the chosen channel will be captured. o Captured frames will be uploaded to the Wireless Protocol Analyzer and stored to file. o The frames are analyzed and presented to the user in a colorhighlighted list. o The frame list can be filtered and organized after different criteria chosen at the user’s discretion. o 5.1 Starting in Coordinator Mode The ZigBee coordinator mode is started by following the below sequence: 4. Start a RF Services Server as described in section 4.1. 5. Start a new instance of AVR Wireless Services from the start menu (start – All Programs – Atmel AVR Tools – AVR Wireless Services). 6. Locate the “Start Coordinator” button from the AVR Wireless Services toolbar (Capital blue C). Click it. 7. The Connect dialog for the RF Services Server will pop up. Type in the TCP/IP address and port number chosen. Also fill in the channel and PAN identifier for the ZigBee coordinator to form the network on. See Figure 5-1 for an example configuration. The channel can be chosen from 11 to 26. The PAN identifier can be chosen between 0 and 0xFFFF. The PAN format is hexadecimal, so “0x” must be prepended. 8. Verify that the RF Services Server and the ZigBee coordinator were successfully started. See Figure 5-2 for a reference. Figure 5-1 RF Services Server Connect Dialog Figure 5-2 Successful Server - Client bind 7 8120B-AVR-03/08 5.2 Joining the AVRRAVENs With the AVR Wireless Services application started in ZigBee coordinator mode, the AVRRAVENs can be joined. This subsection describes how to do this: 1. Power on the AVRRAVEN. Verify that the “RAVEN” splash screen appears. 2. Navigate to the Radio menu item, and verify that the PAN identifier and channel is set to the same as that of the ZigBee coordinator. See Appendix A for a reference on how to find the Radio menu item. 3. Navigate to the Join menu item. Again, see Appendix A for an illustration of the AVRRAVEN’s menu. 4. Press the joystick down. A message will start scrolling on the screen indication that the node is busy joining the network. 5. Verify that the joining procedure was successful. 6. The assigned network address will be displayed on the screen together with a message indicating a successful join procedure. 7. Verify that the AVRRAVEN is added to the node list in AVR Wireless Services. 8. Done. The node is now ready to participate in the network. 5.3 Sending Text Message Text messages can be composed and sent from the AVRRAVENs or from the AVR Wireless Services Application: 5.3.1 Compose and send a message from the AVRRAVEN 1. Navigate to the Compose menu item. See Appendix A for an illustration of the AVRRAVEN’s menu. 2. Use the up, down, right and left key to write the text message. 3. When done, press the joystick down. The destination address editor will become visible. 4. Use the up, down, right and left key to write the destination address. 5. When done, press the joystick down. 6. A message will appear on the LCD indicating if the transmission was successful or not. 7. Done. 8 AVR2015 8120B-AVR-03/08 AVR2015 5.3.2 Compose and send a message from AVR Wireless Services 1. Right click on the node that is to receive the text message from the node list. 2. Select Send Text Message. 3. Write the message in the text box that pops-up. 4. Press the Send button. 5. Verify that the selected AVRRAVEN makes a “kra-kra” sound and the message is shown on the screen. 6. Done. 5.4 Reading Temperature The AVRRAVEN has an onboard NTC resistor that is used to measure temperature. This NTC is connected to one of the ATmega3290P’s ADC channel. However, this ADC channel is shared with one of the JTAG lines. So the JTAG interface must be disabled for the temperature to be measured correct. 5.4.1 Disable the JTAG interface 1. Navigate to the System – Config – Debug menu item. See Appendix A for a reference. 2. Press the joystick down (Enter). 3. Use the up and down key to toggle the Enable – Disable option to Disable. 4. Press the joystick down (Enter). 5. Done. 5.4.2 Reading Temperature 1. Right click on the AVRRAVEN to read the temperature from in the node list. 2. Select the Read Temperature option from the drop down list. 3. The read temperature will be shown to the right of the node in the list view. 4. Done 5.5 Over The Air Firmware Upgrade Note: Over the air firmware upgrade shall only be performed with fresh batteries (New) or with the AVRRAVEN running from an external power supply. A firmware upgrade is performed as follows: 1. Right click the AVRRAVEN that is to be upgraded in the AVR Wireless Service’s node list. 2. Select the firmware upgrade option. 3. Now select the firmware images to be downloaded. Both an image for the ATmega3290P and ATmega1284P must be chosen. 4. Verify that the firmware upgrade is started on the AVRRAVEN. This is indicated by the LCD displaying what AVR is being upgraded and how many Kbytes of memory that has been written. 5. Verify that the AVRRAVEN rejoins the network after the two firmware images has been written. 9 8120B-AVR-03/08 6. Done. 5.6 Starting in Wireless Protocol Analyzer Mode The Wireless Protocol Analyzer mode is started by following the below sequence: 1. Start a RF Services Server as described in section 4.1. 2. Start a new instance of AVR Wireless Services from the start menu (start – All Programs – Atmel AVR Tools – AVR Wireless Services). 3. Locate the start Wireless Protocol Analyzer button from the AVR Wireless Services toolbar (Black plug). Click it. 4. The Connect dialog for the RF Services Server will pop up. Type in the TCP/IP address and port number chosen. Also fill in the channel for the protocol analyzer to capture frames on. See XXX for an example configuration. The channel can be chosen from 11 to 26. Verify that the RF Services Server and the Wireless Protocol Analyzer was successfully started. See Figure 5-3 for a reference. Figure 5-3 Successful Server - Client bind 5.7 Analyzing Frames 1. Select one of the frames in the frame list. 2. The decode frame will now be showed in the Package view (Lower half of the AVR Wireless Services frame). 3. The frame’s fields are represented as a tree structure. 5.8 Update Enable or Disable 5.9 Frame Filter With the Wireless protocol analyzer running it is possible to generate filters, and apply them to the items in the frame list. A filter is constructed around a logical expression, one of the defined frame fields and a compare value. The two following subsections describe how to define and apply a filter and then clear it. 5.9.1 Applying a filter 1. Right click on the frame list. 2. The filter menu will appear 10 AVR2015 8120B-AVR-03/08 AVR2015 3. Select the frame field to filter, logical operation and value. 4. One or more filters can be defined. 5. Click the OK button to apply. 5.9.2 Clearing a filter 1. Right click on the frame list. 2. Select the clear filter option. 3. The frame list will be rewritten without the filter applied. 6 Troubleshooting Guide Errors are indicated to the user through the LEDs on the RZUSBSTICK. Table 6-1. Error Codes LED Error Action Blue All systems are working correctly. NA Amber/Yellow Buffer overflow in either the ZigBee coordinator mode or AirCapture mode. Restart the mode from the AVR Wireless Services application. Red Serious error with the USB driver. The RZUSBSTICK must be physically deattached and attached again. 7 Appendix A: The AVRRAVEN Menu RA V EN NE TW O R K JO IN -nwk address- Join nw k LEA VE -nwk address- Leave nw k IN BO X -m ail cou nt- Sele ct ListB ox(”M ail text”) -address- Finish C O M P O SE E dit Texteditor(”m essage”) -m sg size - E dit Up Left m enu O nC enterClick R ight D ow n M E S SA G E R EA D TEM P -tem p- S Y ST EM C O N FIG S end NAME Texteditor(”nam e”) S ave U N ITS TE M P E dit ListB ox(”Un it”) S ave R A D IO PA N ID -pan id- E dit Nu m edit(”P and id”) S ave C H AN N EL -channel - E dit N um ed it(”C hann el”) S ave ListB ox(”EN A BLE ”, ”DISA BLE ”) S ave D EB U G S TO R A G E FILE S -file cou nt- FW RE V ISIO N -rev- FO R M A T U PG R A DE R EB O O T N um ed itor(”Add ress”) -ad dress- Select Form at data fla sh Load F W im age R eboot 8 Appendix B: How to Restore the Original Firmware 8.1 Necessary Hardware Modifications Requirement: Soldering Iron, solder, and five 10-pin dual row headers with 50-mil spacing (Furnished with the kit). 11 8120B-AVR-03/08 Footprints to mount JTAG connectors are available on both the RZUSBSTICK (1 connector) and the AVRRAVEN (2 connectors, one for each AVR). The soldering process is straightforward: 1. Power off the RZUSBSTICK or AVRRAVEN that is to be soldered. 2. Heat the soldering iron to approximately 300 to 350°C. 3. Insert the header and ensure that it mounts flat towards the PCB. 4. Solder one pin in a corner of the header. See that the solder is sucked onto the header pin and the through-hole pad. The solder should form an even convex cone. 5. Solder the diagonal pin to the first one to ensure good stability. 6. Solder the remaining pins. 7. Done. Inspect for short circuits. See Figure 8-1 and Figure 8-2 for JTAG header placement. Figure 8-1 Placement of RZRAVEN JTAG Connector Figure 8-2 Placement of AVRRAVEN JTAG Connector 12 AVR2015 8120B-AVR-03/08 AVR2015 8.2 Device Programming Requirement: An AVR JTAGICE mkII and one 50-mil to 100-mil adapter (Latter is furnished with the kit). Table 8-1 to Table 8-3 lists the fuses used by the three AVR microcontrollers in the RZRAVEN kit. The fuses 1. Connect the AVR JTAGICE mkII to the PC. 2. Insert the 50-mil to 100-mil adapter to the JTAG probe. Ensure that the adapter is connected with the correct orientation. 3. Connect the 50-mil to 100-mil adapter to the RZUSBSTICK or AVRRAVEN boards. Ensure that pin one on the selected header mates with pin one on the adapter. 4. Apply power to the AVR JTAGICE mkII and the attached board (The RZUSBSTICK must be connected to a PC). 5. Start AVR Studio and press the “Cancel” button in the Welcome dialog window. 6. From the Tools menu, select “Program AVR” and “Connect…”. 7. Select JTAGICE mkII as platform and then press “Connect…”. 8. Open the “Program” tab. Select the AVR you wish to program (AT90USB1287, ATmega3290P or ATmega1284P) from the Device pull down menu. 9. Select the “Fuses” tab and ensure that the Fuses are set as listed in Table 8-1, Table 8-2 or Table 8-3 respectively. 10. Go back to the “Program” tab. Program the flash of the respective AVR with the correct .hex file found in the “bin” folder. Their naming is rather intuitive. 11. Close the STK500 window. Note: A fuse is disabled (Not checked) if is not mentioned herein. 13 8120B-AVR-03/08 Table 8-1. AT90USB1287 Fuse Settings Fuse Name Brown-out detection disabled Divide clock by 8 internally Fuse Setting Comment Checked Not Checked Will divide the clock by 8. This will prevent the internal PLL from locking. Table 8-2. ATmega3290P Fuse Settings Fuse Name Divide clock by 8 internally Fuse Setting Checked Comment Will divide the clock by 8. This enables safe operation at 1.8Volts. Table 8-3. ATmega1284P Fuse Settings Fuse Name Divide clock by 8 internally 14 Fuse Setting Checked Comment Will divide the clock by 8. This enables safe operation at 1.8Volts. AVR2015 8120B-AVR-03/08 AVR2015 15 8120B-AVR-03/08 9 References The following references were used when writing this application note: • AT86RF230 Data Sheet, available http://www.atmel.com/dyn/resources/prod_documents/doc5131.pdf. • AVR2016 RZRAVEN Hardware User’s Guide. from: 10 Table of Contents Features ............................................................................................... 1 1 Introduction ...................................................................................... 1 2 Getting Started with the RZRAVEN Kit........................................... 2 2.1 Unpacking the System ........................................................................................ 3 2.2 System Requirements ......................................................................................... 3 16 AVR2015 8120B-AVR-03/08 AVR2015 2.3 Quick Start Guide ................................................................................................ 3 3 Installation of AVR Wireless Service Suite .................................... 4 3.1 Installation ........................................................................................................... 4 3.2 Attaching the RZUSBSTICK for the first time...................................................... 4 4 RF Services Server .......................................................................... 5 4.1 Starting the Server .............................................................................................. 5 4.2 Terminating the Server........................................................................................ 6 5 AVR Wireless Services .................................................................... 6 5.1 Starting in Coordinator Mode .............................................................................. 7 5.2.............................................................................................................................. 8 5.3 Joining the AVRRAVENs .................................................................................... 8 5.4 Sending Text Message........................................................................................ 8 5.5 Reading Temperature ......................................................................................... 9 5.6 Over The Air Firmware Upgrade ......................................................................... 9 5.7 Starting in Wireless Protocol Analyzer Mode .................................................... 10 5.8 Analyzing Frames.............................................................................................. 10 5.9 Update Enable or Disable ................................................................................. 10 5.10 Applying Frame Filter ...................................................................................... 10 6 Troubleshooting Guide.................................................................. 11 7 Appendix A: The AVRRAVEN Menu ............................................. 11 8 Appendix B: How to Restore the Original Firmware ................... 11 8.1 Necessary Hardware Modifications................................................................... 11 8.2 Device Programming......................................................................................... 13 9 References...................................................................................... 16 10 Table of Contents......................................................................... 16 Disclaimer ............................................................................................. 18 17 8120B-AVR-03/08 Disclaimer Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Atmel Europe Le Krebs 8, Rue Jean-Pierre Timbaud BP 309 78054 Saint-Quentin-enYvelines Cedex France Tel: (33) 1-30-60-70-00 Fax: (33) 1-30-60-71-11 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Technical Support [email protected] Sales Contact www.atmel.com/contacts Product Contact Web Site www.atmel.com Literature Request www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. © 2007 Atmel Corporation. All rights reserved. Atmel®, logo and combinations thereof, and others, are the registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. 8120B-AVR-03/08