background image

Applications Engineering 

 

 

EndDevice_Polling

   Device will function as a ZigBee End Device but will only receive data from its 

parent when the End Device asks (polls). This configuration would be used for a 
battery-powered device that “sleeps” most of the time and only wakes up 
periodically to check for new data (requires stack file 

ZbRom_CC28_

RFD

_Vxx.mot

).

 

 

 

5.1.2.  ZEK_Demo.c File 

The file 

ZEK_Demo.c

, in the

 C:\Renesas\RZB_CC16C_ZDK\Sample_Code\ZEK_Demo\ZEK_Demo 

directory, contains the C-source code for the entire ZEK demo application.

 

 

 

Reset Initialization

: After the MCU comes out of RESET, the RTOS and ZigBee stack are initialized and 

then the user task function 

app_task()

 is called. This function would contain your user application code.

 

 

 

Program Flow

: In the ZEK Demo program, the 

app_task()

 function first initializes the MCU peripheral 

and stack settings. Next, the ZDK board’s LCD prompts the user to choose the board’s ZigBee device 
type by pressing the corresponding pushbutton below the displayed device type options. Once a button 
press is detected, the function 

MainLoop()

 is called. The 

MainLoop()

 function implements a loop that 

will never return for the life of the program.

 

 

 

Receiving New Data

: When a new ZigBee data packet is received, the function 

AppDataIndication()

 is called by the ZigBee stack. Because not much time should be spent in this 

function, the payload of the data is saved in a circular receive buffer. In 

MainLoop()

, the function 

ProcessNewData()

 is called periodically to deal with any new packets. The 

ProcessNewData()

 

function calls the function 

AppGetNextRxPacket()

 to retrieve the data payloads that were saved in the 

circular buffer by the 

AppDataIndication()

 function. It is recommended that you follow the same 

procedure for processing new data.

 

 

 

Address Book

: After a node joins the network, it sends a message to the coordinator with its address. 

The coordinator then adds that address to its address book, which it then broadcasts to every device in 
the ZigBee network. You can send a ZigBee message to a specific device in the network by turning the 
ZDK board’s potentiometer to scroll through the available list of addresses and selecting the address of 
the desired destination device. If the selected destination address is the ZDK board’s own address, the 
address will be changed to the network broadcast address 0xFFFF. The address book is not part of the 
ZigBee specification; it is implemented in the ZEK Demo program simply as an application example.

 

 

 

5.1.3. Stack RAM Usage 

Try to minimize the allocation of local variables that use stack space inside of functions. Remember that 
your user application is running as a task in an RTOS with a limited amount of stack space allocated for it. 
For this ZEK system, that value is fixed and cannot be changed. You must limit the RAM space used by 
your local variables and function calls to less than 100 bytes.

 

 

 

5.1.4. Global Variable RAM Usage  

You may create as many global variables for your user program as RAM space is available (896 bytes). A 
virtual RAM section at the start of the debugger’s RAM has been created to warn you if you try to allocate 
too much global RAM. Below is an example of the linker warning you will receive if you exceed the 
available RAM space: 

 

 

RZB-CC16C-ZDK User’s Manual Rev 1.1 

11/ 39 

December 2006 

 

Содержание ZigBee Demo RZB-CC16C-ZDK

Страница 1: ...Applications Engineering ZigBee Demo Kit ZDK RZB CC16C ZDK User s Manual Rev 1 1 December 2006 www renesas com...

Страница 2: ...gs 12 5 2 Limitations of the ZigBee Evaluation System 13 5 2 1 Timers 13 5 2 2 System Clock 13 5 2 3 Interrupts 13 5 2 4 Flash and RAM Usage 13 5 2 5 MAC Address Area 14 5 2 6 ZbROM Flash Size 14 5 2...

Страница 3: ...Behavior 24 A 3 2 Cannot Connect to Target 24 A 3 3 Issues that May Arise During Debug Operations 25 Appendix B Updating the ZigBee Development Kit ZDK Board Firmware 27 B 1 Programming the ZDK Board...

