User's Manual 16-bit 78K0R ZigBee™ PRO Premium Development Kit Document No. U19054EE2V0UM00 Date published July 2009 © NEC Electronics 2009 Printed in Germany Legal Notes 2 • The information in this document is current as of July, 2008. The information is subject to change without notice. For actual design-in, refer to the latest publications of NEC Electronics data sheets or data books, etc., for the most up-to-date specifications of NEC Electronics products. Not all products and/or types are available in every country. Please check with an NEC Electronics sales representative for availability and additional information. • No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may appear in this document. • NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this document or any other liability arising from the use of such products. No license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others. • Descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. The incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. • While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize risks of damage to property or injury (including death) to persons arising from defects in NEC Electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. • NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and "Specific". • The "Specific" quality grade applies only to NEC Electronics products developed based on a customer-designated "quality assurance program" for a specific application. The recommended applications of an NEC Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of each NEC Electronics product before using it in a particular application. "Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime User's Manual U19054EE2V0UM00 systems, safety equipment and medical equipment (not specifically designed for life support). "Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to determine NEC Electronics' willingness to support a given application. (Note) (1) "NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its majority-owned subsidiaries. (2) "NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as defined above). User's Manual U19054EE2V0UM00 3 Regional Information Some information contained in this document may vary from country to country. Before using any NEC product in your application, please contact the NEC office in your country to obtain a list of authorized representatives anddistributors. They will verify: • Device availability • Ordering information • Product release schedule • Availability of related technical literature • Development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, AC supply voltages, and so forth) • Network requirements In addition, trademarks, registered trademarks, export restrictions, and otherlegal issues may also vary from country to country. NEC Electronics Corporation 1753, Shimonumabe, Nakahara-ku, Kawasaki, Kanagawa 211-8668, Japan Tel: 044 4355111 http://www.necel.com/ [America] [Europe] [Asia & Oceania] NEC Electronics America, Inc. 2880 Scott Blvd. Santa Clara, CA 95050-2554, U.S.A. Tel: 408 5886000 http://www.am.necel.com/ NEC Electronics (Europe) GmbH Arcadiastrasse 10 40472 Düsseldorf, Germany Tel: 0211 65030 http://www.eu.necel.com/ NEC Electronics (China) Co., Ltd 7th Floor, Quantum Plaza, No. 27 ZhiChunLu Haidian District, Beijing 100083, P.R.China Tel: 010 82351155 http://www.cn.necel.com/ United Kingdom Branch Cygnus House, Sunrise Parkway Linford Wood, Milton Keynes MK14 6NP, U.K. Tel: 01908 691133 Succursale Française 9, rue Paul Dautier, B.P. 52 78142 Velizy-Villacoublay Cédex France Tel: 01 30675800 Tyskland Filial Täby Centrum Entrance S (7th floor) 18322 Täby, Sweden Tel: 08 6387200 Filiale Italiana Via Fabio Filzi, 25/A 20124 Milano, Italy Tel: 02 667541 Branch The Netherlands Steijgerweg 6 5616 HS Eindhoven, The Netherlands Tel: 040 2654010 NEC Electronics Shanghai Ltd. Room 2511-2512, Bank of China Tower, 200 Yincheng Road Central, Pudong New Area, Shanghai 200120, P.R. China Tel: 021 58885400 http://www.cn.necel.com/ NEC Electronics Hong Kong Ltd. 12/F., Cityplaza 4, 12 Taikoo Wan Road, Hong Kong Tel: 2886 9318 http://www.hk.necel.com/ NEC Electronics Taiwan Ltd. 7F, No. 363 Fu Shing North Road Taipei, Taiwan, R.O.C. Tel: 02 27192377 NEC Electronics Singapore Pte. Ltd. 238A Thomson Road, #12-08 Novena Square, Singapore 307684 Tel: 6253 8311 http://www.sg.necel.com/ NEC Electronics Korea Ltd. 11F., Samik Lavied’or Bldg., 720-2, Yeoksam-Dong, Kangnam-Ku, Seoul, 135-080, Korea Tel: 02-558-3737 http://www.kr.necel.com/ 4 User's Manual U19054EE2V0UM00 Table of Contents Chapter 1 78K0R ZigBee™ PRO Premium Development Kit .... 7 1.1 Features of the TK-78K0R/KG3+UZ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2 Package Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4 Complementary ZigBee™ Development Platform and Hardware . . . . . . . . . . . . . . . . . . . . . . 8 Chapter 2 Sample Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.1 RF Test Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Procedure for One-to-One Transmit/Receive Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Execution of the Transmit/Receive Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 Channel Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.4 Adjusting the Output Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.5 PER Test Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.6 Continuous TX / Pseudo Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.7 Continuous TX / Raw carrier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.8 RX Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.9 IDLE Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.10 Sleep Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.11 Standby Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.12 Set RF Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.13 Manually Set UZ2400 Chip Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.14 Resetting RF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 11 13 15 17 21 21 21 22 22 22 22 22 22 22 2.2 MAC Sample Program 1 - Text Chat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Setting up the boards to your PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Designation of a coordinator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.3 Network Association . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.4 Text Chat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 23 25 25 26 2.3 MAC Sample Program 2 - LED Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Setting up the boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Starting up a Coordinator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.3 Starting up End Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.4 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.5 Using Terminal Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 28 28 29 29 30 Chapter 3 Hardware specification TK-78K0R/KG3+UZ . . . . . . . . . . . 34 3.1 Terminal list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.2 Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 SW1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 SW2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 SW3, SW4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.4 SW5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Jumper JP1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.4 LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.4.1 LED1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.4.2 LED2, LED3 and LED4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.5 FP1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.6 Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.7 Universal Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 User's Manual U19054EE2V0UM00 37 37 39 39 40 5 3.8 Soldering Bridges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.9 Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.10 Design Data and Parts Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.10.1 Parts Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.10.2 RF Board Connection Figure_K0R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Chapter 4 Hardware specification 78K0R_UZ_Stick . . . . . . . . . . . . . . . 46 4.1 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.2 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.3 Interface Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.3.1 CN1 - Minicube Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.3.2 CN2 - Expansion Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.4 Switches and LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.1 SW1 - Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 SW2 - USB Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.3 LED1 - Power Indication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.4 LED2, LED3 and LED4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Design Data and Parts Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Chapter 5 78K0R ZigBee™ PRO Premium Development Kit, Installation and Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 49 50 50 50 52 5.1 Hardware Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.2 Software Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.2.1 IAR Systems Embedded Workbench Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.2.2 Sample Program Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.3 USB Driver Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 Installation on Windows 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 Installation on Windows XP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.3 Confirmation of USB Driver Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 6 IAR Sample Session 53 53 57 60 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 6.1 Loading a Project and Programming the Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 6.2 Generating and Flash Programming a Hex File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 6.3 Setting of different MAC address by Preprocessor command . . . . . . . . . . . . . . . . . . . . . . . . 72 6.4 Using of the UART for debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Chapter 7 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 7.1 Introduction and Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 7.2 User Configurable Network Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 7.3 System Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 7.3.1 Servicing the SK_LAYER_API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 7.3.2 Managing and Actioning of the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Chapter 8 6 Attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . User's Manual U19054EE2V0UM00 80 Chapter 1 78K0R ZigBee™ PRO Premium Development Kit The 78K0R ZigBeeTM Premium Development Kit is the NEC Electronics 16-bit starter kit specifically designed for the development of wireless networking applications. The above platform can be used to design and develop a broad range of wireless networks from simple peer to peer to full mesh networking incorporating all of the features of a fully compliant ZigBeeTM network. The development kit contains the TK-78K0R/KG3+UZ evaluation board, which includes the 78K0R/KG3, a 16-bit single-chip microcontroller of NEC Electronics, and the UZ2400 RF board of Uniband Electronic Corporation. 1.1 Features of the TK-78K0R/KG3+UZ Features of the TK-78K0R/KG3+UZ CPU board are as follows. • • • • • • • • • • Note The evaluation board uses the NEC Electronics 16-bit single chip microcontroller (μPD78F1168GC). All of ROM, RAM and circumference circuit are efficiently built in one chip on a single board. High-speed operation has been achieved with 20MHz clock. Sub-clock 32.768 kHz standard equipment. 512 kB FLASH memory and 30 kB RAM memory are built into CPU chip. Hardware is ready to accommodate 2.4GHz transceiver chip UZ2400 (Accordance with IEEE 802.15.4/ZigBeeTM Specifications for Low Rate Wireless Personal Area Networks) made by Uniband Electronic Corporation. ( http://www.ubec.com.tw/index.html) Attached antenna Titanis made by Gigaant ( http://www.gigaant.com) A maximum of 40 I/O ports are equipped for expanded use, with an on-board temperature sensor for applications development. (S-8120C made by SII) ( http://www.sii.co.jp) Debugging using on-chip debug function can be done. The board itself is quite and easy to handle: the CPU board size is 60 mm × 90 mm and the CPU board size with the RF transceiver is 60 mm × 102 mm. Please inquire direct to the parts maker about specification of UZ2400 RF board, antenna and temperature sensor. 1.2 Package Content The 78K0R ZigBeeTM Premium Development Kit consists of four TK-78K0R/KG3+UZ development board and one 78K0R_UZ_Stick which is configured to act as Air Sniffer hardware. Also supplied is the unlimited security User's Manual U19054EE2V0UM00 7 Chapter 1 78K0R ZigBee⢠PRO Premium Development Kit dongle for the 78K0R ZigBeeTM Stack and ZigBeeTM Software Developers Kit (ZigBeeTM SDK tools). The following software is also supplied on the accompanying CDROM. • • • • IAR Embedded Workbench Kickstart edition 16 kB code size limited IEEE 802.15.4 MAC libraries Different sample application programs for the 78K0R/KG3+UZ board Sample program for the Air Sniffer application for 78K0R_UZ_Stick 1.3 System Requirements Host PC A PC supporting Windows 2000 or Windows XP for the IAR Systems Embedded Workbench Kickstart edition and the 78K0R ZigBee™ PRO Premium Development Kit. Pentium 200 MHz minimum, 128 MB of RAM, 256 colour display (1024 x 768), mouse, CD ROM drive and 200 MB of disk space are required to install the tool packages. Host Interface USB interface that enables communication based on USB (Version 1.1 or later) Package Contents Please verify that you have received all of the parts listed in the package contents list attached to the 78K0R ZigBee™ PRO Premium Development Kit. If any parts are missing or seem to be damaged please contact the dealer from whom you received your 78K0R ZigBee™ PRO Premium Development Kit. Note Updates for the IAR Embedded workbench for 78K0R, documentation and/or utilities for the 78K0R ZigBee™ PRO Premium Development Kit if available maybe downloaded from the NEC Electronics web pages at: http://www.eu.necel.com/ updates Trademarks IAR Embedded Workbench, visualSTATE, IAR MakeApp and C-SPY are registered trademarks of IAR Systems AB. Microsoft and Windows are registered trademarks of Microsoft Corporation. Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated. All other product names are trademarks or registered trademarks of their respective owners. 1.4 Complementary ZigBee™ Development Platform and Hardware Other evaluation boards and hardware available to develop a ZigBeeTM network from NEC Electronics: • 8 ZigBeeTM Starter Kit 2 x 8-bit ZigBeeTM node boards TK-78K0/KF2+UZ IEEE 802.15.4 MAC libraries Sample programs IAR Embedded Workbench Kickstart Version Flash programmer for 78K0 Article code 78K0-ZIGBEE-SK User's Manual U19054EE2V0UM00 78K0R ZigBee⢠PRO Premium Development Kit • ZigBeeTM Premium Development Kit for 78K0 4 x 8-bit ZigBeeTM node boards TK-78K0/KF2+UZ 8-bit USB ZigBeeTM node programmed as Air Sniffer IEEE 802.15.4 MAC libraries ZigBeeTM Stack Unlimited ZigBeeTM license for the 78K0 family GUI Tools (SDK) Sample programs IAR Embedded Workbench Kickstart Version Flash programmer for 78K0 Article code 78K0-ZIGBEE-PREM • ZigBeeTM Premium Development Kit for V850 1 x 32-bit ZigBeeTM node boards TK-850/SG2+UZ 8-bit USB ZigBeeTM node programmed as Air Sniffer IEEE 802.15.4 MAC libraries ZigBeeTM Stack Unlimited ZigBeeTM license for the V850 family GUI Tools (SDK) TCP/IP Libraries & Web Server Sample programs IAR Embedded Workbench Kickstart Version Flash programmer for V850 Article code V850-ZIGBEE-GATE • ZigBeeTM PRO Premium Development Kit for V850 1 x 32-bit ZigBeeTM node boards TK-850/SG2+UZ 8-bit USB ZigBeeTM node programmed as Air Sniffer IEEE 802.15.4 MAC libraries ZigBeeTM Stack Unlimited ZigBeeTM license for the V850 family GUI Tools (SDK) TCP/IP Libraries & Web Server Sample programs IAR Embedded Workbench Kickstart Version Flash programmer for V850 Article code V850-ZIGBEEPRO-GATE Chapter 1 Additional single boards or modules can be purchased in case the customer needs additional hardware for Premium or Gateway kits: - TK-78K0/KF2+UZ-EE 78K0_UZ_Stick-EE TK-78K0R/KG3+UZ-EE 78K0R_UZ_Stick-EE TK-850/SG2+UZ-EE User's Manual U19054EE2V0UM00 9 Chapter 2 Sample Applications With the 78K0R ZigBeeTM Premium Development Kit, three different sample programs are offered: • • • RF Test program MAC Sample program 1: Text Chat MAC Sample program 2: LED Control The “Text Chat” and the “LED Control” sample programs uses the MAC stack provided in this evaluation kit. The TK-78K0R/KG3+UZ boards are pre-programmed with the MAC Sample Program 2, so for a quick start please go the associated section "2.3 MAC Sample Program 2: LED Control" . 2.1 RF Test Program The RF test program is a simple program that allows various RF parameters to be configured and test signals generated. The features found in this program can be used to provide the software support functions needed for various test requirements. In the sample provided a simple terminal program like “HyperTerminal” is required to select the relevant mode of operation. For all “HyperTerminal” sessions, please use the following settings and relevant serial port. Table 2-1 10 "HyperTerminal" port settings Baud rate 19200 Data bits 8 Parity NONE Stop bits 1 Flow control NONE Local echo OFF Line feed NO User's Manual U19054EE2V0UM00 Sample Applications Figure 2-1 Chapter 2 "HyperTerminal" settings 2.1.1 Procedure for One-to-One Transmit/Receive Test Two TK-78K0R/KG3+UZ boards are needed for this test. Both boards need to be programmed with the file TK-78K0RKG3+UZ RF test sample program (to have more information about how to program the board, go to the section "6.1 Loading a project and programming the board" ) You have to prepare two PCs, both with USB interface and hyper-terminal to control transmitter and receiver side. The receiver sends back the test result to the transmitter where the test results are displayed. The receiver could also work without PC, battery powered by a 9V Block. User's Manual U19054EE2V0UM00 11 Chapter 2 Sample Applications Figure 2-2 Transmitter and Receiver configuration By switch settings, the boards can be set to transmitter or receiver mode, and the short address of each board can be selected. Please set the switches on the transmitter and the receiver board according to the tables below. Set one board as a transmitter with a short address of 0x0001 and one board as a receiver with a short address of 0x0002. Table 2-2 Operation settings for RF Test Program JP1 1-2 short (USB side) SW5 UART side SW1 Table 2-3 Bit1 OFF Bit2 OFF Bit3 OFF Bit4 ON Bit5 ON Bit6 See table below for address choice Bit7 OFF Bit8 OFF for transmitter mode ON for receiver mode Address settings for RF Test Program Short Address SW1 0001 0002 0003 0004 Bit6 OFF ON OFF ON Bit7 OFF OFF ON ON Then connect each board to a PC with a USB cable, and open for each connection the “HyperTerminal” communication. Before opening a “HyperTerminal” session, you need to identify the COM Port number of the USB port on your PC, in order to open and set the “HyperTerminal” with the relevant COM port. For the identification of the COM port, you can use [Control Panel] -> [System] -> [Hardware] -> [Device Manager] -> [Ports (COM & LPT)]. Then start “HyperTerminal” with settings listed in the section "2.1 RF Test Program" . Now you will find the following opening menu on your PC screen. If not, please try the RESET button on the TK-78K0R/KG3+UZ board. 12 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-3 Chapter 2 Multiple test menu for the transmitter/receiver board As can be seen from the above, multiple test modes are available via simple single key operation. 2.1.2 Execution of the Transmit/Receive Test To initiate the Packet Error Rate (PER) test, please press "1" in the menu of the transmitter board. You will see [My Profile] with the short address "0001". Then, you asked to enter the destination address of the PER test, as shown below. User's Manual U19054EE2V0UM00 13 Chapter 2 Sample Applications Figure 2-4 Initiate the PER test from the transmitter Now, you may input “0002”, if the address of your receiver board is set to “0002” Then, you will be asked how many packets you wish to consume in the PER test. You may input “1000”. Then, you will be asked the interval of packets in msec. You may input "3". Then, the PER test will be executed. You will see: - Note 14 the number of packets sent, that is, 1000 as you selected, the number of the received packets, the calculated PER in %, the maximum and minimum RSSI values in the PER test. PER = Packet Error Rate RSSI = Received Signal Strength Indication User's Manual U19054EE2V0UM00 Sample Applications Figure 2-5 Chapter 2 PER test results: PER/ RSSI indication RSSI is expressed in the hexagonal value of 256 levels, which indicates the signal strength in the received signal. For more details of the RSSI value, please refer to the datasheet of the UZ2400 RF chip. Please note the PER and the RSSI are measured at the receiver side. The receiver does not send back the test packets, but only the test result. 2.1.3 Channel Setting In the previous example, you may have noticed the RF channel used in this test is the Channel 11. The channels are specified by the IEEE 802.15.4 specification. The channel 11 is assigned at 2405 MHz. You can change the channel in the PER test in 5MHz step to the maximum channel at 2480 MHz (Channel 26) To do it, please press “9” in the command prompt. Then, please choose the channel by [+], [-], [A], [B], or [C]. In the example below, the Channel 23 (2465 MHz) was selected. User's Manual U19054EE2V0UM00 15 Chapter 2 Sample Applications Figure 2-6 Modification of RF channel used To execute the PER test at the channel 23, press [Enter] on your keyboard. Then choose “1” to initiate the PER test mode. Then you may input "1000" packets in "5" msec interval to see the following example. Please confirm the channel used is Channel 23 in the display. Please note the receiver will learn which channel is to be used for the test automatically. 16 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-7 Chapter 2 PER test and results at Channel 23 2.1.4 Adjusting the Output Power You may wish to control the output power in the PER test. To do so, please select “0” in the menu. You will be asked the register number. Please input “203”. Then you will see, “LREG[203] : 00 >”. It means the current value at the register [203] is 0x00h, which means 0 dB. 0x00h is the reset default value. User's Manual U19054EE2V0UM00 17 Chapter 2 Sample Applications Figure 2-8 Menu “0” for adjusting output power The output power register bits are defined as follows: LREG[203]: Bit [7:6] -> large scale tuning 00: 0 dB 01: -10 dB 10: -20 dB 11: -30 dB Bit [5:3] -> small scale tuning 000: 0 dB 001: -1.25 dB 010: -2.5 dB 011: -3.75 dB 100: -5 dB 101: -6.25 dB 110: -7.5 dB 111: -8.75 dB Bit [2:0] -> 000 (default value) For instance, if you wish -15 dB (associated to the value 0110 0000 = 0x60h), please input “60”, as follows: “LREG[203] : 00 > 60” 18 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-9 Chapter 2 Setting output power Then, you could start the PER test again. The minimum output power is set by “F8”. User's Manual U19054EE2V0UM00 19 Chapter 2 Sample Applications Figure 2-10 Set minimum output power Then, if you try an other PER test, with the minimum output power value, you may find larger PER value with smaller RSSI value in this case. 20 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-11 Chapter 2 PER test and results at minimum output power Please note this adjustment is applied only to the transmitter. The receiver always sends back the test results with the 0 dB output power (default) using the channel 11. 2.1.5 PER Test Receiver The menu item "2" sets the board to receiver mode in the PER test. By using two PCs and two TK-78K0R/KG3+UZ boards, you can select Transmitter and Receiver board by menu items 1 and 2. If you connect only one TK-78K0R/KG3+UZ board to a PC, this will be the Transmitter one. If the Receiver board is battery powered, the receiver selection has to be done by SW1-Bit8 as described in the beginning of this chapter. 2.1.6 Continuous TX / Pseudo Noise The menu item "3" initiates the modulated RF transmission. The data carried are pseudo random numbers. You can define the channel using the menu "9", and the output power using the menu "0". 2.1.7 Continuous TX / Raw carrier The menu item "4" initiates the carrier transmission. The output power is 0 dB as a reset default. You can define the channel using the menu "9". User's Manual U19054EE2V0UM00 21 Chapter 2 Sample Applications 2.1.8 RX Mode The menu item "5" initiates the receiver mode. 2.1.9 IDLE Mode The menu item "6" sets the UZ2400 RF chip into the IDLE mode. 2.1.10 Sleep Mode The menu item "7" sets the UZ2400 RF chip into the Deep Sleep mode. 2.1.11 Standby Mode The menu item "8" sets the UZ2400 RF chip into the Standby mode. 2.1.12 Set RF Channel The menu item "9" allows you to set the RF channel. 2.1.13 Manually Set UZ2400 Chip Register The menu item "0" allows you to set the UZ2400 registers. Please refer to the datasheet of the UZ2400 RF chip for the definition of registers. 2.1.14 Resetting RF The menu item "A" allows you to reset the UZ2400 chip registers. 2.2 MAC Sample Program 1 - Text Chat With this sample program, it is possible to configure two or more nodes for a wireless text chat application. This Sample Program is working on MAC level, constructing a network utilizing the IEEE 802.15.4 PHY/MAC standard. In this MAC Sample Program 1, two or more nodes can form a star network ( a star network has a central coordinator with several nodes connecting to the coordinator only). 22 User's Manual U19054EE2V0UM00 Sample Applications Chapter 2 Node 1 Coordinator Node 2 Figure 2-12 Node 3 Star network configuration The MAC Sample Program offers: 1. 2. Designation of a network coordinator in a star configuration Text chat between a coordinator and an end device To use the MAC Sample Program 1, you need to prepare at least two PCs with USB interface and two TK-78K0R/KG3+UZ boards. MAC Sample Program 1 is provided as C source codes with the MAC Library. Text chat for one coordinator and up to 4 end devices is supported. To demonstrate this program, you will again need a simple terminal emulation program like “HyperTerminal” connected to each node of the network. 2.2.1 Setting up the boards to your PC Assumption here in this section is, you have minimum two, or maximum 5 TK-78K0R/KG3+UZ boards, in which the TK-78K0RKG3+UZ MAC sample 1 is programmed with a unique MAC address. If your boards are not programmed, you need to program each board using the source codes provided, setting a different MAC address for each board. For further details about programming the board and setting the MAC addresses, please read the section “6. IAR Sample Session” of the present manual. Please set the following switch configuration on all of your boards Table 2-4 Normal operation mode switch settings JP1 SW1 1-2 short (USB side) Bit 1 OFF Bit 2 OFF Bit 3 OFF Bit 4 ON Bit 5 ON Then, please connect each TK-78K0R/KG3+UZ board to a different PC with the USB cable provided. You could connect more than one board to the same PC and you could start more than one “HyperTerminal” session for those COM ports (obviously if you have enough USB ports available). But it could be confusing to have different USB port used and different “HyperTerminal” sessions opened on the same PC. Open for each board connected a “HyperTerminal” session. Before opening a “HyperTerminal” session, you need to identify the COM Port number of the USB port on your PC, in order to open and set the “HyperTerminal” User's Manual U19054EE2V0UM00 23 Chapter 2 Sample Applications with the relevant COM port. For the identification of the COM port, you can use [Control Panel] -> [System] -> [Hardware] -> [Device Manager] -> [Ports (COM & LPT)]. Then start “HyperTerminal” with settings listed in the section "2.1 RF Test Program" . Now you will find the following opening menu on your PC screen. If not, please try the RESET button on the TK-78K0R/KG3+UZ board. Figure 2-13 Board setup Then, press Enter on your keyboard. 24 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-14 Chapter 2 Opening menu Please do exactly the same for all the boards and PCs you want to use. 2.2.2 Designation of a coordinator Now, you must decide which board is a coordinator. Go to the PC of the coordinator board and to the “HyperTerminal” window associated, and press “C”. Figure 2-15 Coordinator selection Now the coordinator has started its operation. 2.2.3 Network Association For other PCs with other boards, please press “M” on the “HyperTerminal” window associated. User's Manual U19054EE2V0UM00 25 Chapter 2 Sample Applications Figure 2-16 Network association of an end device Now, this particular board was associated to the network as an end device with the short address of 4321. Please repeat this step for your third, fourth, and possibly fifth board. On the coordinator side, you will find the following message, if the association is successful. Figure 2-17 Network association message at the coordinator 2.2.4 Text Chat Now the network is prepared for you to start text chat between an end device and the coordinator. At first, you may start with the coordinator. Press “S” in the “HyperTerminal” window associated, then input the short address of an end device (“4321” in this example) then input your text message, up to 102 bytes (“Hello!” in this example). 26 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-18 Chapter 2 Text chat at coordinator device You will find the following message on the end device, 4321. The sender’s short address is “1975”, and the PAN ID is 2420 in this example. Figure 2-19 Text chat at end device Now, you can reply from the end device “4321” to the coordinator “1975” by inputting "S", then "1975", and your reply text. User's Manual U19054EE2V0UM00 27 Chapter 2 Sample Applications 2.3 MAC Sample Program 2 - LED Control The MAC Sample program 2 is developed to provide with another simple example to construct a star network utilizing the IEEE 802.15.4 PHY/MAC standard. The TK-78K0R/KG3+UZ boards of your 78K0R ZigBeeTM Premium Development Kit will come pre-programmed with this sample program. This LED Control sample program can run with minimum 2 and maximum 5 nodes. This sample program can run stand alone without PC. Optional, it is also possible to connect “Hyper Terminal” to the development boards and view the association and data transfer as text messages. The MAC Sample Program 2 is provided in the form of the C source codes with the MAC library. 2.3.1 Setting up the boards To begin the demonstration, you need to have minimum two TK-78K0R/KG3+UZ boards, in which the TK-78K0RKG3+UZ MAC sample 2 is programmed (it is already done in the preprogrammed boards provided in the 78K0R ZigBeeTM Premium Development Kit). If your boards are not programmed, you need to program each board using the source codes provided. For further details about programming the board, please read the section "6. IAR Sample Session" of the present manual. When your boards are programmed, that is to say ready for the demonstration, please set the following switch configuration to all your boards. Table 2-5 Operation mode switch settings JP1 SW1 1-2 short (USB side) Bit1 OFF Bit2 OFF Bit3 OFF Bit4 ON Bit5 ON 2.3.2 Starting up a Coordinator Once you have chosen which board will be the coordinator, you could connect this board to your PC (with one of the USB cables provided). To enable this board to be the Coordinator, it is necessary to set dip switch SW1Bit8 to the ON position. It is necessary to reset the unit as the SW1-Bit8 is only read following a reset. Note that the coordinator will take the default MAC address of the program. You must only enable one board to be the Coordinator on the network. All other modules must be End Devices, so please ensure that all of the other boards have SW1-Bit8 set to the OFF position. 28 User's Manual U19054EE2V0UM00 Sample Applications Chapter 2 2.3.3 Starting up End Devices You could now connect all the other boards, that is to say the End Devices; as you could see just after it could be necessary to hold the SW2 in a different position. To ensure that each End Device joins the network reliably, it is necessary to associate on to the network with a different network address for each End Device. This is achieved by the following process: Press the reset switch (SW5) and any of the switch positions of the directional switch (SW2). Release the reset switch (SW5). Wait one second and then release the directional switch (SW2). The nodes will then associate to the Coordinator and form a star network. The following table shows how the addresses are allocated depending upon the selection of SW2 following a reset. Table 2-6 Note SW2 address selection SW2 UP Position Selected Default Address + 1 SW2 CENTER Position Selected Default Address + 2 SW2 LEFT Position Selected Default Address + 3 SW2 RIGHT Position Selected Default Address + 4 SW2 DOWN Position Selected Default Address + 5 SW2 DEFAULT Position Selected Default Address + 6 Please make sure SW2 is always active in a different position following a reset, in order to avoid that end devices will try and associate using the same address. 2.3.4 Operation The coordinator generates beacon at channel 11 of 2405 MHz. An end device makes a network association. If successful, LED4 on the board is ON. When an End device and the Coordinator are successfully associated, pressing SW3 on the End Device will cause LED2 to blink on the Coordinator and pressing SW4 on the End Device will cause LED3 to blink on the Coordinator. The number of times of blink depends on the sequence the End Device joined in the network. For instance, if an End Device is the third End Device for the network, the LED will blink three times. Table 2-7 Correspondence between End Device action and Coordinator LED on Coordinator SW on End Device LED2 SW3 LED3 SW4 User's Manual U19054EE2V0UM00 29 Chapter 2 Sample Applications 2.3.5 Using Terminal Program It is also possible to connect “HyperTerminal” to the development boards and view the association and data transfer as text messages. If you connect the HyperTerminal with your Coordinator and push the reset button on the Coordinator board, the following opening message will appear. If not, please check COM port setting of your USB connection. Figure 2-20 Coordinator startup Now the coordinator has started up successfully. If you start up End Devices, as described in the section "2.3.3 Starting up an end devices" , pressing reset and keeping the directional switch on the UP position, the following messages will appear on the HyperTerminal. 30 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-21 Chapter 2 Short address assignment End Device 1 A short address of “4352” was assigned to the board. A short address is assigned sequentially, independent from the long address. You see the following message on the coordinator side. User's Manual U19054EE2V0UM00 31 Chapter 2 Sample Applications Figure 2-22 Association successful from the Coordinator side The following example shows the association o of the fifth End Device “4356”. Then the SW4 on this fifth End Device was pushed and then the switch SW3. You will see the LED2 on the Coordinator will blink 5 times, and then LED3 will blink 5 times too. The default PAN ID of this network is “2420”. 32 User's Manual U19054EE2V0UM00 Sample Applications Figure 2-23 Chapter 2 Signal Sent to Coordinator User's Manual U19054EE2V0UM00 33 Chapter 3 Hardware specification TK-78K0R/KG3 +UZ Table 3-1 General hardware features (TK-78K0R/KG3+UZ) Item Details Part number μPD78F1168GC Clock Main = 20 MHz Subclock = 32.768 kHz CPU Internal flash memory 512 kB Internal RAM 30 kB Operation voltage 5 V (supply from USB) 9 V (Supply from a battery, minimum 6.5 V) USB interface Mini USB x 1 channel RF board UZ2400 RF Board Temperature sensor Temperature sensor x 1 LED LED 1 = Power LED 2 - 4 = Multipurpose Multipurpose input 4 directional switch with center push x 1 Push switch x 2 Reset Switch Push switch x 1 OCD/MiniCube interface Connector mounted On board Flash memory writing Possible via MiniCube Interface 3.1 Terminal list Following are the terminal tables of CN1, CN3 and CN4 of the TK-78K0R/KG3+UZ CPU board. Table 3-2 34 Connector CN1 terminal list (TK-78K0R/KG3+UZ) CN1 Signal name Terminal CPU name at connection destination 1 P142 P142/SCK20/SCL20 2 P141 P141/PCLBUZ1/INTP7 3 P140 P140/PCLBUZ0/INTP6 4 P47 P47/INTP2 5 P46 P46/INTP1/TI05/TO05 6 P45 P45/SO01 7 P44 P44/SI01 8 P42 P42/TI04/TO04 9 T_RESET 10 P120 P120/INTP0/EXLVI 11 GND GND Notes Connected to reset circuit User's Manual U19054EE2V0UM00 Hardware specification TK-78K0R/KG3+UZ Chapter 3 CN1 Signal name Terminal CPU name at connection destination 12 GND GND 13 VDD VDD 14 VDD VDD 15 P22 P22/ANI2 16 P21 P21/ANI1 17 P20 P20/ANI0 18 P63 P63 19 P64 P64/RD 20 P65 P65/WR0 21 P66 P66/WR1 22 P77 P77/EX23/KR7/INTP11 23 P06 P06/WAIT 24 P05 P05/CLKOUT 25 GND GND 26 P30 P30.INTP3/RTC1HZ 27 P27 P27/ANI7 28 P54 P54/EX12 29 P55 P55/EX13 30 P17 P17/EX31/TI02/TO02 31 P15 P15/EX29/RTCDIV/RTCCL 32 P12 P12/EX26/SO00/TxD0 33 P11 P11/EX25/SI00/RxD0 34 P10 P10/EX24/SCK00 35 VDD VDD 36 P110 P110/ANO0 37 P111 P111/ANO1 38 VDD VDD 39 GND GND 40 P153 P153/ANI11 41 P152 P152/ANI10 42 P151 P151/ANI9 43 P150 P150/ANI8 44 P25 P25/ANI5 45 P24 P24/ANI4 46 P23 P23/ANI3 47 P131 P131/TI06/TO06 48 P145 P145/TI07/TO07 49 P144 P144/SO20/TxD2 50 P143 P143/SI20/RxD2/SDA20 User's Manual U19054EE2V0UM00 Notes 35 Chapter 3 Hardware specification TK-78K0R/KG3+UZ Figure 3-1 Table 3-3 Connector CN1 pin configuration (TK-78K0R/KG3+UZ) Connector CN3 terminal list CN3 Signal name Terminal CPU name at connection destination 1 GND GND 2 3 N.C. VREG_EN P50/EX8 4 5 RESn P51/EX9 Output from CPU 6 FIFO P52/EX10 Input to CPU 8 N.C. FIFOP P31/TI03/TO03/INTP4 9 10 12 CCA P53/EX11 SFD P16/EX30/TI01/TO01/INTP5 Input to CPU N.C. CSn P43/SCK01 15 16 Input to CPU N.C. 13 14 Input to CPU N.C. 11 Output from CPU N.C. SCLK P04/SCK10/SCL10 17 Output from CPU N.C. 18 SI P02/SO10/TxD1 19 GND GND 20 SO P03/SI10/RxD1/SDA10 Output from CPU Input to CPU Connector CN4 terminal list CN4 Signal name 36 Output from CPU N.C. 7 Table 3-4 Notes 1 TP5 2 GND 3 TP5 4 GND 5 TP5 6 GND 7 3.3V 8 GND 9 3.3V 10 GND 11 TP4 12 GND 13 TP3 Terminal CPU name at connection destination GND GND GND GND GND GND User's Manual U19054EE2V0UM00 Notes Hardware specification TK-78K0R/KG3+UZ Chapter 3 CN4 Signal name Terminal CPU name at connection destination 14 GND GND 15 16 N.C. GND GND 17 18 N.C. GND GND 19 20 Figure 3-2 Notes N.C. GND GND Connector CN3 (left) and CN4 (right) pin configuration 3.2 Switches 3.2.1 SW1 Bit1, 2, 3, 4 and 5 of SW1 are dip switches for Operation Mode setting. Bit6, 7 and 8 of SW1 are connected to general purpose ports P80, P81 and P82 for multipurpose input. Figure 3-3 3.2.1.1 Dip Switches SW1 (TK-78K0R/KG3+UZ) On-chip debug Mode with the IAR TK-interface For using the on chip debug function via the TK interface of IAR, use the following settings. Table 3-5 On-chip debug mode settings for the TK-78K0R/KG3+UZ SW1 Bit 1 ON/OFF Note1 Bit 2 ON Bit 3 ON Bit 4 OFF Bit 5 OFF User's Manual U19054EE2V0UM00 37 Chapter 3 Hardware specification TK-78K0R/KG3+UZ Notes 1. 2. * ON: The microcontroller stays being reset until TK interface is started. * OFF: The microcontroller runs the programs stored in the flash memory as soon as it gets power supply. If you use IAR TK interface for debugging, it uses P40 and P41 for communicating with host machine. Therefore, you cannot use P40 and P41 as general purpose serial communication at the same time. To run the programs stored in built-in flash memory (without using the TK interface of IAR), please use following settings and re-supply USB power (or make a hardware reset). You can use the On-chip debug function via the Minicube 2 and not by using IAR TK-interface. In this case refer to the following section with the table 3-7. Table 3-6 Normal Operation Mode for the TK-78K0R/KG3+UZ (Serial communication via USB connector not available) SW1 Note 3.2.1.2 Bit 1 OFF Bit 2 OFF Bit 3 OFF Bit 4 OFF Bit 5 OFF In this case, the serial communication via P40 and P41 will still not be available, because these ports are not connected to the USB connector (SWI-bit 4 and 5 are OFF). Normal Operation Mode and Minicube2 Use Please change to the following settings when you execute the program normally, or when you use the MiniCube2 for programming or On-chip debug session. Obviously in this case the serial communication via the USB port is available for the application. Table 3-7 Normal Operation Mode for the TK-78K0R/KG3+UZ (Serial communication via USB connector enabled) SW1 3.2.1.3 Bit 1 OFF Bit 2 OFF Bit 3 OFF Bit 4 ON Bit 5 ON General purpose setting port Bit 6, 7 and 8 of SW1 are general purpose setting ports. The port state is “Low” (because it is connected to GND) when the switch is ON. The port state is “High” (because it is connected to a 10kΩ pull-up resistor) when the switch is OFF. 38 User's Manual U19054EE2V0UM00 Hardware specification TK-78K0R/KG3+UZ Table 3-8 Chapter 3 Switch SW1.bit6-8 terminal list (TK-78K0R/KG3+UZ) SW1 Signal name Terminal CPU name at connection destination Bit 6 P80 P80/EX0 Bit 7 P81 P81/EX1 Bit 8 P82 P82/EX2 3.2.2 SW2 SW2 is a four directional switch with centre push. If it is directed or pushed, the input is set to GND. Otherwise the circuit is open. Therefore please set the onchip pull-up resistors (PU7) during initializing routine of your program code. (For more detail, please refer to the User’s manual of the μPD78F1168 CPU.) Table 3-9 Figure 3-4 Directional switch SW2 terminal list (TK-78K0R/KG3+UZ) SW2 Signal name Terminal CPU name at connection destination Notes 1 P72 P72/EX18/KR2 UP 2 P73 P73/EX19/KR3 CENTER PUSH 3 P74 P74/EX20/KR4/INTP8 LEFT 4 P75 P75/EX21/KR5/INTP9 RIGHT 5 GND GND 6 P76 P76/EX22/KR6/INTP10 DOWN Directional switch SW2 (TK-78K0R/KG3+UZ) 3.2.3 SW3, SW4 SW3 and SW4 are push switches. They are connected to pull-up resistors, and their outputs go “Low”, when they are pushed. Table 3-10 SW3 and SW4 terminal list Switch Signal name Terminal CPU name at connection destination SW3 P70 P70/EX16/KR0 SW4 P71 P71/EX17/KR1 User's Manual U19054EE2V0UM00 39 Chapter 3 Hardware specification TK-78K0R/KG3+UZ Figure 3-5 Switches SW3 (right) and SW4 (left) 3.2.4 SW5 SW5 is the reset switch. The TK-78K0R/KG3+UZ board is reset when SW5 is pushed. Figure 3-6 Switch SW5 3.3 Jumper JP1 This jumper switches the power supply of the board. Table 3-11 JP1 connection JP1 1-2pin short Supply power from USB connected to USB1 2-3pin short Supply power from batteries connected to CN2 3.4 LEDs 3.4.1 LED1 The “Power LED” LED1 is activated when the power supply is turned on. Figure 3-7 40 LED1 as Power LED (TK-78K0R/KG3+UZ) User's Manual U19054EE2V0UM00 Hardware specification TK-78K0R/KG3+UZ Chapter 3 3.4.2 LED2, LED3 and LED4 LED2, 3 and 4 are available for applications. To turn on a LED, set the output port to “Low”. Table 3-12 Figure 3-8 LED 2, 3 and 4 terminal list (TK-78K0R/KG3+UZ) LED Signal name Terminal CPU name at connection destination LED2 P62 P62 LED3 P61 P61/SDA0 LED4 P60 P60/SCL0 LED 2, 3 and 4 (TK-78K0R/KG3+UZ) 3.5 FP1 The connector FP1 allows connecting the Minicube2 On-Chip debug emulator to the TK-78K0R/KG3+UZ board in order to use On-Chip debug function of the 78K0R/KG3 device. Please note, Minicube2 is a separate product from NEC Electronics and it is not included in this 78K0R ZigBeeTM Premium Development Kit. Figure 3-9 MiniCube connector FP1 3.6 Power Supply There are two choices to supply power to the board, USB or a 6LR614 9V battery via CN2. Please refer to the following table for the jumper setting. Table 3-13 JP1 Setting for the power supply source JP1 USB Power USB (1-2pin short) Battery CN2 (2-3pin short) Please replace the battery with a new one, if the voltage level goes down to 4.8V. Below the voltage level of 4.8V, functions of the board are not guaranteed. The battery voltage can be checked at the port as shown below. User's Manual U19054EE2V0UM00 41 Chapter 3 Hardware specification TK-78K0R/KG3+UZ Table 3-14 9V battery checking Signal name BT_MONI Terminal CPU name at connection Notes destination 33.8% of the battery is available at the input of power supply ANI6 For instance, If the battery level 9V: The level of the BT_MONI = 0.338 x 9.0 = 3.042 V If the battery level is 6.5V: The level of the BT_MONI = 0.338 x 4.8 = 1.622 V P26/ANI6 3.7 Universal Area The kit has the universal area. Users can use this to develop custom circuit. Figure 3-10 Universal test area 3.8 Soldering Bridges Additional configuration of the TK-78K0R/KG3+UZ board can be done by the soldering bridges. With using the soldering bridge to cut the circuit, users can customize the circuit. To open, use cutter to cut the dent part. To short, put solder on the pad. Figure 3-11 Table 3-15 Soldering bridge configuration Soldering bridge connection Soldering bridge name P150~P153 42 Configuration Connection Closed (default) 1MΩ Pull-down Opened Associated pin on CN1 is used User's Manual U19054EE2V0UM00 Hardware specification TK-78K0R/KG3+UZ Chapter 3 3.9 Temperature Sensor The TK-78K0R/KG3+UZ board has a temperature sensor for measuring the ambient temperature of the PWB board. It is connected to the analogue input pin P27/ANI7 of the microcontroller. • • • Temperature sensor S-8120C (Made by SII) Power supply of sensor: +3.3 V Linear output voltage : -8.20mV/°C ( from -20°C to 80°C ) Please refer to the datasheet for details. 3.10 Design Data and Parts Layout User's Manual U19054EE2V0UM00 43 Chapter 3 Hardware specification TK-78K0R/KG3+UZ 3.10.1 Parts Layout Figure 3-12 44 Hardware overview of the TK-78K0R/KG3+UZ board User's Manual U19054EE2V0UM00 Hardware specification TK-78K0R/KG3+UZ Chapter 3 3.10.2 RF Board Connection Figure_K0R Figure 3-13 Overview of the connection of the RF board (TK-78K0R/KG3+UZ) User's Manual U19054EE2V0UM00 45 Chapter 4 Hardware specification 78K0R_UZ_Stick The 78K0R_UZ_Stick is an additional module based on the NEC 78K0R/KE3 microcontroller. This module can be used as either a network node or a dedicated hardware module for interfacing to the Air Sniffer application ( part of the ZigBeeTM SDK) depending upon the flash program loaded on to the module. 4.1 Main Features Features of the 78K0R_UZ_Stick include: • • • • • • • • • • • • Note Table 4-1 The board uses the NEC Electronics 16-bit single chip microcontroller (μPD78F1146). Hardware is compliant with IEEE 802.15.4/ZigBee™ wireless personal area network. Object code of IEEE 802.15.4 PHY/MAC is included in the kit and possible to utilize as a library. 256 kB of Flash memory, available on chip in the 78K0R/KE3 microcontroller The board contents a 2.4GHz transceiver chip UZ2400 (Accordance with IEEE 802.15.4 ZigBeeTM Specifications for Low Rate Wireless Personal Area Networks) made by Uniband Electronic Corporation. ( http://www.ubec.com.tw/index.html) Board includes an antenna made by Gigaant and a temperature sensor (S-8120 CNB) made by Seiko ( http://www.gigaant.com and http://www.sii.co.jp) Enable to connect an On-Chip Debug Emulator MINICUBE (QB-78K0MINI or QB-MINI2). An optional additional adaptor (SICA10I2P) is required. USB connection can be utilized not only for debugging sessions (using the IAR TK interface), but also for user applications and power supply. Real time clock is available on the board. Power source can be selectable between USB or battery by a switch. Three orange LEDs are available on board for applications, in addition to one green LED for power indication. The size of the module is 82 x 23 mm. Please inquire direct to the parts maker about specification of UZ2400 RF board, antenna and temperature sensor. General hardware features (78K0R_UZ_Stick) Item Details Part number μPD78F1146GB Clock Main = 20 MHz Subclock = 32.768 kHz CPU 46 Internal flash memory 256 kB Internal RAM 12 kB User's Manual U19054EE2V0UM00 Hardware specification 78K0R_UZ_Stick Item Chapter 4 Details Operation voltage 5 V (supply from USB) 4.75 - 10 V (Supply from a battery) USB interface USB connector type A RF board UZ2400 RF Board Temperature sensor Temperature sensor x 1 LED Green LED = Power Orange LED 1 - 3 = Multipurpose OCD/MiniCube interface MINICUBE2 connector (CN1) 4.2 Block Diagram Figure 4-1 78K0R_UZ_Stick block diagram 4.3 Interface Connection User's Manual U19054EE2V0UM00 47 Chapter 4 Hardware specification 78K0R_UZ_Stick 4.3.1 CN1 - Minicube Connector CN1 is the Minicube2 connector. You need to use the conversion connector SICA1612P when you use the Minicube2. Table 4-2 Figure 4-2 Connector CN1 terminal list (78K0R_UZ_Stick) CN1 Signal name Terminal CPU name at connection destination 1 GND P142/SCK20/SCL20 2 RESET_OUT RESET 3 RXD P40/TOOL0 4 VDD VDD 5 TXD P40/TOOL0 6 N.C. N.C. 7 N.C. N.C. 8 N.C. N.C. 9 N.C. N.C. 10 N.C. N.C. 11 N.C. N.C. 12 N.C. N.C. 13 N.C. N.C. 14 FLMD0 FLMD0 15 RESET_IN N.C. 16 CLK_IN P41/TOOL1 17 N.C. N.C. 18 N.C. N.C. 19 N.C. N.C. 20 N.C. N.C. Notes Reset trigger signal Location of CN1 - Top view (78K0R_UZ_Stick) 4.3.2 CN2 - Expansion Connector The expansion connector provides one serial I/O port, UART or CSI, one interrupt input port, and three analogue input ports. It also provides with a connection to a 6LR614 9V battery. 48 User's Manual U19054EE2V0UM00 Hardware specification 78K0R_UZ_Stick Table 4-3 Figure 4-3 Chapter 4 Connector CN2 terminal list (78K0R_UZ_Stick) CN2 Signal name Terminal CPU name at connection destination 1 GND GND 2 VBAT N.C. 3 P10 P10/SO00/TxD0 4 P11 P11/SI00/RxD0 5 P141 P141/PCLBUZ1/INTP7 6 P10 P10/SCK00 7 P25 P25/ANI5 8 P23. P23/ANI3 9 P24 P24/ANI4 10 GND GNDN.C. Notes From battery Location of CN2 - Top view (78K0R_UZ_Stick) 4.4 Switches and LEDs 4.4.1 SW1 - Power Switch SW1 is used for the selection of power source : USB power or battery power (via CN2) Table 4-4 Figure 4-4 Notes Power supply setting of SW1 (78K0R_UZ_Stick) USB Power USB CN2 connector: expansion for battery interface BAT Top view of SW1 (78K0R_UZ_Stick) 1. The 78K0R_UZ_Stick module is equipped with a voltage regulator, which regulates the source of 4.75 -10.0 V to 3.3V. User's Manual U19054EE2V0UM00 49 Chapter 4 Hardware specification 78K0R_UZ_Stick 2. The power consumption of the module largely depends on the status of the driver of the USB interface. One example of measured consumed current is, 60 mA in case USB is not connected, while 80 mA while USB is connected. 4.4.2 SW2 - USB Interface SW1 is used for selecting the USB interface use: Debugging interface or general serial communication. When it is set to “SER”, it enables the serial communication UART connect to the 78K0R_UZ_Stick to the USB interface after switch setting. Table 4-5 Figure 4-5 USB interface setting of SW2 (78K0R_UZ_Stick) Normal mode (or Minicube2 use) SER Debug mode (USB interface used for TK interface of IAR) DBG Top view of SW2 (78K0R_UZ_Stick) 4.4.3 LED1 - Power Indication LED1 is a green LED to indicate the availability of power Table 4-6 Figure 4-6 LED1 status (78K0R_UZ_Stick) Status LED Power ON Green Power OFF Off Top view of LED1 layout (78K0R_UZ_Stick) 4.4.4 LED2, LED3 and LED4 LED2, LED3 and LED4 are available for applications. They emit orange by setting respectively the output pins P62, P61 and P60 of the microcontroller to “Low”. Table 4-7 50 LED2, LED3 and LED4 terminal list (78K0R_UZ_Stick) LED Name MCU pin Port Level LED2 P62 P62 LOW for orange User's Manual U19054EE2V0UM00 Hardware specification 78K0R_UZ_Stick LED Name Chapter 4 MCU pin Port Level HIGH for OFF Figure 4-7 LED3 P61 P61/SDA0 LED4 P60 P60/SCL0 LOW for orange HIGH for OFF LOW for orange HIGH for OFF Top view of LED2, LED3 and LED4 layout (78K0R_UZ_Stick) 4.5 Design Data and Parts Layout Figure 4-8 Top view of 78K0R_UZ_Stick layout Figure 4-9 Top view of 78K0R_UZ_Stick User's Manual U19054EE2V0UM00 51 Chapter 5 78K0R ZigBee™ PRO Premium Development Kit, Installation and Operation The IAR Embedded Workbench including the C-SPY debugger allows the user to build and download application programs to the 78K0R ZigBeeTM PRO Premium Development Kit. As the communication interface between the PC host system and the 78K0R ZigBeeTM PRO Premium Development Kit board is USB, a USB interface line is needed. Before you can download and run a program, relevant software and hardware must be installed properly. CDROM contents: • • • • IAR Embedded Workbench for 78K0 Kickstart version IEEE 802.15.4 MAC library Sample Programs Documentation 5.1 Hardware Installation After unpacking 78K0R ZigBeeTM PRO Premium Development Kit, connect one of the boards to your host computer using one provided USB interface cable. When one of the 78K0R ZigBeeTM PRO Premium Development Kit boards is connected, the USB driver needs to be installed on the host machine. Please refer to the specific section "5.3 USB Driver Installation" . 5.2 Software Installation The 78K0R ZigBeeTM PRO Premium Development Kit package comes with the following software demo packages: - IAR Systems Embedded Workbench for 78K0/78K0S/78K0R including C compiler, assembler, linker, librarian and IAR C-SPYdebugger / simulator Sample programs 5.2.1 IAR Systems Embedded Workbench Installation The IAR Systems Embedded Workbench must be installed on your PC. For detailed installation hints, refer to the following chapters and to the corresponding documentation of the IAR Embedded Workbench. To install the IAR Systems Embedded Workbench for 78K0/78K0S/78K0R including C-SPY debugger / simulator, select the AUTORUN program in the directory <CD>\IAR of the CDROM. The setup dialogues will guide you through the installation process. 52 User's Manual U19054EE2V0UM00 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Chapter 5 5.2.2 Sample Program Installation To install the sample/demonstration programs for the 78K0R ZigBeeTM PRO Premium Development Kit board select the SETUP program in the directory <CD> \78K0R SamplePrograms\ of the CDROM. The setup dialogue will guide you through the installation process. 5.3 USB Driver Installation In order to use the 78K0R ZigBeeTM PRO Premium Development Kit board for OnChip debugging, the USB driver needs to be installed on the host machine. Install the drivers according to the following procedure: • • Note Installation on Windows 2000: section "5.3.1 Installation on Windows 2000" Installation on Windows XP: section "5.3.2 Installation on Windows XP" The USB driver is part of the IAR Embedded Workbench software package. Therefore please install the IAR Embedded Workbench first. 5.3.1 Installation on Windows 2000 When the 78K0R ZigBee™ PRO Premium Development Kit is connected with the host machine, the board is recognized by Plug and Play, and the wizard for finding new hardware is started. Click "Next >". Figure 5-1 Found New Hardware Wizard (Widows 2000) User's Manual U19054EE2V0UM00 53 Chapter 5 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation The window below is displayed. So, check that "Search for a suitable driver ..." is selected, then click "Next >". Figure 5-2 Search Method (Windows 2000) Check the "Specify a location" check box only, then click "Next >". Figure 5-3 Driver File Location (Windows 2000) Locate to the folder “C:\Program Files\IAR Systems\Embedded Workbench 4.0 \78K\config\nec\ie_pc_driver\MINICUBE”. 54 User's Manual U19054EE2V0UM00 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Figure 5-4 Remark Chapter 5 Address specification 1 (Windows 2000) If the installation destination folder is changed at the time of IAR Embedded Workbench installation, enter “<new-folder>\78K\config\nec\ie_pc_driver \MINICUBE”. The setup information file “MQB2ALL.inf” is automatic selected, then click “Open” to proceed within driver installation. Figure 5-5 Address specification 2 (Windows 2000) After the location of the USB driver has been specified click “OK” to proceed. User's Manual U19054EE2V0UM00 55 Chapter 5 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Figure 5-6 Address specification 3 (Windows 2000) Click "Next >". Figure 5-7 Driver File Search (Windows 2000) Click “Finish” to complete the installation of the USB driver. 56 User's Manual U19054EE2V0UM00 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Figure 5-8 Chapter 5 USB Driver Installation Completion (Windows 2000) 5.3.2 Installation on Windows XP When the 78K0R ZigBee™ PRO Premium Development Kit board is connected with the host machine, the board is recognized by Plug and Play, and the wizard for finding new hardware is started. Check that "Install from a list or specific ..." is selected, then click "Next >". Figure 5-9 Found New Hardware Wizard 1 (Windows XP) User's Manual U19054EE2V0UM00 57 Chapter 5 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Check that “Install from a list or specific location (Advanced)” is selected, then click “Next >”. Figure 5-10 Found New Hardware Wizard 2 (Windows XP) Check that “Search for the best driver in these locations.” is selected. Select the “Include this location in the search:” check box and then click “Browse”. Enter “C:\Program Files\IAR Systems\Embedded Workbench 4.0\78K\config\nec \ie_pc_driver\MINICUBE” in the address bar. After the USB driver has been specified click “Next >”. 58 User's Manual U19054EE2V0UM00 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Figure 5-11 Chapter 5 Search location specification (Windows XP) As shown below, “has not passed Windows Logo testing to verify its compatibility with Windows XP.” is displayed. Click “Continue Anyway”. Figure 5-12 Windows XP Logo Testing (Windows XP) When the window below is displayed, the installation of the USB driver is completed. Click “Finish”. User's Manual U19054EE2V0UM00 59 Chapter 5 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Figure 5-13 USB Serial Port Driver Installation Completion (Windows XP) 5.3.3 Confirmation of USB Driver Installation After installing the USB driver, check that the driver has been installed normally, according to the procedure below. When using the 78K0R ZigBeeTM PRO Premium Development Kit board in combination with IAR C-SPY Debugger the “NEC Electronics Starter Kit Virtual UART” should be present in the “Device Manager” tab, like in the figure below. To check that the drivers are installed normally in the “Device Manager”, go to Windows [Start] Menu -> [Control Panel] -> [System] -> [Hardware] -> [Device Manager] -> [Ports (COM & LPT)]. 60 User's Manual U19054EE2V0UM00 78K0R ZigBee⢠PRO Premium Development Kit, Installation and Operation Figure 5-14 Chapter 5 Checking the driver installations in the «Device Manager» User's Manual U19054EE2V0UM00 61 Chapter 6 IAR Sample Session 6.1 Loading a Project and Programming the Board When everything is set up correctly the IAR Embedded Workbench can be started. To do so, start the Embedded Workbench from Windows [Start] menu -> [All programs] -> [IAR Systems] -> [IAR Embedded Workbench Kickstart for NEC 78K] -> [IAR Embedded Workbench]. The following screen appears: Figure 6-1 IAR Embedded Workbench startup menu Then, open the workspace of the Sample Programs for the TK-78K0R/KG3+UZ board: [File] -> [Open] -> [Workspace] or select “Open existing project” in the start window of IAR. Locate the sample project Programs for the TK-78K0R/KG3+UZ board. By default, the installation folder is: “C:\MyDocuments\78K0RSamplePrograms \TK-78K0RKG3+UZ”. Open the file “TK-78K0RKG3+UZ.eww”. This is the workspace file that contains general information about the demonstration projects and corresponding settings. After the workspace has been opened the projects contained in the workspace are displayed. You should now select the project on which you want to work with the list box at the top of the workspace window. For example, you could chose the project “TK-78K0RKG3 MAC sample 1 - Debug”, then it will appear in bold in the project list. Now click on the little “+” sign next to this project filename to show all files that were part of this selected project. The screen should now look similar to this: 62 User's Manual U19054EE2V0UM00 IAR Sample Session Figure 6-2 Chapter 6 IAR project workspace As a next step check some settings of the IAR Embedded Workbench that have to be made for correct operation and usage of the On-Board debug function of the TK-78K0R/KG3+UZ board. Similar settings should also be done in order to flash program the board via the TK interface of IAR. First highlight the upper project folder called “TK-78K0RKG3 MAC sample 1 – Debug” in the workspace window. Then select [Project] -> [Options] from the pulldown menus. Next select the category “Debugger”. Make sure that the driver is set to “TK-78” in order to use the On-Board debug function of the TK-78K0R/KG3+UZ board. The device description file must be set to “io78f1168_a0.ddf”. The corresponding COM port where the TK-78K0R/KG3+UZ board is connected to the host PC will be detected automatically by the IAR C-SPY debugger. User's Manual U19054EE2V0UM00 63 Chapter 6 IAR Sample Session Figure 6-3 IAR Debugger options Then it is required to check that the right output file format is selected. Select the category “Linker”. Select the “Output” tab and check that the output format will contained the debug information for the C-Spy debugger like in the screen below; Important Remark 64 When you are working with the TK interface of IAR to debug or to flash program a sample project, always ensure that the Debug output file format for the C-spy debugger of IAR is selected. User's Manual U19054EE2V0UM00 IAR Sample Session Figure 6-4 Chapter 6 Debug output file format setting Next the correct linker settings of the demo project will be checked. This can be done in the “Linker” category as shown below. Select the “Config” tab and check that the linker command file “lnk78f1166_a0.xcl” which is located in the directory “xcl” of the project is selected. This file is used by the linker and contains information on where to place the different sections of code, data and constants that may be used within the demo project: User's Manual U19054EE2V0UM00 65 Chapter 6 IAR Sample Session Figure 6-5 IAR Linker options Now after everything has been setup correctly it is time to compile and link the demonstration project. Close the “Options” menu and select “Rebuild All” from the “Project” menu. If the project is compiled and linked without errors or warnings it can now be downloaded to the TK-78K0R/KG3+UZ board and debugged. Before starting a debug session, please check that the target board configuration is set according to the settings written in the section "On-chip debug mode with IAR TK-interface" . Then, to start the IAR C-SPY debugger select the option “Debug” from the “Project” menu or press the “Debugger” button. In the next step the TK-78 Emulator has to be configured before downloading a new application. Press the OK button to enter the emulator hardware setup. Set the configuration as show in the figure below and start the download by pressing the OK button. 66 User's Manual U19054EE2V0UM00 IAR Sample Session Figure 6-7 Chapter 6 TK-78 hardware setup menu Now the debugger is started and the demo project is downloaded to the TK-78K0R/KG3+UZ board. The progress of downloading is indicated by blue dots in the TK-78 Emulator window. Please note, downloading of larger executables can take some time. After the download was completed all debug features of IAR C-SPY debugger are available, i.e. Single Stepping, Step Over/-In/-Out, Go-Execution, Breakpoints, Register / Memory view etc. To get more details on the debugger configuration and capabilities please refer to the “78K IAR Embedded Workbench IDE User Guide” of the IAR installation. User's Manual U19054EE2V0UM00 67 Chapter 6 IAR Sample Session Figure 6-8 IAR C-SPY Debugger 6.2 Generating and Flash Programming a Hex File The 78K0R/KG3+UZ boards will come pre-programmed with the “MAC sample program 2” application. In order to demonstrate the other applications or to develop your own application, you should know how to generate and program a hex file into a board. Generation of a hex file: To generate an output file for flash programming purpose, please select the “Release” target of your project. Then rebuild the project by selecting [Project] > [Options] -> [Rebuilt all]. You should see the HEX file in the workspace under the directory “Output”. 68 User's Manual U19054EE2V0UM00 IAR Sample Session Figure 6-9 Chapter 6 Workspace of the MAC Sample Program 1 Location of your hex file: The generated HEX file is located in the output directory chosen for “Executable/ Libraries”. All output file directory are defined in the Embedded Workbench menu [Project] -> [Options] -> [General Options] -> [Output]. Figure 6-10 IAR output files location In our case the directory of the MAC Sample Program 1 will be found under the folder “Exe” in the folder “Release” of the project (see the structure of the project in the section "7.1 Introduction and Structure"). User's Manual U19054EE2V0UM00 69 Chapter 6 IAR Sample Session Name and format of your hex file: The name of your output file and its format can be easily customized in the following menu that is shown in the screen below: [Project] -> [Options] -> [Linker] -> [Output]. Figure 6-11 IAR output files settings: name and format Programming the Hex file with the corresponding project: When you just come to generate the HEX file with IAR from your “Release” target of a project, it is really easy to program it into the board: you just need to download it with the button “Debug” or with the command [Project] -> [Debug]. When the download is complete you should click the “Stop debugging” button: and disconnect the board. But before programming the board, you should: - - 70 Select “TK-78” in the menu [Options] -> [Debugger] -> [Setup] -> [Driver]. When the microcontroller is part of the family 78K0R, you do not need to select the COM port of connection because IAR do that automatically. But you need to check that the board is the only one connected to your PC to avoid confusion. Disable the item “Run to main” in the menu [Options] -> [Debugger] -> [Setup] Disable the load of the stack plugin in the menu [Options] -> [Debugger] -> [Plugins] Set the switch in the right position given by the Table 3-4 3.5 “On chip debug mode for the TK-78K0R/KG3+UZ”. User's Manual U19054EE2V0UM00 IAR Sample Session Chapter 6 - Connect the board via the USB cable provided Programming the Hex file with a default project: If you want to program a HEX file in your TK-78K0R/KG3+UZ board but you have not the corresponding source project for IAR, you could follow these instructions: Open any IAR project for the TK-78K0R board (RF test, MAC sample program 1 or 2), select the “Release” target. Select “TK-78” in the [Options] -> [Debugger] -> [Setup] -> [Driver]. Disable the item “Run to main” in the menu [Options] -> [Debugger] -> [Setup]. Disable the load of the stack plugin in the menu [Options] -> [Debugger] -> [Plugins]. Set the switch in the right position given by the Table 3-4 3.5 “On chip debug mode for the TK-78K0R/KG3+UZ”. Connect the board via the USB cable provided (and remove any other board connected). Replace the original HEX file of the opened project by the one you want to program, and give it the same name (see the section ”Location of your hex file” and ”Name of your hex file”). What is really primordial is to change the option of IAR in order you could program the board with your chosen HEX file putting in the location of this default project. You should select “Ask” in the following menu [Tools] -> [Options] -> [Project] -> [Make before debugging]. Figure 6-13 IAR environment option setting Now you could program the board with the Debug button or by selecting the command [Project] -> [Debug]. A window will ask the following question you should answer “NO”. User's Manual U19054EE2V0UM00 71 Chapter 6 IAR Sample Session Figure 6-14 Question before debugging After you board will be programmed, it could take more or less time depending on the size of your program. When the download is complete, you should click the “Stop Debugging”button and disconnect the board. Notes 1. 2. In the case you want to program a HEX file into the stick via the TK interface of IAR, you should do exactly the same but using the IAR projects dedicated to the Stick, and changing the settings of the switch according to Table 4-1 4.1 “USB interface setting of SW2 (78K0R_UZ_Stick)”. There are different possibilities to download directly this HEX file into the flash memory of the device: the TK interface of IAR (as just shown) the tool Minicube2 and the QB programmer GUI Please note that Minicube2 is a separate product from NEC Electronics and not included in this 78K0R ZigBeeTM PRO Premium Development Kit, but can be purchased from your supplier. 6.3 Setting of different MAC address by Preprocessor command Some settings can be done by pre-processor options like in the sample program “TK-78K0RKG3+UZ MAC sample 1”. In the MAC sample program 1, the preprocessor options are used to set the MAC address of the board. Each board need to be programmed with a different MAC address, so before programming the device, you have to ensure that the “MAC_ADDR” preprocessor option has a unique value. Remark 72 Note that you cannot use the same output file to flash program the device, because the address will not be unique. You need to generate different output file from your project with different pre-processor options. User's Manual U19054EE2V0UM00 IAR Sample Session Figure 6-16 Chapter 6 IAR Pre-processor options 6.4 Using of the UART for debugging All the sample programs demonstrates the utilization of the UART serial interface communication via the USB port to send message and give visual information, but also to interact with the sample application (except in MAC Sample Program 2 where no action is required from the user). The TK interface of IAR also uses the USB/UART communication for on-board debugging purpose. Because the TK-78K0R debugging interface and the serial interface used by the application are sharing the same USB/UART port, they can not be used at the same time. So please close the IAR C-SPY debugger after the sample program has been downloaded to the board. Unplug the USB interface and make the necessary changes on the switches of the board to allow normal serial communication via the USB port (that is to say changes the switch settings to switch from debugging mode to normal operation mode). Plug the USB interface and open a terminal program. Configure the serial com port of your terminal program and press the reset button to restart the sample program. User's Manual U19054EE2V0UM00 73 Chapter 7 Sample Programs The 78K0R ZigBeeTM Premium Development Kit is provided with three different sample programs. The 78K0R ZigBeeTM Premium sample projects for IAR Systems Embedded Workbench can be found directly in the folder : “C:\MyDocuments \78K0RSamplePrograms\”, (if you chose the default installation folder during the section "5.2.2 Sample Programs Installation" ). Remark If the installation destination folder was changed at the time of Sample Programs installation process, you will find them in: “<new-folder>\78K0RSamplePrograms”. 7.1 Introduction and Structure The 3 sample programs are located in the same folder “78K0R Sample Programs”, but there is one folder for the TK-78K0R/KG3+UZ board and another for the 78K0R_UZ_Stick board. All the sample programs for the TK-78K0R/KG3 board are located in the folder “TK-78K0RKG3+UZ” and the sample programs for the 78K0R_UZ_Stick are located in the folder “78K0R UZ Stick”. Both folders contain the associated workspace file whose extension is .EWW, and also the folder “settings” which contains the configuration files required by IAR for each workspace. Each sample program is located in a single directory, which will be called main directory of the sample, so we have these different folders associated to the Sample Programs: - Figure 7-1 folder “MAC Sample 1” folder “MAC Sample 2” (Note that this sample program has not been develop for the 78K0R_UZ_Stick because there is no Joystick available on the hardware stick) folder “RF Test” Global project structure All the Sample Programs use the same directory structure. - 74 All the C sources files are located in the directory “Source”. The “include” directory contains all the C header files. User's Manual U19054EE2V0UM00 Sample Programs Chapter 7 - - The folder “MAC library” contains the IEEE.802.15.4 MAC stack library for the 78K0R. The “xcl” directory contains the default linker control file of the 78K0R/Kx3 device, which can be modified eventually. Each sample program uses the two default targets; The first target “Debug” in the folder of the same name holds all files used for debugging session and the other one “Release” (in the folder of the same name) contains the programmable files, for programming the 78K0R/Kx3 internal Flash memory via the Minicube2. All the configuration files for IAR Embedded Workbench are located in the folder “settings”. Three other files can be also found in each sample program folder: - Figure 7-2 The dependency information file .DEP The project setting file .EWD The project file .EWP Structure of a sample project All output file of the development tools for the corresponding target are generated by default in the directories “Debug” or “Release”, and more particularly in the sub-directory “Exe”. For details of using IAR Embedded Workbench and the IAR C-SPY Debugger please refer to the “78K IAR Embedded Workbench IDE User Guide”. 7.2 User Configurable Network Parameters Various network parameters will always be user specific and must be tailored to the user application; these user configurable parameters can be found in the different files. In the header file “basic settings.h”, you will find some parameters like the default MAC address or the channel used. MAC_EXTENDED_ADDRESS1 MAC_EXTENDED_ADDRESS2 RF_CHANNEL User's Manual U19054EE2V0UM00 75 Chapter 7 Sample Programs In the file “main.c”, you could choose the PanID of your network, but also the default short address of your network coordinator and your end device. gn_PanID -> Pan ID of the network gn_AssocAddr -> default short address for end device gn_CoordShortID -> default short address of the coordinator 7.3 System Operation This section provides a brief overview of the operation of the sample programs provided. It is recommended that the reader familiarizes themselves with the MAC Library Reference Manual to fully understand the operation and usage of the library. The below flow diagram shows the main program initialization and entry points for the MAC sample application 1 (Text chat). 76 User's Manual U19054EE2V0UM00 Sample Programs Figure 7-3 Chapter 7 Initialization flow diagram The main part of the program is the SampleApplication() procedure, the elements of this process are: - Servicing the SK_LAYER_API for messages. Managing and actionning of the user interface. User's Manual U19054EE2V0UM00 77 Chapter 7 Sample Programs 7.3.1 Servicing the SK_LAYER_API The following flow chart shows the message processing of the API layer, the procedure SK_GetMessage is used to determine the relevant command state and also provides a pointer to any received packet data. See the MAC Library Reference Manual for detailed explanations of the MAC commands and the API processing functions. Figure 7-4 78 API management flow diagram User's Manual U19054EE2V0UM00 Sample Programs Chapter 7 7.3.2 Managing and Actioning of the User Interface The remainder of the procedure reads characters from the user interface and acts as a command parser. The command parser will decode the characters and process them so that the correct menu commands and relevant API calls are issued. Figure 7-5 Command parser flow diagram User's Manual U19054EE2V0UM00 79 Chapter 8 Attachments This document contains the following file attachments: • • • Circuit Diagram of the CPU Board Circuit Diagram of the UZ2400 RF Board Circuit Diagram of 78K0R_UZ_Stick Use the Attachments tab to see them. 80 User's Manual U19054EE2V0UM00