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.
Page 3
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.
Page 4
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: •...
Features of the TK-850/SG2+UZ CPU evaluation board are as follows. • The evaluation board used the NEC Electronics 32-bit single chip microcontroller (µPD70F3281YGC). All of the ROM, RAM and peripheral circuit are efficiently built in one chip on a single board.
Note Updates for the IAR Embedded workbench for V850, documentation and/or utilities for the V850 ZigBee™ PRO Gateway Development Platform 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.
Page 9
V850 ZigBee PRO Gateway Development Platform Chapter 1 IEEE 802.15.4 MAC libraries Sample programs IAR Embedded Workbench Kickstart Version Flash programmer for 78K0 Article code 78K0-ZIGBEE-SK • ZigBee Premium Development Kit for 78K0 4 x 8-bit ZigBee node boards TK-78K0/KF2+UZ...
Chapter 2 Sample Program The sample program provided permits the user to set up the following network where the TK-850/SG2+UZ board occupies the central position. The TK-850/SG2+UZ is already pre-programmed with the "mac_app.hex" file which utilises the following network configuration: Figure 2-1 System Configuration The sample application utilizes TCP/IP and HTTP communications on the...
Page 11
Sample Program Chapter 2 Some changes need to be made to your PC network settings: open [Control Panel] -> [Network Connections] -> [Local Area Connections] -> [Properties] -> [TCP/IP] -> [Properties] and set the following IP address and the subnet mask: IP address: 192.168.0.x.x can be any value between 1 to 99, or 101 to 25.
Page 12
Chapter 2 Sample Program Figure 2-3 Date configuration screen You can set the time by selecting [Configuration] -> [Date]. For example, if you want to set 9 minutes and 30 seconds past 9pm on April 11th in 2005, please input 20050411210930. Figure 2-4 Configuration of the date To setup networks, select [Configuration] ->...
Page 13
Sample Program Chapter 2 You can modify the network configuration in this window. However it will be adopted only after the new configuration is downloaded in the Flash EEPROM. Figure 2-5 Configuration of the network parameters You can open the Flash programming window by selecting [Configuration] -> [Writing Flash EEPROM].
Chapter 2 Sample Program Figure 2-6 Saving the new parameters by writing in the MCU Flash memory 2.2 Operation Procedure with TK-78K0/KF2+UZ boards Once the TK-850/SG2+UZ board is ready (section "2.1 Operational procedure for the TK-850/SG2+UZ" ), the connection of the TK-78K0/KF2+UZ remote node (called Device) requires some settings.
Page 15
Sample Program Chapter 2 Figure 2-7 WriteEZ3 Device Setup Write the same sample programs to the other TK-78K0/KF2+UZ boards. Then, set the position of the switches as shown below: Table 2-3 Operation mode setting for the TK-78K0/KF2+UZ SW1 – 1, 2, 3, 4, 5, 6 and 7 SW1 - 8 UART When you run the application, you can run it as a stand-alone system by setting...
Page 16
Chapter 2 Sample Program Figure 2-8 Network configuration overview (with a Device connected) Up to 4 devices can be connected in the sample program. To display the latest status, click the "Update" button. The pink line indicates it is not connected. The coordinator checks for a device every 30 seconds.
Page 17
Sample Program Chapter 2 Figure 2-9 Details of a Device connection The actions that can be performed via the WEB Browser interface are shown below. Notes If you click the SW3 of the coordinator, LED3 on the physical Device 1 turns on, and then, off .
Page 18
Chapter 2 Sample Program To update to the latest status, click the "Store" button. Following are the different operations that can be directly done on the board: • On the TK-850/SG2+UZ board: By pressing SW3 on the TK-850/SG2+UZ board, LED3 on the Device 1 becomes on and off.
Chapter 3 Hardware specification Table 3-1 General hardware features Item Details Part number μPD70F3281YGC-8EU Operation with main clock 20 MHz Main = 5 MHz Clock Subclock = 32.768 kHz Internal flash memory 384 kB Internal RAM 32 kB Operation voltage 3.3 V I/O voltage 3.3 V...
Page 20
Chapter 3 Hardware specification Signal Terminal CPU name at connection Notes name destination P37/CRXD0/IERX0 P38/TXDA2/SDA00 P39/RXDA2/SCL00 P53/SIB2/KR3/TIQ00/TOQ00/RTP03/DDO Both use with N-Wire P54/SOB2/KR4/RTP04/DCK Both use with N-Wire P55/SCKB2/KR5/RTP05/DMS Both use with N-Wire P70/ANI0 P71/ANI1 P72/ANI2 P73/ANI3 PCM1 PCM1/CLKOUT PCM2 PCM2/HLDAK PCM3 PCM3/HLDRQ PCT1 PCT1/WR1...
Page 21
Hardware specification Chapter 3 Terminal CPU name at CN3 Signal name Notes connection destination N.C. P41/SOB0 Output from CPU P40/SIB0 Input to CPU Table 3-4 Connector CN4 terminal list Terminal CPU name at CN4 Signal name Notes connection destination 3.3V 3.3V N.C.
Chapter 3 Hardware specification 3.2 Switches and LED 3.2.1 SW1, JP1 Bit1, 2, 3 and 4 of SW1 are dip switches for Operation Mode setting. Bit5, 6, 7 and 8 of SW1 are connected to P74, P75, P76 and P77 for multipurpose input.
Page 23
Hardware specification Chapter 3 Table 3-6 On-chip debug mode settings for the TK-850/SG2+UZ Bit 1 Bit 2 Bit 3 Bit 4 USB side (1-2-pin short) 3.2.1.3 N-Wire Connecting Mode Change to the following settings when you connect to N-Wire emulator to the TK-850/SG2+UZ board.
Chapter 3 Hardware specification 3.2.2 SW2, SW3 SW2 and SW3 are push switches. They are connected to pull-up resistors, and their outputs go “Low”, when they are pushed. Table 3-10 Switch SW2 and SW3 terminal list Switch Signal name Terminal CPU name at connection destination P50/TIQ01/TOQ01/RTP00/KR0 P51/TIQ02/TOQ02/RTP01/KR1 Figure 3-4...
Hardware specification Chapter 3 Signal name Terminal CPU name at connection destination LED4 PDH2 PDH2 Figure 3-7 LED 1, 2, 3 and 4 3.3 LAN Controller The TK-850/SG2-UZ board has a LAN controller, LAN91C113 made by SMSC. 3.3.1 Connection Connection of CPU to LAN controller is below. Figure 3-8 V850ES/SG2 and LAN controller pin connection User's Manual U19026EE3V0UM00...
Chapter 3 Hardware specification 3.3.2 Reset of LAN Controller P35 is used to reset the LAN controller. When P35 is Hi-z after CPU reset, the LAN controller will be in reset state. Before releasing the reset, please change the CPU port “Chip Select Signal (AEN,nADS)” and “Read/Write Signal” to be inactive level.
Page 27
Hardware specification Chapter 3 Table 3-13 9V Battery checking Signal Terminal CPU name at Notes name connection destination About 0.265 times of input power supply For instance If the battery level 6.0V: The level of the BT_MONI = 0.265x6.0 BT_MONI P78/ANI8 = 1.59(V) If the battery level is 4.75V:...
1-2-pin short (USB side) Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Please start WriteEZ1 by selecting [Programs] -> [NEC Electronics Tools] -> [WriteEZ1] in your Windows [Start] menu. User's Manual U19026EE3V0UM00...
Page 31
Programming the TK-850/SG2+UZ with WriteEZ1 Chapter 5 Figure 5-1 GUI interface of the Flash programmer WriteEZ1 Please select the “Setup” button in the menu bar or [Device] -> [Setup]. Then select the”PRM File Read” button. User's Manual U19026EE3V0UM00...
Page 32
Device setup screen The PRM file contains the device-specific parameter required for programming. You will also find the PRM files in the CDROM in the following directory: <CD>\NEC Tools 32\PRM-70F3288_V111 Please select the following PRM file: <CD>\NEC Tools 32\PRM-70F3288_V111\70F3281_CSI0.prm Figure 5-3...
Page 33
Programming the TK-850/SG2+UZ with WriteEZ1 Chapter 5 Select the COM port number you connected your PC with the TK board. All of COM port numbers available on your PC will be displayed. Set ”Speed” to 38400, ”Frequency” to 5.00, “Multiply rate” to 4.00. Then, press “OK”.
Page 34
Chapter 5 Programming the TK-850/SG2+UZ with WriteEZ1 Figure 5-5 Loading the executable file .HEX Next, write the programs by clicking “Auto procedure”. When “Auto procedure” is clicked, it processes the “Erase” and “Program” commands. Figure 5-6 Starting the «Auto Procedure» to erase and program the Flash memory User's Manual U19026EE3V0UM00...
Page 35
Programming the TK-850/SG2+UZ with WriteEZ1 Chapter 5 When “Flash internal Verify OK!”, is displayed it means the flash memory writing has successfully completed. The programs are successfully written to the Flash memory of the V850/SG2 integrated in the board TK-850/SG2+UZ. Disconnect the USB cable from TK-850/SG2+UZ board.
Chapter 6 V850 ZigBee Gateway Development Platform, Installation and Operation The IAR Embedded Workbench including the C-SPY debugger allows the user to build and download application programs to the V850 ZigBee Gateway Development Platform. As the communication interface between the PC host system and the V850 ZigBee Gateway Development Platform board is USB, a USB interface line is needed.
Nodes with the Sample Programs. To install the WriteEZ1, select the “setup.exe” program that can be found in the following directory in the CDROM provided: <CD>\NEC Tools 32\WriteEZ1. The setup dialogues will guide you through the installation process. You will also need to install the USB driver required to emulate the UART communication (which is the only one supported for the flash programming interface) by the USB communication.
Page 38
Figure 6-1 Found New Hardware Wizard 2 (Windows XP) Check "Include this location in the search:" check box and browse to the NEC Tools 32\drivers_virtual_uart\FTDI folder. Click “Continue Anyway” when prompted to the Windows XP certification compatibility. Confirmation of USB Driver Installation After installing the two types of drivers, check that the drivers have been installed normally, according to the procedure below.
Page 39
V850 ZigBee Gateway Development Platform, Installation Chapter 6 and Operation Figure 6-2 Device Manager For Windows 2000/XP Caution Do not perform "Hardware Modification Scan" when communicating with the target device. Remark In the flash programming WriteEZ GUI port list box, the same communication port as COMxx of the USB Serial Port (in this case COM3 as shown in above screenshot) needs to be selected.
Chapter 7 IAR Sample Session 7.1 Sample Structure The V850 ZigBee Gateway sample projects for IAR Systems Embedded Workbench can be found directly in the CDROM in the folder: <CD>\SamplePrograms\SamplePrograms, or can be found in the directory where they have been installed by the automatic process of the CDROM (see section "6.2.3 Sample Program Installation"...
IAR Sample Session Chapter 7 Figure 7-3 Web page file structure To create your own application using the MAC & TCPIP-stack, please make a copy of the sample and use it as a template. All output files generated by the development tools are located in a subfolder using the name of the corresponding target.
Chapter 7 IAR Sample Session Please load the sample workspace located in the “Sample_V850SG2+ZB” directory. Figure 7-5 Opening the V850_UZ Sample Project The above screen shows the sample project layout including the main system libraries (LIB group) and source files (SRC group). The CNET group contains the relevant application source files associated with the TCPIP libraries and the MAC group contains all the source files associated with the IEEE 802.15.4 library.
Page 43
IAR Sample Session Chapter 7 Table 7-1 Resources used by the debugging monitor UART for Interrupt control Device Terminals used debugging flags V850ES/SG2 UD0RMK P30/TxDD0 UARTD0 (μPD70F3281Y) UD0SMK P31/RxDD0 Additionally, please note the following points: Do not change the control registers of UARTD0. Do not change or disable the interrupt control / mask flags of UARTD0.
Page 44
Chapter 7 IAR Sample Session Table 7-3 Memory area reserved for monitor Device Address range Function V850ES/SG2 ROM: 0x5F800 - 0x5FFFF Reserved for monitor (μPD70F3281Y) RAM: 0xFFFF EFF0 - 0xFFFF EFFF program Moreover, the monitor reserves 10 bytes of the global stack area by halting the user program, caused by a forcible break (debugger stop command) or a software breakpoint.
Page 45
IAR Sample Session Chapter 7 Figure 7-7 Settings of the «Pre-processor» options of the «C/C++ compiler» Before starting a debug session, please check that the target board configuration is set according to the settings written in the Table 3-6 "On-chip debug mode settings for the TK-850/SG2+UZ"...
Page 46
Chapter 7 IAR Sample Session Figure 7-9 Configuration of the TK-V850 interface for on-chip debug mode If all settings are correct then you can rebuild the project by selecting [Project] - > [Rebuild All] and start a debug session by selecting [Project] -> [Debug], or pressing the debugger-button in the menu bar: Now the debugger is started and the demo project is downloaded to the TK-850/ SG2+UZ board.
Page 47
IAR Sample Session Chapter 7 Figure 7-11 Downloading the sample application in the target device After the download is 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. User's Manual U19026EE3V0UM00...
Chapter 7 IAR Sample Session Figure 7-12 Debugging session with the Embedded Workbench C-Spy Debugger To get more details on the debugger configuration and capabilities, please refer to the “V850 IAR Embedded Workbench IDE User Guide” and the “V850 IAR C- SPY®...
Page 49
IAR Sample Session Chapter 7 Figure 7-13 Settings to generate an HEX file output User's Manual U19026EE3V0UM00...
No RTOS is employed. Config.R85 Various system configuration utilities. Driver.R85 Library for the Ethernet device driver. NEC.R85 NEC Utilities and applications library. Sellib.R85 Flash Self programming library. Stack.R85 IEEE.802.15.4 MAC stack library. Library containing the web pages, the web pages are also supplied as source code so that the user can modify the web pages.
Page 51
Sample Program Chapter 8 #include «lwip/def.h» #include «api/fsdata.h» #pragma constseg=WEBPAGES // New line at the top of the fsdata.c file #pragma constseg=default // New line at end of the fsdata.c file User's Manual U19026EE3V0UM00...