Страница 4: ...nterface between the ZDK boards and the host PC This interface reduces resource requirements on the M16C 28 MCU and allows faster code downloads It also can be used with many other Renesas Flash MCUs...

Страница 5: ...ers the three ZDK boards CD ROM Auto install program RF Sniffer software HEW IDE debugger NC30WA C compiler assembler and linker FoUSB Programmer USB drivers Manuals Tutorials Sample programs 2 1 1 CD...

Страница 6: ...or use of any product circuit or procedure described herein No other liability or warranty applies expressed or implied Software warranty is limited to replacement of the CD only While every attempt h...

Страница 7: ...are and USB driver ZigBee ZigBee Router ZigBee Router Coordinator RF Sniffer USB Dongle Figure 4 1 ZigBee Demo Setup Optional only required if you want to update firmware and or develop code In Circui...

Страница 8: ...to provide a demo and evaluation environment for wireless ZigBee connectivity based on Renesas MCUs See section 6 0 for more details Hardware 4 3 RF Sniffer Interface RFSI The RF Sniffer Interface RFS...

Страница 9: ...nt tools and includes the C compiler assembler linker debugger and editor 4 6 2 NC30WA Evaluation Version C Compiler The evaluation version of the M3T NC30WA C compiler is provided with the same funct...

Страница 10: ...atch is quite involved and the detailed steps to do this are not discussed in this manual To create a new ZigBee application using the HEW project wizard you have two options 1 You can use the ZEK Dem...

Страница 11: ...the function AppGetNextRxPacket to retrieve the data payloads that were saved in the circular buffer by the AppDataIndication function It is recommended that you follow the same procedure for processi...

Страница 12: ...tion define DEMO_CHANNEL 24 define SCAN_CHANNELS DWORD 0x1 DEMO_CHANNEL Only scan our demo channel define SCAN_CHANNELS 0x7FFF800 Scan every channel ASCII Input define MAX_SERIAL_INPUT 20 Address Book...

Страница 13: ...MHz The ZigBee stack assumes that the MCU is running at this operating frequency Please do not make any changes to the clock 5 2 3 Interrupts The interrupt vector table is located in the ZigBee stack...

Страница 14: ...the stack The ZbROM image occupies the two lower 32kBytes MCU Flash memory blocks for a total of 64kBytes This allocation was done to prevent the code from being erased by the debugger when downloadi...

Страница 15: ...able 15 0 Broadcast Transmission Table 20 20 5 2 11 Other Limitations The RZB CC16C ZDK provides sophisticated debugging features at a low cost but it does have some limitations when used with the HEW...

Страница 16: ...ote The RZB CC16C ZDK board is referred to as RZB CC28 BRD on the board s silkscreen and schematic drawing Figure 5 1 shows the RZB CC16C ZDK Board with major components identified Figure 6 1 RZB CC16...

Страница 17: ...6 2 RZB CC16C ZDK Block Diagram 6 3 M16C 28 Group of MCUs The M3028x group of 16 bit single chip flash microcontrollers MCU is part of the M16C 60 series CPU core The hardware and software manuals fo...

Страница 18: ...RS232 transceiver and Power LED For normal operations JP2 must be shorted JP2 is shorted by default 6 4 3 Default Jumper Settings Table 6 1 Default Jumper Settings Jumper Default Setting JP1 MCU Powe...

Страница 19: ...scussed from section 7 2 onward After starting a HEW debug session the ICD uploads the kernel to the M16C 28 if it does not exist e g a blank device or a device that was programmed with the FoUSB Prog...

Страница 20: ...gister contents are modified in any way kernel operation cannot be guaranteed Table 7 2 Limitations on Register Operation Register Name Restriction User and Interrupt Stack Pointers RAM memory range 0...

Страница 21: ...r than 250 kHz 7 7 User Program s Real Time Capability Please be aware that while the kernel is in a STOP state the hardware peripherals will continue to run Therefore interrupts may not be serviced p...

Страница 22: ...n connected to Reset SW1 Power source select switch If set toward the ICD connector power provided by ICD If set toward the power connector power provided via power connector LEDs D1 Red User output c...

