Atmel ATSAM3S-EK2 データシート

ページ / 71
 
 
 
 
 
34 
Atmel AVR2055 
 
 
8348D-AVR-06/12 
8.2 ZAppSI – ZigBee and application profiles serial interface 
The ZAppSI protocol is a generic protocol for host/coprocessor communication. The 
protocol employs a simple command structure that can be easily understood by users 
and interpreted by  host and Runner applications. 
  shows the command 
fields shared by all commands. 
Figure 8-2. Common ZAppSI command frame. 
0x2A length
id
payload
1
1
1
length
 
The first byte of every command frame is a marker, 0x2A. After it follows the length, in 
bytes, of the rest of the command. The payload field is interpreted based on the 
command id stored in the third  byte of every command. The maximum command 
length is 255 bytes, while the payload field is at most 254 bytes. The user can refer to 
command descriptors written in XML format in 
./Evaluation 
Tools/Runner/commands
  for definition of all available commands. Section 
introduces the command descriptor language and gives an example of such an XML 
file. 
8.3 The ZAppSI host library 
The ZAppSI host library is a communications library for the host processor that allows 
a device application running on the host to communicate with an embedded Runner 
application via an easy-to-use C API. The library wraps the communication protocol, 
manages data serialization and de-serialization, and simplifies common programming 
tasks for the host application.  Although the library is designed as an API for a C 
application running on an embedded processor (for example XMEGA) it can also be 
compiled for a PC. This lightweight library is provided in source code, making it easy 
to adapt to almost any system environment and platform, including those platforms 
not explicitly supported with this release. 
8.3.1 Hosted HA and SE applications 
The ZAppSI host library comes with two sample applications for the host processor: 
one implements a Smart Energy meter reference application, while another 
demonstrates Home Automation dimmer switch implementation. Out of the box, a 
demo application can be compiled for PC, XMEGA-STK600, or SAM7X-EK. ZAppSI 
sample applications are  configured to work correctly with embedded reference 
applications, allowing a precompiled firmware image for ESP or thermostat to be used 
on another device to create an SE network or an HA network, respectively. 
A sample application is used on a host device or a PC. The host shall be connected 
to the Runner device, which does not execute any application logic, but rather sends 
commands received from the host and transfers responses from the network back to 
the host. Such architecture may be useful if the application logic for an SE or HA 
device is too complex making the size of the firmware image too large to fit into the 
available flash memory. For such cases, ZAppSI  suggests  to divide  the actual 
application logic moved to the host processor with network activity performed by the 
Runner device.