Техническая Спецификация для Atmel ATSAM3S-EK2

Скачать
Страница из 71
 
 
Atmel AVR2055 
 
 
 
 
27
 
8348D-AVR-06/12 
For more detail on  OTAU and Bootloader PC tool’s OTAU functionality usage, see 
. 
5 Smart Energy Tunneling application 
The Smart Energy (SE) Tunneling application shows how to implement tunneling in 
an SE network.  Tunneling is a way to transfer  commands of non-ZigBee protocols 
packed into a ZCL command over the ZigBee network. 
5.1 Device types 
The reference application defines two device types: ESI and meter, though they do 
not  provide  all ESI and meter functionality. Both devices support  the  Generic 
Tunneling cluster and the SE Tunneling cluster: the ESI as the client, and the meter 
as the server. 
NOTE 
According to the Smart Energy specification, both the client and the server sides of 
the Generic Tunneling cluster and the SE Tunneling cluster may be supported on any 
SE device. 
5.2 Running the demo 
To run the Smart Energy Tunneling application: 
  Program two devices with the application firmware: one ESI and one meter. By 
default, the application is compiled for the ESI. To compile the application for the 
meter  and  produce  meter’s firmware for programming, in the 
configuration.h
 
file comment out  the 
#define APP_DEVICE_TYPE_ESI
  line and uncomment the 
#define APP_DEVICE_TYPE_METER
 line, and compile the application. 
  Connect both devices to a PC 
  Run a terminal program on a PC for both devices 
NOTE 
The terminal emulator should be configured to use 38400 baud, 8 data bits, no parity, 
and 1 stop bit. 
  The devices may need several seconds to perform binding and establish a tunnel. 
  Type text in the ESI’s terminal. The text will be carried to the meter over the air 
packed into ZCL Transfer Data commands of the SE Tunneling cluster and will 
gradually appear in the meter’s terminal. 
5.3 Algorithm 
After binding, the client (ESI) sends the Generic Tunneling cluster’s Match Protocol 
Address command to check that the bound server (meter) has the same protocol 
address. The protocol address is set in the 
esiGenericTunnelCluster.c
 file for the 
ESI,  in the 
protocolAddress
  variable, and in the 
meterGenericTunnelCluster.c
 
file for the meter, in the 
genericTunnelClusterInit()
 function. 
Once the response is received, the client requests a tunnel from the server by 
sending the SE Tunneling cluster’s Request Tunnel command. In this command the 
client specifies the protocol ID to be used. By default, the protocol ID 200 is used 
(
SE_TUNNELING_PROTOCOL_ID
 application’s constant), which means a manufacturer-
defined protocol. If the tunnel is created successfully the client may start sending data 
to the server over the tunnel.