Страница 23: ...is that Windows did not properly install the USB drivers so that the ICD is not recognized An indication of this problem is the faster blink rate of the ICD s yellow Status LED of about 2 3 times per...

Страница 24: ...re that one instance of HEW is open during a debug session erratic behavior can result Running the FoUSB Programmer at the same time as HEW can also result in erratic debug behavior Lastly having more...

Страница 25: ...ations Table A 3 Problem Possible Cause s and Solution After stepping a few instructions HEW cannot stop Changes were made to the UART1 Special Function Registers SFRs Do not change UART1 SFRs in your...

Страница 26: ...alog box appears click the Cancel button to close it Press the reset button on the ZDK board Click the HEW Reset icon After initialization debugging can resume However it is recommended that you downl...

Страница 27: ...led USB monitor code it will prompt you to update that code However before you click OK on the popup window that offers to update your ICD you must determine the correct course of action Is the ICD s...

Страница 28: ...firmware is stored C Renesas RZB_CC16C_ZDK Demo Select the firmware file ZDK_Demo_Vxx mot where xx is the version number of the code 6 A popup window displays the ID code of the firmware file you just...

Страница 29: ...100 mil jumper This will configure the ICD to run in boot mode when it is powered up Figure C 2 Boot Jumper Location 12 Make sure that the power switch is set to the USB position so that the unit is...

Страница 30: ...onitor Image MMI to the RTA FoUSB Mon Figure C 4 Chip Selection Window 17 Unplug the USB Cable remove the jumper and enclose the board back into its case Now re attach the ribbon cable to your target...

Страница 31: ...language programming guide for the M16C 20 60 series MCU 7 M16C 20 60 Series Assembly Language Programming Manual Assembly language programming guide for the M16C 20 60 series MCUs 8 HEW User s Manua...

Страница 32: ...pping of J1 J4 pins to MCU pins and signal names J1 Pin MCU Pin MCU Function J2 Pin MCU Pin MCU Function 1 1 P95 AN25 CLK4 1 21 P76 TA3out 2 2 P93 AN24 2 22 P75 TA2in W 3 3 P92 TB2in 3 23 P74 TA2out W...

Страница 33: ...48 P23 OUTC13 INPC13 8 68 P107 AN7 3 KI 9 49 P22 OUTC12 INPC12 9 69 P106 AN6 2 KI 10 50 P21 OUTC11 INPC11 SCLMM 10 70 P105 AN5 1 KI 11 51 P20 OUTC10 INPC10 SDAMM 11 71 P104 AN4 0 KI 12 52 P17 5 INT IN...

Страница 34: ...ng The circuit board schematic and Bill Of Materials BOM are available as separate PDF documents They can be accessed through Start Programs Renesas RZB_CC16C_ZDK Board Hardware or by browsing to the...

Страница 35: ...54 53 52 43 42 41 40 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 8 7 5 4 3 2 76 74 6 73 72 71 70 69 68 11 77 78 13 12 10 9 60 61 62 63 55 56 57 58 59 32 33 34 35 1 80 79 AVss P20 OUTC10 INP...

Страница 36: ...DD_RAM N C N C N C N C N C FIFO FIFOP CCA SFD CSn SI SCLK VCO_GUARD AVDD_VCO AVDD_PRE AVDD_RF1 AVDD_SW AVDD_RF2 AVDD_IF2 AVDD_XOSC AVDD_CHP AVDD_IF1 SO RESETn VREG_EN ATEST2 ATEST1 GND RF_P TXRX_SWITC...

Страница 37: ...Applications Engineering Appendix G RZB CC16C ZDK Printed Circuit Board Figure E 1 PCB Top View RZB CC16C ZDK User s Manual Rev 1 1 37 39 December 2006...

Страница 38: ...Applications Engineering Figure E 2 PCB Bottom View RZB CC16C ZDK User s Manual Rev 1 1 38 39 December 2006...

Страница 39: ...ources 1 For details on how to use the In Circuit Debugger and Programmer please see the RTA FoUSB MON User s Manual Start All Programs Renesas RZB_CC16C_ZDK RTA FoUSB Mon Manual 2 For updates and oth...

Отзывы: