Embit Binary Interface - Zigbee Specific Documentation
Embit Binary Interface - Zigbee Specific Documentation
-
ZigBee Specific
Documentation
embit s.r.l.
Document information
References
Ref Version Date Author Title
1 Rev. 1.9 2014 Embit Embit Binary Interface Overview
2 Rev 02 2008 ZigBee ZigBee Cluster Library Specification
Standards
Organization
1 Introduction
This document is an extension of the “Embit Binary Interface Overview” document [1] and
describes the EBI protocol for the Embit wireless modules that support the ZigBee over-the-
air protocol [2]. This document is intended as a reference manual.
It is important to specify that, although the EBI protocol abstracts and simplifies some aspects
of ZigBee wireless networks, a good knowledge of ZigBee concepts is useful to understand
how to use EBI-ZigBee.
Note that in this document the term “host” and the term “module” refer to the customer
system hosting the Embit wireless module and the Embit wireless module itself, respectively.
An overview of the interaction between the “host” and the “module”, using the EBI protocol,
is shown in the following figure:
...
EBI: serial binary protocol
Host system over UART / USB / Ethernet Any Embit module
In the following Chapter a usage example to get started with EBI-ZigBee is detailed step by
step, and is useful to new users.
In Chapter 3 the list of commands specifically supported by EBI-ZigBee is provided, in the
form of reference manual.
2.2.6 Endpoint
The endpoints are required in order to operate a device in a ZigBee network. A device
without endpoints won't be able to communicate. These endpoints should be set as
required by the ZigBee Cluster Library specifications [2]. To simplify here we'll be
creating just one endpoint with one manufacturer-specific cluster. In a commercial
application a proper configuration of the profile identifier, the device identifier and the
clusters is required in order to be ZigBee compliant.
First of all, make sure that no endpoints have already been set (to avoid conflicts with
the one which is going to be created):
Remove all endpoints
39 FF
(Note that if an execution status byte different than 00 is received, it can be safely
ignored.) To create one endpoint with one cluster send the following payload:
Add endpoint
38 01 C0 00 C0 00 01 80 00 01 80 00
Please repeat these commands on any board involved in the network.
Save settings
08
Please repeat this command on any board involved in the network.
• “01” and “01” are the source and the destination endpoints (such indexes were set
with the add endpoint command);
• “80 00” is the cluster ID;
• “68” is the frame control field indicating a manufacturer specific command;
• “00 00” is the manufacturer code (should be provided by the ZigBee alliance for
ZigBee compliant code);
• “00” is the transaction number (should be increased at every transaction);
• “01” is the manufacturer specific command we are sending;
• “DD DD DD DD” is example data which will be sent over-the-air (it can be changed
with any other data up to the packet size limit; to keep a safety margin we'll keep
this data shorter than 40 bytes in this example).
Once the data has been sent, the destination device(s) will be notified; in practice, a line
like
Received data notification
00 xx E0 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 01 01 xx xx 00 01 DD DD DD DD xx
will appear on the Embit EBI ZigBee serial tester software instance attached to the
module which received the data ('xx' denotes bytes which can be ignored for now). Such
byte sequence is a “received data notification”; please refer to EBI documentation [1] for
information on how this data is formatted. The payload bytes which have been sent (e.g.,
DD DD DD DD) are visible in such notification.
Note that in case you don't see such a received data notification in the Embit serial tester
the following aspects should be checked:
• antenna connections: are the Embit modules mounted on the two EMB-EVB boards
correctly connected to their external antennas? Note that if the two modules have
an integrated antenna, then this check is not necessary;
• network formation: in case there was an error in the sequence of commands
provided to the Embit modules, it may happen that both start the network as
coordinators of two different PANs; such a case can be verified using a sniffer tool,
like the EMB-Z2531PA-USB, for 2.4 GHz networks. Usually, the easiest way to
proceed is to reset the two boards and restart the example session.
The “send data” command and “received data notification” above complete this usage
example. In this session you have learned how to:
• use Embit serial tester software to quickly run EBI sessions on Embit modules;
• configure RF and PAN parameters on Embit modules;
• exchange data over-the-air.
For more details about advanced EBI commands and features, please refer to the
following Chapter of this document.
(specific data
message ID)
Message ID
Checksum
for each
Payload
Field
In the following sections the “Message ID” for each EBI-802.15.4 command is provided, in
hexadecimal format, at the end of the section name; note that the message IDs in this
document match the message IDs reported in [1].
The “Payload format” paragraphs provide the EBI-802.15.4 specification for the variable-
length “Payload” field.
Finally, the “Direction” paragraphs identify whether the packets are commands sent to the
module (host → module) or are replies/notifications sent to the host (host ← module).
Unique ID
Protocol
Wireless
Module
Field
The “Wireless protocol” field identifies which protocol is implementing the module and
is divided in two nibbles, the most significant 4 bits identify the protocol family, the
least significant 4 bits identify the variant. Any nibble can be zero indicating unknown
value. This is the list of all possibilities:
0x00 = Unknown
0x01 = Proprietary
0x10 = 802.15.4
0x20 = ZigBee
0x21 = ZigBee 2004 (1.0)
0x22 = ZigBee 2006
0x23 = ZigBee 2007
0x24 = ZigBee 2007-Pro
0x40 = Wireless M-Bus
Model
Field
The “Unique ID” field identifies the module universally through its IEEE address.
Notes:
With this coding, the microcontroller family can be obtained by reading the first 4 bits of
the “Module” field.
Flow control
Baudrate
Field
EMB-ZRF2xx
EMB-Z253x
Support on modules:
The “Flow control” field specifies the flow control mode in use:
0x00 = Flow control disabled
0x01 = Hardware flow control (modem mode)
0x02 = Hardware flow control (peer to peer mode)
Modem mode means host assert RTS and waits for CTS asserted from the module before
sending data. Peer to peer mode means that both module and host will use RTS and CTS
as FIFO full signal de-asserting their line when the input buffer are full (for example
when using FTDI chips).
Notes:
Using high baudrates can introduce errors, especially with the speeds marked with an
asterisk (*). Please keep the baudrate as low as possible when low data is exchanged.
The flow control mode affects the way the module wakes up from energy save mode.
While in energy save mode, the module will not be able to receive data over the UART.
If modem mode hardware flow control is used, the RTS will be asserted before sending
data by the host UART and this will wake the device up from energy save mode. The
device will then assert CTS and start receiving the data. This means that in modem
mode, the device can serve commands also during energy save mode. The other
hardware flow control modes will not be able to operate correctly during energy save
mode, and so, energy save timeouts must be used.
Host interface
(MCU) policy
Radio (RX)
Settings
policy
Field
The “Radio (RX) policy” field specifies how the radio should be set in low power mode
according to the following table:
EMB-ZRF2xx
EMB-Z253x
Support on modules:
Data reception
The “Host interface (MCU) policy” field specifies how the microcontroller should save
energy according to the following list:
EMB-ZRF2xx
EMB-Z253x
Support on modules:
Host interface (MCU):
The “settings” field is optional and specifies additional settings specific for each Host
interface policy. If not sent, the last settings used for the selected policies will be used.
The length and format of this field is variable according to the following table:
Host
Settings
interface Fields
field length
policy
0x00 0 bytes
0x01 0 bytes
Wake up interval Sleep timeout
0x02 6 bytes
(4 bytes) (2 bytes)
Sleep interval Wake up anticipation
0x03 6 bytes
(4 bytes) (2 bytes)
The “Wake up interval” specifies an interval in time (milliseconds) after which to enable
the host interface. Accepted values are [ 20 : 0xFFFFFFFF ] where 0xFFFFFFFF means
never wake up (wake up only through outgoing UART activity or incoming UART activity
if hardware flow control is set to modem mode).
The “Sleep timeout” specifies how many milliseconds to wait before entering sleep
mode again. Accepted values are 0; [ 5 : 0xFFFF ] where 0 means enter sleep-mode
immediately and 0xFFFF means never enter sleep-mode again. If “Sleep timeout” is
bigger than “Wake up interval” the device will always stay on (but will keep sending
status notification when “Wake up interval” fires).
The “Sleep interval” specifies an interval in time (milliseconds) after which the device
will be set into sleep mode.
The “Wake up anticipation” indicates when the device should wake up (in milliseconds
before the expiration of the “sleep interval”). If “Wake up anticipation” is bigger than
“Sleep interval” the device will always stay on sending status notification right after
“Sleep interval” fires. Accepted values are in the [ 5 : 0xFFFF ] range where 0xFFFF
means never enter low power mode (keep sending periodic notifications).
Notes:
On EMB-Z253x the radio policy 0x00 (always on) is not available for end devices and will
behave as radio policy 0x01 (always off).
For switching between radio policy 0x00 to other radio policies, the device must be
disconnected.
The radio policy and the microcontroller policy are not to be confused and should be
considered independent options.
If the UART hardware flow control is in modem mode, the host will be able to always
wake up the device by pulling low the RTS (sending data). This method of waking up the
device is the one to be preferred and will not interfere with the energy save timers.
If the UART hardware flow control is not in modem mode, the host will lose control of
the device during the host interface sleep period. The timers must be used wisely
(allowing enough time with host interface enabled to receive a full packet).
When sending this command the device will reset the timers as if the interval timers
were just expired (entering sleep mode immediately for “host interface policy” 0x03,
while staying awake for “Sleep timeout” for “host interface policy” 0x02 as an example).
To manually enter sleep-mode immediately use the “Enter sleep mode” command.
When the host interface is woken up from low power due to a timer expiring, a status
notification will be sent to inform the host that it can send commands. No notification
will be issued when entering low power mode.
If “Radio (RX) policy” is set to “Follow MCU policy”, the device will poll its parent for
data only when waking up timers expire. The radio will not poll continuously during the
awake period (will just send one poll at the beginning of the period) and so, data will
only be received at the beginning of the wake up period.
The selected data polling interval (only for Radio (RX) policy different than always on)
will be automatically increased to one poll every 100ms after sending or receiving over
the air data (to allow fast download of responses and multiple queued packets).
Only end devices are allowed to sleep.
Notes for EMB-ZRF2xx:
On the EMB-ZRF2xx the sleep modes are dealt at stack level in a way that makes it
difficult to predict the next poll event.
If low power modes are required, the suggested solution is to use modem flow control
and MCU always asleep, the RX poll interval can be chosen as preferred.
If other energy-save modes are preferred please consider that intervals and timeouts
cannot be assured in this architecture as explained in the following notes:
In this architecture, the node will always sleep for the required poll interval and then
send a poll at wake up. If the device enters sleep mode, the elapsed time from the last
poll event is not taken into account and the next poll event will happen in poll interval
plus elapsed time since last poll event (the effective time between polls will therefore
be in the “required poll interval” to 2 * “required poll interval” range). Also if using mcu
policies that involve timers, consider that the time is approximative and it can vary up
to twice as much as the required interval. This behaviour depends on the ratio between
poll interval and sleep periods and also is affected by manually interrupting sleep mode
by RTS or incoming packets over the air. Also changing intervals when network is running
can amplify these effects.
Sleep-mode
timeout
Field
“Sleep-mode timeout”: optional, in order to override the value specified in the “Energy
save” parameter. Range [ 3 : 0xFFFFFFFF ] where 0xFFFFFFFF means sleep forever.
Notes:
The device will enter sleep mode immediately after sending the response.
If the UART hardware flow control is not in modem mode, the host will not have a way
to wake up the device (such as RTS switching in modem mode), in this case, to avoid
losing control of the module, the sleep-mode timeout must be used wisely.
When exiting the forced sleep mode period, the normal behaviour specified with the
Energy-save command will be restored.
If radio is always enabled, the device will not enter sleep mode.
Some combinations of “host interface policy” and “sleep-mode timeout” don't make
sense and are not allowed such as:
Any sleep-mode timeout and host interface policy set to always off
Sleep-mode timeout not attached and host interface policy set to always on or always off
Sleep-mode timeout = 0xFFFFFFFF with host interface policy set to always on
If the current host interface energy-save policy has a “Wakeup anticipation” parameter,
the sleep-mode timeout will be reduced by this anticipation.
Only end devices are allowed to sleep.
Auto associate
Auto network
Auto network
Auto network
Auto channel
Auto restore
identifier
Auto role
Reserved
creation
children
network
address
Field
“Auto network creation”: if set, the module will invoke a network start at startup right
after loading the data from NVM in order to automatically create a network.
“Auto channel”: if set, this bit will make the device pick the less busy channel (if
creating a network) or the channel with the best network to associate to (if joining a
network). All the channels possibilities must be included in the channel mask.
“Auto network address”: if set makes an end device or router get the network address
from the parent they are joining to. In a coordinator this parameter will be ignored and
the network address used will be one declared with the “set network address”
command.
“Auto network identifier”: if set makes the end device or router join the best network
available without caring about the PANID (perfect for the first join). In a coordinator this
bit makes the coordinator pick a random network identifier.
“Auto associate children”: if set, the module will accept every association requests and
will automatically allocate an address for the devices requiring it without asking or
informing the host about it.
“Auto restore network”: if set, when a coordinator will be started, it will restore the
previous network (if any) without doing the normal network formation procedure (useful
in case of coordinator crashes). This will happen only if previous network had some
status to be saved (joined devices, etc). This will only be considered by coordinators.
“Auto role”: if set to 1, the module will start a network as coordinator unless a network
with the defined parameters is found. In that case, the node will join the network as a
router. If set to 2, the module will start as coordinator or end device.
Notes:
If auto role and auto network identifier are both set, the device will join the first
network it finds (no matter which network identifier it has) or will create a network with
a random network identifier otherwise.
On the EMB-ZRF2xx and EMB-Z253x the children are always auto associated.
On the EMB-ZRF2xx the network restore option is not supported.
(open network)
permitted
Joining
Field
Length 1 Byte
“Joining permitted”: time in seconds during which to accept new devices to join the
network. If set to 0x00, the network will not accept joining requests from devices which
were not part of the network. If set to 0xFF the network will open and never close again
automatically.
Notes:
On the EMB-ZRF2xx, the maximum value for the “Joining permitted” field is 60 (or
0xFF).
Network key
Options
Field
The second byte send over the serial interface indicates how much time to spend on
each channel with the following formula (x is the value sent with this second byte):
timePerChannel = 15.75 ms * (1 << x);
A typical value of this byte for network discovery is 3. For energy measurements, the
longer this time is, the more accurate the results will be.
Notes:
The network/energy scan will be performed on the channels selected with the channel
mask. The time needed for this operation depends on the selected channel count and
the time spent on each channel.
Typically, in 802.15.4 networks, the network scan operations will be performed with
active scan (request for beacons).
This command is not available on the EMB-ZRF2xx and EMB-Z253x modules.
Least noisy
Most noisy
Execution
channel
channel
data
Field
The “Execution status byte” specifies if the operation concluded successfully and further
data is present.
The “Least noisy channel” field indicates which channel revealed the minimum RF power
during the scan (or zero if no channel was selected).
The “Most noisy channel” field indicates which channel revealed the maximum RF power
during the scan (or zero if no channel was selected).
The “Channel RSSI data” (most significant byte transmitted first) contains the RSSI
acquired on each channel (least significant byte refers to channel 1). Only channels 11
to 26 are available for 802.15.4. Channels who are not selected will contain zeros.
Network count
Network data
status byte
Execution
Field
The “Execution status byte” specifies if the operation concluded successfully and further
data is present.
The “Network count” field indicates how many networks were found.
The “Network data” is the concatenated data for each network formatted as follows:
Channel
PANID
Rssi
Field
Output cluster
Input clusters
Input cluster
Profile ID
Device ID
Endpoint
clusters
number
number
number
Output
Field
The “Endpoint number” field identifies the endpoint on the device. Range: [0x01, 0xEF].
The “Profile ID” field must be set according to ZigBee specifications (for example: Home
Automation 0x0104).
The “Device ID” field must be set according to ZigBee specifications.
The “Input(Output) cluster number” indicate how many clusters are supported on the
endpoint for each direction.
The “Input clusters”(“Output clusters”) fields are lists of the supported cluster (unsigned
16 bit integers).
IEEE address
status byte
Execution
Network
address
Field
The “Execution status byte” indicates if the data was found or retrieved correctly.
The “Network address” is the short address of the device.
The “IEEE address” is the extended address of the device.
Notes:
This packet will return a negative execution status response if the module fails to find
an address association in its tables and with over the air requests.
IEEE address
information
Capability
Field
The “IEEE address” is the extended address of the device requiring association.
The “Capability information” show the functionalities implemented in the device (as
specified in the IEEE 802.15.4 specification).
Notes:
The association can be performed automatically without this set of commands when the
associated bit is set in the automatic options.
Network
address
Field
The “Execution status byte” indicates if the device is to be associated (0) or rejected
(anything else).
The “Network address” can be inserted or not. If present, the module will associate the
specified address to the device during association, if not, it will pick an address
automatically.
Notes:
The response must arrive to the module before 300 ms from request.
This command is not available on the EMB-ZRF2xx and EMB-Z253x module.
Custom power
ZigBee data
Destination
Destination
identifier
network
channel
Options
address
Custom
Field
Length 2 Bytes 0/1 Byte 0/1 Byte 0/2 Bytes 2/8 Bytes Variable
The “Options” field indicates to the module which option to apply to the request:
b15 (MSb) – Send on specific channel
b14 – Send with specific output power
b13 – Send on specific network (for interpan messages)
b12 – Security enabled
b11 ↔ b2 - Reserved
b1 – Send with extended source address (instead of short network address)
b0 (LSb) – Send to extended destination address (instead of short network address)
The “Custom channel” field is only present if the bit 15 in the “options” field is set. It
indicates on which channel this packet must be sent. On 2.4 GHz, the 802.15.4 standard
supports channels from 11 to 26.
The “Custom power” field is only present if the bit 14 in the “options” field is set. It
indicates which output power to use with this specific packet. The power is expressed in
dBm in a signed integer as described earlier for the “Output power” command.
The “Destination network identifier” field is only present if the bit 13 in the “options”
field is set. It indicates to which PANID the packet is addressed and can be used for
interpan messages if the field is set to 0xFFFF.
The “Destination address” field is the 16 bit network address (most significant byte
transmitted first) of the recipient device. The address can be its extended IEEE address
(64 bit long, most significant byte transmitted first) if the bit 0 of the “Options” field is
set.
The “ZigBee data” field is formatted as follows:
Destination
application
Cluster ID
Profile ID
Endpoint
Endpoint
payload
Source
ZigBee
Field
The “Profile ID” field specifies to which profile this packet belongs to.
The “Source Endpoint” field specifies from which endpoint the packet must be sent.
The “Destination Endpoint” field specifies to which endpoint the packet is sent.
The “Cluster ID” field specifies to which cluster the following command belongs.
The “ZigBee application payload” is the effective payload to be sent to the destination
endpoint. If a ZCL application is targeted, this payload should implement the ZCL format
as described in the ZigBee Cluster Library Specifications [2]. In details, the first bytes
will be formatted as follows:
Frame control
ZCL command
Manufacturer
Transaction
sequence
number
code
Data
field
Field
For more information on these fields, please consult the ZigBee Cluster Library
Specifications [2, chapter 2.3.1].
The “Data” field contains the data to be delivered to the destination endpoint. It's
maximum length depends on the enabled options and selected command.
Notes:
The EMB-ZRF2xx doesn't support sending packets on different channels, with a different
power or to a different network identifier.
The EMB-Z253x doesn't support specifying the security to use during packet send. The
security setting used will be the one of the network.
The EMB-Z253x will not buffer broadcast messages for sleeping end-devices. Because of
this, sleeping end devices will not receive broadcast messages.
The EMB-Z253x doesn't support sending with extended addresses (both sender and
receiver). It doesn't support sending packets on different channels or with a different
power.
RSSI of the
Execution
Retries
Field
Notes:
The “Retries” parameter is only present in some architectures.
The “RSSI of the acknowledge” field is only present if the “Execution status byte”
indicates success and the packet was not a broadcast.
On the EMB-ZRF2xx the only field present is the Execution status byte
Source address
ZigBee Data
Destination
Destination
identifier
identifier
network
network
Options
address
Source
Field Rssi
The “Options” field indicates to the host which fields are present in the packet and
which options the received packet was implementing:
b15 (MSb) – Rssi attached
b14 – Sent from a different network identifier
b13 – Sent to a different network identifier
b12 – Security enabled
b11 ↔ b2 - Reserved
b1 – Extended source address (instead of short network address)
b0 (LSb) – Extended destination address (instead of short network address)
The “Rssi” field indicates the received signal strength in dBm (signed integer) and is only
present if the associated bit in the “Options” field is set.
The “Source network identifier” field is only present if the bit 14 in the “Options” field
is set. It indicates from which PANID the packet was sent.
The “Destination network identifier” field is only present if the bit 13 in the “Options”
field is set. It indicates to which PANID the packet was sent (broadcast PANID for
example).
The “Source address” field is the 16 bit network address (most significant byte
transmitted first) of the sending device. The address can be its extended IEEE address
(64 bit long, most significant byte transmitted first) if the source device sent it with
extended address information instead of network address information. In this case, bit 1
of the “Options” field is set.
The “Destination address” field is the 16 bit network address (most significant byte
transmitted first) of the recipient device. The address can be its extended IEEE address
(64 bit long, most significant byte transmitted first) if the bit 0 of the “Options” field is
set.
The “ZigBee data” field is formatted as follows:
Destination
application
Cluster ID
Profile ID
Endpoint
Endpoint
payload
Source
ZigBee
Field
The “Profile ID” field specifies to which profile this packet belongs to.
The “Source Endpoint” field specifies from which endpoint the packet must be sent.
The “Destination Endpoint” field specifies to which endpoint the packet is sent.
The “Cluster ID” field specifies to which cluster the following command belongs.
The “ZigBee application payload” is the effective payload to be sent to the destination
endpoint. If a ZCL application is targeted, this payload should implement the ZCL format
as described in the ZigBee Cluster Library Specifications. In details, the first bytes will
be formatted as follows:
Frame control
ZCL command
Manufacturer
Transaction
sequence
number
code
Data
field
Field
For more information on these fields, please consult the ZigBee Cluster Library
Specifications (chapter 2.3.1).
Notes:
The packets will be sent to the host only if they match the internal address filter
(destination network identifier identical to the one set in the module or broadcast and
destination network address identical to the one set in the module or broadcast).
On EMB-Z253x and EMB-ZRF2xx, the profile ID is not considered and always returned as
0xFFFF.
On EMB-ZRF2xx, the source and destination PAN IDs are not checked and will always
return the PAN ID of which the device is part of.
4 Annex
4.2 Trademarks
Embit is a registered trademark owned by Embit s.r.l.
All other trademarks, registered trademarks and product names are the sole property of
their respective owners.