ASW0104 MG245X- API Reference
V1.1 Page:2/52
www.radiopulse.co.kr
REVISION HISTORY
Version Date Description
VER.1.0 2009.02.23 First Version Release
VER.1.1 2011.01.04 Sec 5.5.1.7
<Transmitting after Route Discovery> is modified.
ASW0104 MG245X- API Reference
V1.1 Page:3/52
www.radiopulse.co.kr
CONTENTS
1. INTRODUCTION................................................................................................................................... 5
2. DEFINITIONS ........................................................................................................................................ 6
3. ZIGBEE LAYER AND FRAME STRUCTURE ........................................................................................ 8
4. NWK LAYER .......................................................................................................................................... 9
4.1. NWK FRAME FORMAT ....................................................................................................................................... 9
4.2. NWK STATUS .................................................................................................................................................... 10
4.2.1. Standard Status ............................................................................................................................................ 10
4.2.2. Additional Status ......................................................................................................................................... 10
4.2.3. MAC Status .................................................................................................................................................... 10
4.3. NWK INFORMATION BASE(NIB) ................................................................................................................... 11
4.3.1. Normal NIB .................................................................................................................................................... 11
4.3.2. Table NIB ......................................................................................................................................................... 12
4.3.3. Additional NIB .............................................................................................................................................. 14
4.4. NWK PRIMITIVE ............................................................................................................................................... 17
4.5. NWK API .......................................................................................................................................................... 18
4.5.1. ZNWK_NET_DISC_REQ(REQUEST, CONFIRM) ................................................................................. 18
4.5.2. ZNWK_NET_FORM_REQ(REQUEST, CONFIRM) .............................................................................. 19
4.5.3. ZNWK_PERMIT_JOIN_REQ(REQUEST, CONFIRM).......................................................................... 21
4.5.4. ZNWK_START_ROUTE_REQ(REQUEST, CONFIRM) ........................................................................ 22
4.5.5. ZNWK_JOIN_REQ(REQUEST, CONFIRM) ........................................................................................... 23
4.5.6. ZUSER_NWK_JOIN_IND(INDICATION) ................................................................................................ 26
4.5.7. ZNWK_LEAVE_REQ(REQUEST, CONFIRM) ......................................................................................... 26
4.5.8. ZUSER_NWK_LEAVE_IND(INDICATION) ............................................................................................. 27
4.5.9. ZNWK_RESET_REQ(REQUEST, CONFIRM) ......................................................................................... 27
4.5.10. ZNWK_SYNC_REQ(REQUEST, CONFIRM) .......................................................................................... 28
4.5.11. ZNWK_ED_SCAN_REQ(REQUEST, CONFIRM) .................................................................................. 28
4.5.12. ZNWK_GET_REQ(REQUEST, CONFIRM) ............................................................................................. 30
4.5.13. ZNWK_GET_TABLE_REQ(REQUEST, CONFIRM) ............................................................................... 30
4.5.14. ZNWK_SET_REQ(REQUEST, CONFIRM) .............................................................................................. 30
4.5.15. ZNWK_SET_TABLE_REQ(REQUEST, CONFIRM) ................................................................................ 31
4.5.16. ZNWK_ROUTE_DISC_REQ(REQUEST, CONFIRM) ........................................................................... 31
4.5.17. ZNWK_DIRECT_JOIN_REQ(REQUEST, CONFIRM) .......................................................................... 32
4.6. NWK FUNCTION .............................................................................................................................................. 33
4.6.1. NWKLIB_DevMgmt_GetIEEEAddr() ...................................................................................................... 33
4.6.2. NWKLIB_DevMgmt_DeleteNWKAddr() .............................................................................................. 33
4.6.3. NWKLIB_DevMgmt_GetNwkAddr() ..................................................................................................... 33
ASW0104 MG245X- API Reference
V1.1 Page:4/52
www.radiopulse.co.kr
4.6.4. NWKLIB_DevMgmt_DeleteIEEEAddr() ................................................................................................ 34
4.6.5. NWKLIB_DevMgmt_UpdateIEEEAddr() .............................................................................................. 34
4.6.6. NWKLIB_DevMgmt_AddNT() .................................................................................................................. 35
4.6.7. Others ............................................................................................................................................................... 35
5. APS LAYER .......................................................................................................................................... 36
5.1. APS FRAME FORMAT ....................................................................................................................................... 36
5.2. APS STATUS ...................................................................................................................................................... 36
5.3. APS INFORMATION BASE(AIB) ...................................................................................................................... 37
5.3.1. Normal AIB..................................................................................................................................................... 37
5.3.2. Additional AIB ............................................................................................................................................... 38
5.4. APS PRIMITIVE .................................................................................................................................................. 38
5.5. APS API ............................................................................................................................................................ 39
5.5.1. ZAPS_DATE_REQ(REQUEST, CONFIRM) ............................................................................................. 39
5.5.2. ZUSER_APS_DATA_IND(INDICATION) ................................................................................................. 44
5.5.3. ZZDP_APS_DATA_IND(INDICATION) ................................................................................................... 45
5.5.4. ZAPS_SET_REQ(REQUEST, CONFIRM) ................................................................................................ 45
5.5.5. ZAPS_SET_TABLE_REQ(REQUEST, CONFIRM) .................................................................................. 45
5.5.6. ZAPS_GET_REQ(REQUEST, CONFIRM) ................................................................................................ 46
5.5.7. ZAPS_GET_TABLE_REQ(REQUEST, CONFIRM) ................................................................................. 46
5.5.8. ZAPS_BIND_REQ(REQUEST, CONFIRM) ............................................................................................. 47
5.5.9. ZAPS_UNBIND_REQ(REQUEST, CONFIRM) ...................................................................................... 48
5.5.10. ZAPS_ADD_GROUP_REQ(REQUEST, CONFIRM) ............................................................................. 49
5.5.11. ZAPS_REMOVE_GROUP_REQ(REQUEST, CONFIRM) .................................................................... 49
5.5.12. ZAPS_REMOVE_ALL_GROUP_REQ(REQUEST, CONFIRM)........................................................... 50
5.5.13. ZAPS_ESTABLISH_KEY_REQ(REQUEST, CONFIRM) ........................................................................ 50
5.5.14. ZAPS_TRANSPORT_KEY_REQ(REQUEST, CONFIRM) .................................................................... 50
5.5.15. ZAPS_UPDATE_DEVICE_REQ(REQUEST, CONFIRM) ...................................................................... 50
5.5.16. ZAPS_REMOVE_DEVICE_REQ(REQUEST, CONFIRM) .................................................................... 50
5.5.17. ZAPS_REQUEST_KEY_REQ(REQUEST, CONFIRM) ........................................................................... 50
5.5.18. ZAPS_SWITCH_KEY_REQ(REQUEST, CONFIRM) ............................................................................. 50
5.6. APS FUNCTION ................................................................................................................................................ 50
5.6.1. APSLIB_FindGT_GroupAddr() .................................................................................................................. 50
ASW0104 MG245X- API Reference
V1.1 Page:5/52
www.radiopulse.co.kr
1. INTRODUCTION
MG245X-ZigBeePRO is ZigBeePRO Stack Library provided by RadioPulse. It supports
IEEE802.15.4 and ZigBeePRO.
This document explains functions and APIs of MG245X-ZigBeePRO.
ASW0104 MG245X- API Reference
V1.1 Page:6/52
www.radiopulse.co.kr
2. DEFINITIONS
AIB: APS Information Base. It defines the parameter used in APS
APS layer: Application Support Layer. It includes the functions for supporting Application
layer and ZDO. Lower layer of Application layer and ZDO and high layer of NWK. It performs
data transmission, Binding and Group management.
Child Device: When a new device is joined to the ZigBee Coordinator or ZigBee Router in
ZigBee Network, it has relationship as parent-child. The device joined newly is to be a child
device of the coordinator, which allows join, or router. ZigBee Coordinator cannot be a child.
ED: Energy Detection
EPID(Extended PAN ID): This is the globally unique 64-bit PAN identifier of the network.
This should be unique among the PAN in a given area.
Extended Address: Refer to “IEEE Address”
IEEE Address: This is the globally unique 64-bit address of a device(=Extended Address)
Network Address: This is the 16-bit address assigned to a device by the NWK
layer.(=Short Address)
MAC layer: Media Access Control Layer. Control a device. Lower layer of NWK and
higher layer of PHY. MAC layer of ZigBee 2006 is compliant to IEEE 802.15.4-2003
NIB: NWK Information Base. It defines the parameter used in the NWK layer.
NWK layer: Network Layer. This layer includes the functions for managing ZigBee
Network. Lower layer of APS and higher Layer of MAC. It performs data transmission
(formation, join and management) and routing function
PAN: Personal Area Network
Parent Device: When a new device is joined to the ZigBee Coordinator or ZigBee Router
in ZigBee Network, it has relationship as parent-child. The device which allows join is to be a
parent device of the device joined newly. ZigBee end device can not be a parent.
PHY layer: Physical Layer. Lower layer of MAC and performs corresponding function by
controlling of MAC layer
Short Address: Refer to “Netowrk Address”
UINT8: unsigned char. 8-bit.
UINT16: unsigned short. 16-bit.
ASW0104 MG245X- API Reference
V1.1 Page:7/52
www.radiopulse.co.kr
UINT32: unsigned long. 32-bit.
ZC: ZigBee Coordinator
ZED: ZigBee End Device
ZR: ZigBee Router
ASW0104 MG245X- API Reference
V1.1 Page:8/52
www.radiopulse.co.kr
3. ZIGBEE LAYER AND FRAME STRUCTURE
[Figure 1] and [Figure 2] show ZigBee layer and frame structure for each layer.
PHY Layer
MAC Layer
NWK Layer
ZDO Managerment
MLMEMLDE
PLDE PLME
APS Layer APSME
ZDO Data (EP0)
Application Layer
APPObject(EP1)
APSDE(ZCL)
APSDE(ZDP)
NLDE
NLME
Security Service Provider
APPObject
(EP240)...
Figure 1. ZigBee Layer Structure
Payload(PSDU, 0~127Bytes)
PHY
MAC
NWK
APS
APP
Header(~23Bytes)
Payload(MSDU)
FCS(2Bytes)
Header(~25Bytes)
Payload(NSDU)
Header(~13Bytes)
Payload(ASDU)
ZDP or ZCL Frame Format
Header(6Bytes)
Figure 2. ZigBee Frame Format
The PHY Header field consists of Preamble(4Bytes), SOF(Start Of Frame, 1Byte) and PSDU
Length(1Byte).
ASW0104 MG245X- API Reference
V1.1 Page:9/52
www.radiopulse.co.kr
4. NWK LAYER
4.1. NWK Frame Format
As shown in [Figure 3], NWK frame consists of header and payload.
NWK Header NWK Payload
Octet:1 2 2 1 1 0/8 0/8 0/1 var var
Frame
Control
Dst
Addr
Src
Addr
Radius Seq
Num
Dst
IEEE
Src
IEEE
Multi
Ctrl
Src
Route
NSDU
Figure 3. NWK Frame Format
NWK Header Description
FrameControl The characteristic of a frame. Following subfields are present.
bit[15:13] : reserved. It is always 0.
bit[12] : SrcIEEEPresent. When it is 1, SrcIEEE field is present.
bit[11] : DstIEEEPresent. When it is 1, DstIEEE field is present.
bit[10] : SourceRoute. When it is 1, it means Source Route frame and
SrcRoute field is present.
bit[9] : Security. 1=Secured frame.
bit[8] : MulticastFlag. When it is 1, it means multicast frame and MultiCtrl
field is present.
bit[7:6] : DiscoverRoute. Enable or disable Route Discovery. It is always
0 for NWK Command frames. 0=Suppress, 1=Enable, 2~3=reserved
bit[5:2] : ProtocolVersion. 0=ZigBee2004, 2=ZigBee2006/2007/PRO
bit[1:0] : FrameType. 0=NWK Data, 1=NWK Command
DstAddr 16-bit device address or group identifier of the destination.
FrameControl‟s MulticastFlag=0 : device address
FrameControl‟s MulticastFlag=1 : group identifier
SrcAddr 16-bit NWK address of the source device
Radius The number of hops of the transmitted frame. When a frame is received,
Radius is decreased by 1. If the decreased Radius is not 0, the frame can
be relayed when relaying is needed.
SeqNum Sequence number of a frame. It is used to distinguish NWK frames.
DstIEEE 64-bit IEEE address of a destination device.
SrcIEEE 64-bit IEEE address of a source device.
MultiCtrl Multicast Control subfield.
bit[7:5] : MaxNonmemberRadius. The maximum number of hops in
multicasting.
bit[4:2] : NonmemberRadius. The number of hops in which a frame can
travel through non-member devices. This value is decreased by 1 when
a multicast frame is received by a non-member device. And, When a
member device relays a multicast frame, this value is reset to
MaxNonmemberRadius
bit[1:0] : Multicast Mode. 0=Non-Member Mode. 1=Member Mode
SrcRoute Octet : 1 1 variable(2Byte * N)
Relay Count Relay Index Relay List
Relay List
number(N)
Index of next relay on
relay list.
Short Address Relay List
NSDU NWK data.
ASW0104 MG245X- API Reference
V1.1 Page:10/52
www.radiopulse.co.kr
4.2. NWK Status
4.2.1. Standard Status
Name Value Description
SUCCESS 0x00 Success
INVALID_PARAMETER 0xC1 Parameter of primitive is invalid.
INVALID_REQUEST 0xC2 Request invalid parameter.
NOT_PERMITTED 0xC3 When NLME-JOIN.req, join is not allowed.
STARTUP_FAILURE 0xC4 When NLME-NETWORK-FORMATION.req, network is
not formatted.
ALREADY_PRESENT 0xC5 When NLME-DIRECT-JOIN.req, a device is in neighbor
table.
SYNC_FAILURE 0xC6 When NLME-SYNC.req, synchronization is failed.
NEIGHBOR_TABLE_FUL
L
0xC7 When NLME-DIRECT-JOIN.req, there is no entry in the
neighbor table.
UNKNOWN_DEVICE 0xC8 When NLME-LEAVE.req, there is no device in the
neighbor table.
UNSUPPORTED_ATTRIB
UTE
0xC9 When NLME-GET.req and NLME-SET.req, request
unsupported attribute.
NO_NETWORKS 0xCA When NLME-JOIN.req, there is no network defined in
parameter.
LEAVE_UNCONFIRMED 0xCB Failed confirmation for LEAVE.
MAX_FRM_CNTR 0xCC The error which frame counter is reached to the
maximum when sending by security.
NO_KEY 0xCD There is no key when sending by security.
BAD_CCM_OUTPUT 0xCE CCM code generation error when sending by security.
NO_ROUTING_CAPACIT
Y
0xCF The error which requests routing discovery to the device
which doesn‟t have routing capacity.
ROUTE_DISCOVERY_FA
ILED
0xD0 Routing discovery failure because of other reason
except NO_ROUTING_CAPACITY.
ROUTE_ERROR 0xD1 When NLDE-DATA.req, data cannot be sent because of
routing failure.
BT_TABLE_FULL 0xD2 Failed broadcast/multicast because BTT is full.
FRAME_NOT_BUFFERE
D
0xD3 The error which frame is ignored because Non-member
multicast cannot be buffered.
4.2.2. Additional Status
These values are defined by RadioPulse
Name Value Description
RP_LONG_MSDU 0xD5 MSDU is too long..
RP_NO_RESPONSE 0xD6 There is no rejoin response command frame.
RP_NOT_DEFINED 0xD7 Not defined command or parameter
RP_NQ_BUSY 0xDB All network queues are occupied now.
RP_NO_IMPLEMENT 0xDC The function is not implemented.
RP_REJOINING 0xDD Rejoin procedure is performing.
RP_ROUTE_FIRST 0xDE The route to the destination is not present. Route
discovery should be performed.
RP_DISCOVERING 0xDF Route discovering is performing now.
4.2.3. MAC Status
ASW0104 MG245X- API Reference
V1.1 Page:11/52
www.radiopulse.co.kr
These values are MAC status codes which are used in NWK CONFIRM status.
Name Value Description
CHANNEL_ACCESS_FAI
LURE
0xE1 A frame is not transmitted because the channel is busy.
INVALID_PARAMETER 0xE8 Invalid Parameter for MAC primitives
NO_ACK 0xE9 MAC ACK frame is not received.
NO_DATA 0xEB When polling, there is no data to receive from the parent
device.
TRANSACTION_OVERFL
OW
0xF1 Pending is failed because MAC buffer for pending
transactions is full.
RP_PENDING_OK 0xFE Pending a transaction is successful.
4.3. NWK Information Base(NIB)
The Network Information Base(NIB) comprises the attributes required to manage the NWK
layer of a device.
4.3.1. Normal NIB
Name Att.
ID
Range Description Default
nwkPanID 0x80 UINT16 PAN identifier 0xFFFF
nwkDSN 0x81 UINT8 A sequence number used to identify outgoing
frames
0
nwkPassiveAckTim
eout
0x82 UINT8 The maximum time duration in milli-seconds
allowed for the parent and all child devices to
retransmit a broadcast message.
3
nwkMaxBroadcast
Retry
0x83 UINT8 The maximum number of retries allowed
after a broadcast transmission failure.
3
nwkMaxChildren 0x84 UINT8 This NIB is not used. 8
nwkMaxDepth 0x85 UINT8 This NIB is not used. 4
nwkMaxRouter 0x86 UINT8 This NIB is not used. 5
0x87
nwkNetBroadDelive
rTime
0x88 UINT16 The duration in milli-seconds that a
broadcast message needs to encompass the
entire network.
9000
nwkReportConstant
Cost
0x89 UINT8 This NIB is not used. 0
nwkRouDiscRetryP
ermit
0x8A UINT8 This NIB is not used. 3
0x8B
nwkTimeStamp 0x8C 0 or 1 This NIB is not used. 0
nwkTxTotal 0x8D UINT16 This NIB is not used. 0
nwkSymLink 0x8E 0 or 1 1=The forward and backward routes are
stored in route discovery.
0=Only the forward route is stored in
route discovery.
1
nwkCapaInfo 0x8F UINT8 Device capability information 0x80
nwkAddrAlloc 0x90 UINT8 The method of address allocation
0=Distributed (ZigBee2007 Feature)
2
ASW0104 MG245X- API Reference
V1.1 Page:12/52
www.radiopulse.co.kr
2=stochastic (ZigBeePRO Feature)
nwkUseTreeRoute 0x91 0 or 1 Whether the NWK layer use tree routing 1
nwkManagerAddr 0x92 UINT16 The address of the designated network
channel manager function.
0x0000
nwkMaxSrcRoute 0x93 UINT8 The maximum number of hops in a source
route.
0x0C
nwkUpdateId 0x94 UINT8 The value identifying a snapshot of the
network settings with UpdateID in which this
node is operating.
0
nwkTransPersisTim
e
0x95 UINT16 The maximum time in milli-seconds that a
transaction is pending in the transmitter‟s
queue.
5000
nwkNetworkAddr 0x96 UINT16 The 16-bit address of the device. 0xFFFF
nwkStackProfile 0x97 UINT8 The identifier of ZigBee stack profile in usage
for this device.
2
0x98 UINT8
0x99 UINT8
nwkEPID 0x9A UINT8[8] Extended PAN ID for the device.
nwkUseMulticast 0x9B 0 or 1 1=Multicast occurs at the NWK layer.
0=Multicast occurs at the APS layer.
1
0x9C UINT8
nwkIsConcentrator 0x9D 0 or 1 1=Device is a concentrator
0=Device is not a concentrator
0
nwkConcentratorR
adius
0x9E UINT8 This NIB is not used 0
nwkConcentratorDi
scTime
0x9F UINT8 This NIB is not used 0
nwkLinkStatusPerio
d
0xA6 UINT8 The time in seconds between link status
command frames.
15
nwkRouterAgeLimit 0xA7 UINT8 The number of missed link status command
frames before resetting the links costs to
zero.
3
nwkUniqueAddr 0xA8 UINT8 1=Addresses are unique.
0=Addresses may not be unique.
1
(Note) The data type of nwkNetBroadDeliverTime is not UINT16 but UINT8 in the
specification. And the unit of it is not milli-second but second in the specification. But in
MG245X-ZigBeePRO, those are UINT16 and milli-second.
4.3.2. Table NIB
4.3.2.1. Neighbor Table(Attribute ID = 0x87)
Name Range Description
IEEEAddr UINT8[8] IEEE Address of Neighbor Device.
It is valid when parent/child relation.
NwkAddr UINT16 NWK Address of Neighbor Device.
DevType UINT8 Type of Neighbor Device.
0 = ZigBee Coordinator
1 = ZigBee Router
2 = ZigBee End-Device
ASW0104 MG245X- API Reference
V1.1 Page:13/52
www.radiopulse.co.kr
RxOnWhenIdle UINT8 1 : When idle status, receiver is ON.
0 : When idle status, receiver is OFF.
Relation UINT8 It means the relationship with Neighbor Device.
0 = parent
1 = child
2 = sibling
3 = no relation
4 = previous child
TxFailure UINT8
NtLQI UINT8 LQI of packet received finally from Neighbor Device.
OutCost UINT8 Link Cost to the Neighbor Device
Age UINT8 The number of nwkLinkStatusPeriod intervals since a link
status command was received.
EnaNT UINT8 1 = Entry is valid. (Enable)
0 = Entry is not valid.(Disable)
4.3.2.2. Routing Table(AttributeID = 0x8B)
Name Range Description
DstAddr UINT16 Address of Routing Destination
RtOption UINT8 Route Option.
bit[7] : reserved
bit[6] : 1=No Route Cache.
bit[5] : 1=DstAddr means Group ID.
bit[4] : 1=Route Record is required before transmitting.
bit[3] : 1=It means Many-To-One Route.
bit[2:0] : reserved
Sta UINT8 It means the status of Route.
0x00 : ACTIVE
0x01 : DISCOVERY UNDERWAY
0x02 : DISCOVERY FAIL
0x03 : INACTIVE
0x04 : VALIDATION UNDERWAY
NextHop UINT16 Address of Next Hop device of the Route.
EnaRT UINT8 1 = Entry is valid. (Enable)
0 = Entry is not valid.(Disable)
4.3.2.3. Broadcast Transaction Record Table(AttributeID = 0x98)
Name Range Description
SrcAddr UINT16 Network address of the broadcast initiator
SeqNum UINT8 The NWK layer sequence number of the broadcast frame
BttExpTime UINT16 A countdown timer indicating the number of milli-seconds until
this entry expires. If this value is 0, it means that the entry is
not valid.
4.3.2.4. Group ID Table(AttributeID = 0x99)
Name Range Description
GroupID UINT16 It means Group ID.
EnaGID UINT8 1 = Entry is valid. (Enable)
0 = Entry is not valid.(Disable)
4.3.2.5. Route Record Table(AttributeID = 0x9C)
ASW0104 MG245X- API Reference
V1.1 Page:14/52
www.radiopulse.co.kr
Name Range Description
NwkAddr UINT16 The destination network address for this route record
RelayCount UINT16 The count of relay nodes from initiator to the destination
Path UINT16[12] The set of network address that represent the route in order
from the initiator to the destination
EnaRRECT UINT8 1 = Entry is valid. (Enable)
0 = Entry is not valid.(Disable)
4.3.2.6. Address Map Table(AttributeID = 0xA9)
Name Range Description
IEEEAddr UINT8[8] The 64-bit IEEE address of a device
NwkAddr UINT16 The 16-bit network address of a device
EnaNAM UINT8 1 = Entry is valid. (Enable)
0 = Entry is not valid.(Disable)
(NOTE) The address set, network and IEEE address, of a neighboring device are not stored
in the Address Map Table. It is only stored in the Neighbor Table for more effective memory
usage.
4.3.3. Additional NIB
These attributes are defined by RadioPulse, not by ZigBee specification.
Name Att.
ID
Range Description Default
DEVTYPE - UINT16 Currently operating device type
0x43(„C‟) : Coordinator
0x52(„R‟) : Router
0x45(„E‟) : End Device
0x4E(„N‟) : Not activated device
0x4E
SIZE_NT - UINT8 The number of entries in neighbor table 0
SIZE_RT - UINT8 The number of entries in routing table 0
SIZE_GID - UINT8 The number of entries in group ID table 0
SIZE_RDT UINT8 The number of entries in route discovery
table
0
SIZE_BTT UINT8 The number of entries in broadcast
transaction table
0
SIZE_RRECT UINT8 The number of entries in route record table 0
SIZE_NAM UINT8 The number of entries in network address
map table
0
SIZE_ReuseZRAdd
r
UINT8 The number of buffer storing ZR address to
be reused. Not used in ZigBeePRO.
0
SIZE_ReuseZEDA
ddr
UINT8 The number of buffer storing ZED address to
be reused. Not used in ZigBeePRO.
0
pNT - - pointer to neighbor table NULL
pRT - - pointer to routing table NULL
pGID - - pointer to group ID table NULL
pRDT - - pointer to route discovery table NULL
pBTT - - pointer to broadcast transaction table NULL
pRRECT - - pointer to route record table NULL
pNAM - - pointer to network address map table NULL
pReuseZRAddr - - pointer to buffer storing ZR address to be
reused. Not used in ZigBeePRO.
NULL
ASW0104 MG245X- API Reference
V1.1 Page:15/52
www.radiopulse.co.kr
pReuseZEDAddr - - pointer to buffer storing ZED address to be
reused. Not used in ZigBeePRO.
NULL
RREQNum - UINT8 Sequence number of route request
command to be transmitted.
0
InitRREQRetry - UINT8 The number of retries to transmit route
request command when a device initiates
route discovery.
3
RREQRetry UINT8 The number of retries to retransmit a
received route request command.
2
RouteDiscTime - UINT16 Duration of route discovery in milli-second.
For this time, route discovery table entry is
maintained.
10000
TxRetry - UINT8 The number of retries to transmit a NWK
packet when MAC Ack is not received.
3
WdtPeriod UINT16 Watchdog period of stack main loop in milli-
second.
10000
UpdateChan UINT8 The new operating channel when frequency
agility is issued.
NULL
UpdateReport UINT16 It indicates that the specified NIB is changed
in the stack library.
bit[15] : reserved
bit[14] : A routing table entry is deleted.
bit[13] : A neighbor table entry is deleted.
bit[12] : A network address map table
entry is deleted.
bit[11] : reserved
bit[10] : A routing table entry is added or
changed.
bit[9] : A neighbor table entry is added or
changed.
bit[8] : A network address map table is
added or changed.
bit[7:5] : reserved
bit[4] : Link status command is
transmitted.
bit[3] : reserved
bit[2] : The operating channel is changed.
bit[1] : The network address is changed.
bit[0] : NIB.DEVTYPE is changed.
0
Child_AssignZR UINT8 reserved 0
Child_CurrZR UINT8 reserved 0
Child_ReuseZR UINT8 reserved 0
Child_AssignZED UINT8 reserved 0
Child_CurrZED UINT8 reserved 0
Child_ReuseZED UINT8 reserved 0
MinValidLQI UINT8 LQI threshold of a received packet which is
considered valid. For usage of this value,
refer to NOTE below.
0
MaxLinkFail UINT8 When a device which indicates a unicast
data transmitting fails to transmit to the next
hop device, the TxFailure of neighbor table
entry corresponding to the next hop device is
0
ASW0104 MG245X- API Reference
V1.1 Page:16/52
www.radiopulse.co.kr
incremented by 1. Then, if TxFailure is equal
to MaxLinkFail, the neighbor table entry is
removed. If this value is 0, removing entry is
disabled.
JoinPriority UINT8 When joining, a device to join searches its
parent device in the neighbor table. If there
are many potential parents, the device
should select a parent device among them.
This value specifies the priority in selecting
the parent device.
0 = Less depth (On specification)
1 = More LQI (Out of specification)
0
(NOTE) MinValidLQI
(1) A device doesn‟t transmit a data packet to a neighboring device whose LQI in the
neighbor table is less than MinValidLQI.
(2) A received link status command whose LQI is less than MinValidLQI is ignored.
(3) The sender address of a received packet whose LQI is less than MinValidLQI is not
stored in the Neighbor Table.
ASW0104 MG245X- API Reference
V1.1 Page:17/52
www.radiopulse.co.kr
4.4. NWK Primitive
NWK consists of Request, Confirm, and Indication primitive. When receiving a request from
upper layer, corresponding function is done and then returns confirmation. In addition, when
the event occurs, MWK layer can notify the upper layer by indication.
OriginatorHigher
OriginatorNWK
RecipientNWK
RecipientHigher
REQUEST
CONFIRM
NWK Frame
INDICATION
Figure 4. NWK Primitive
[API List According To Primitive]
*** is defined by RadioPulse.
Primitive API
NLME-NETWORK-DISCOVERY ZNWK_NET_DISC_REQ()
NLME-NETWORK-FORMATION ZNWK_NET_FORM_REQ()
NLME-PERMIT-JOIN ZNWK_PERMIT_JOIN_REQ()
NLME-START-ROUTER ZNWK_START_ROUTE_REQ()
NLME-JOIN ZNWK_JOIN_REQ()
NLME-DIRECT-JOIN ZNWK_DIRECT_JOIN_REQ()
NLME-LEAVE ZNWK_LEAVE_REQ()
NLME-RESET ZNWK_RESET_REQ()
NLME-SYNC ZNWK_SYNC_REQ()
NLME-GET ZNWK_GET_REQ()
NLME-SET ZNWK_SET_REQ()
NLME-ROUTE-DISCOVERY ZNWK_ROUTE_DISC_REQ()
NLME-ED-SCAN ZNWK_ED_SCAN_REQ()
NLME-GET ***ZNWK_GET_TABLE_REQ()
NLME-SET ***ZNWK_SET_TABLE_REQ()
ASW0104 MG245X- API Reference
V1.1 Page:18/52
www.radiopulse.co.kr
4.5. NWK API
4.5.1. ZNWK_NET_DISC_REQ(REQUEST, CONFIRM)
This function is called to discover currently operating ZigBee networks.
4.5.1.1. REQUEST
Name Range Description
ScanChan UINT32 Channel List to scan. Each bit indicates whether the
corresponding channel is to be scanned.
bit[31:27] : reserved
bit[26] : 1=Channel 26(2480MHz) is to be scanned.
…
bit[11] : 1=Channel 11(2405MHz) is to be scanned.
bit[10:0] : reserved
ScanDur UINT8
(0x00~0x0E)
A value used to calculate spending time for scanning each
channel. The time is as follows.
0=33ms, 1=49ms, 2=81ms, 3=145ms
4=273ms, 5=529ms, 6=1.04sec, 7=2.06sec
8=4.11sec, 9=8.20sec, 10=16.40sec, 11=32.78sec
12~14=65.5sec
4.5.1.2. CONFIRM
The discovered network information is contained in CONFIRM.
Name Range Description
Sta UINT8 Status.
SUCCESS
NwkCount UINT8 The number of networks discovered by the search.
pNwkDesc Pointer to
Descriptor
Pointer to the list of network descriptors. One descriptor for
each discovered network.
(Network Descriptor : pNwkDesc)
Name Range Description
EPID UINT8[8] Extended Pan ID of the network
Chan UINT8 Current logical channel occupied by the network
Stack UINT8 A stack profile ID of the network
1=ZigBee2007
2=ZigBeePRO
Version UINT8 ZigBee protocol version of the network
0=ZigBee2004
2=ZigBee2006/2007/PRO
BO UINT8 Beacon order of the network
SO UINT8 Superframe order of the network
PermitJoin UINT8 1=The network permits joining.
RouterCapa UINT8 1=At least one device have the capacity to accept joining of a
router.
EndDevCapa UINT8 1=At least one device have the capacity to accept joining of
an end device.
ASW0104 MG245X- API Reference
V1.1 Page:19/52
www.radiopulse.co.kr
4.5.1.3. Effect On Receipt
On receipt of this function, the NWK layer performs active scan. After the completion of the
scanning, the information of discovered networks is contained in CONFIRM. And, the
information of each discovered ZC or ZR is stored in the neighbor table.
OriginatorApplication
OriginatorNWK
ZNWK_NET_DISC_REQ()
Active Scan
MAC Beacon Request Command
MAC Beacon
MAC Beacon
CONFIRM
< Network Discovery >
4.5.2. ZNWK_NET_FORM_REQ(REQUEST, CONFIRM)
This function is used to start a new ZigBee network. The device which has called this
function becomes ZC.
4.5.2.1. REQUEST
Name Range Description
ScanChan UINT32 Channel List to scan. Each bit indicates whether the
corresponding channel is to be scanned.
bit[31:27] : reserved
bit[26] : 1=Channel 26(2480MHz) is to be scanned.
…
bit[11] : 1=Channel 11(2405MHz) is to be scanned.
bit[10:0] : reserved
ScanDur UINT8
(0x00~0x0E)
A value used to calculate spending time for scanning each
channel. The time is as follows.
0=33ms, 1=49ms, 2=81ms, 3=145ms
4=273ms, 5=529ms, 6=1.04sec, 7=2.06sec
8=4.11sec, 9=8.20sec, 10=16.40sec, 11=32.78sec
12~14=65.5sec
BO UINT8 Beacon order to use. This should be 15.
SO UINT8 Superframe order to use. This should be 15.
BattExtend UINT8 This field is not used
ASW0104 MG245X- API Reference
V1.1 Page:20/52
www.radiopulse.co.kr
4.5.2.2. CONFIRM
Name Range Description
Sta UINT8 Status.
SUCCESS
INVALID_REQ : When the device is already a member of a
network. When IEEE address of the device is
NULL(0x00…0x00) or all 0xFF(0xFF…FF). When some
REQUEST field is out of range.
4.5.2.3. Effect On Receipt
On receipt of this function, the NWK layer takes following steps.
(1) ED(Energy Detection) Scan: the NWK layer performs ED scan.
(2) Choosing operating channel: After completion of ED scan, the NWK layer chooses the
lowest-energy-level channel as an operating channel.
(3) Setting network address: the NWK layer chooses 0x0000 as its own network address.
(4) Setting EPID(Extended PAN ID): If NIB.nwkEPID is NULL, NIB.nwkEPID is set to IEEE
address of the device.
(5) Active Scan: the NWK layer performs active scan.
(6) Choosing PAN ID: After completion of active scan, the NWK layer randomly chooses
PAN ID to use. The selected PAN ID is not conflicted with PAN ID of any network known by
active scan.
(7) Starting a new PAN: the NWK layer starts a new PAN using ZMAC_START_REQ().
ASW0104 MG245X- API Reference
V1.1 Page:21/52
www.radiopulse.co.kr
OriginatorApplication
OriginatorNWK
ED Scan
MAC Beacon Request Command
MAC Beacon
MAC Beacon
CONFIRM
ZNWK_NET_FORM_REQ()
Select Channel, NwkAddr and EPID
Active Scan
Select PanID
ZMAC_START_REQ()
OriginatorMAC
ZMAC_SCAN_REQ()
CONFIRM
ZMAC_SCAN_REQ()
CONFIRM
CONFIRM
< Network Formation >
4.5.3. ZNWK_PERMIT_JOIN_REQ(REQUEST, CONFIRM)
This function is called to permit or prohibit the joining of new devices.
4.5.3.1. REQUEST
Name Range Description
PermitDur UINT8 Permit duration.
0x00 : Prohibit the joining.
0xFF : Permit the joining.
0x01~0xFE : Permit the joining for (PermitDur*1024) ms.
4.5.3.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
ASW0104 MG245X- API Reference
V1.1 Page:22/52
www.radiopulse.co.kr
4.5.3.3. Effect On Receipt
On receipt of this function, If PermitDur is 0x00 or 0xFF, MPIB.macAssociationPermit is set
to 0 or 1. If PermitDur is 0x01 ~ 0xFE, MPIB.macAssociationPermit is set to 1 and after the
limited time, it is cleared to 0.
OriginatorApplication
OriginatorNWK
MPIB.macAssoPermit=0 or 1
CONFIRM
ZNWK_PERMIT_JOIN_REQ()(PermitDuration=0 or 0xFF)
OriginatorMAC
ZMAC_SET_REQ()
CONFIRM
< Permit Joining : PermitDuration=0x00 or 0xFF >
OriginatorApplication
OriginatorNWK
MPIB.macAssoPermit=1
ZNWK_PERMIT_JOIN_REQ()(PermitDuration=1 ~ 0xFE)
OriginatorMAC
ZMAC_SET_REQ()
CONFIRM
Wait for the duration
MPIB.macAssoPermit=0
ZMAC_SET_REQ()
CONFIRM
CONFIRM
< Permit Joining : PermitDuration=0x01 ~ 0xFE >
4.5.4. ZNWK_START_ROUTE_REQ(REQUEST, CONFIRM)
This function is called to start a router.
4.5.4.1. REQUEST
Name Range Description
BO UINT8 Beacon order to use. This should be 15.
SO UINT8 Superframe order to use. This should be 15.
BattExtend UINT8 This field is not used
4.5.4.2. CONFIRM
ASW0104 MG245X- API Reference
V1.1 Page:23/52
www.radiopulse.co.kr
Name Range Description
Sta UINT8 Status
SUCCESS
4.5.5. ZNWK_JOIN_REQ(REQUEST, CONFIRM)
This function is called to request to join or rejoin a network and change the operating
channel for the device while the device is within operating network.
4.5.5.1. REQUEST
Name Range Description
EPID UINT8[8] 64-bit extended PAN ID of the network to join
Rejoin UINT8 The method of joining
0=Joining through MAC association procedure.
1=Rejoining through MAC orphaning procedure.
2=Rejoining through NWK rejoining procedure.
3=Changing the operational network channel.
ScanChan UINT32 Channel List to scan. Each bit indicates whether the corresponding
channel is to be scanned.
bit[31:27] : reserved
bit[26] : 1=Channel 26(2480MHz) is to be scanned.
…
bit[11] : 1=Channel 11(2405MHz) is to be scanned.
bit[10:0] : reserved
ScanDur UINT8 A value used to calculate spending time for scanning each channel.
The time is as follows.
0=33ms, 1=49ms, 2=81ms, 3=145ms
4=273ms, 5=529ms, 6=1.04sec, 7=2.06sec
8=4.11sec, 9=8.20sec, 10=16.40sec, 11=32.78sec
12~14=65.5sec
CapaInfo UINT8 Capabilities of the device to be joined.
bit[7] : Allocation address. This should be 1 always.
bit[6] : MAC Security. This subfield is not used.
bit[5:4] : reserved
bit[3] : RxOnWhenIdle. 1=Receiver is on in idle state.
bit[2] : Mains-Powered. This subfield is not used.
bit[1] : 1=Router(ZR), 0=End Device(ZED)
bit[0] : Alternative Coordinator. This subfield is not used.
SecureEna UINT8 This field is not used in MG245X-ZigBeePRO
4.5.5.2. CONFIRM
Name Range Description
Sta UINT8 Status.
SUCCESS
INVALID_REQ : When the device is already a member of a
network. When EPID field is NULL(0x00…0x00) or all
0xFF(0xFF…FF). When some REQUEST field is out of range.
NOT_PERMIT : There is no parent device in the neighbor table.
NO_NETWORKS : MAC orphaning is failed.
status returned from MAC
NwkAddr UINT16 16-bit network address which is allocated to the device
EPID UINT8[8] Extended PAN ID for the network of the device
ASW0104 MG245X- API Reference
V1.1 Page:24/52
www.radiopulse.co.kr
Chan UINT8 The operating channel of the device
4.5.5.3. Effect On Receipt
On receipt of this function, the NWK layer takes following sequences.
MAC Association (Rejoin=0)
(1) Network discovery: Before joining, the network discovery should be performed using
ZNWK_NET_DISC_REQ(). After completion of discovery, the information of each discovered
ZC or ZR is contained in the neighbor table.
(2) Choosing a parent: The NWK layer chooses a parent to join. The condition for parent-
capable device is as follows.
(3) The operating channel of the parent is included in the list indicated by ScanChan field.
(4) The extended PAN ID of the parent is equal to EPID field.
(5) NIB.nwkUpdateID of the parent is greater than or equal to that of the device to join.
(6) The PermitJoin of the parent is 1.
(7) If bit[1] subfield of CapaInfo field of the device to join is 1, the RouterCapa of the parent
should be 1. Otherwise, the EndDevCapa of the parent should be 1.
(8) If there are parent candidates more than 1, the device which has minimum depth is
chosen as the parent.
(9) Association: MAC association is performed.
(10) Removing neighbor table entry: If joining is successful, all neighbor table entries which
have a different EPID are removed.
OriginatorApplication
OriginatorNWK
ZNWK_JOIN_REQ()(Rejoin=0)
OriginatorMAC
CONFIRM
CONFIRM
Choose a parent to join in the Neighbor Table
ZMAC_ASSO_REQ() MAC Association Request Command
MAC Data Request Command
MAC Association Response Command
MACAssociation
< Joining: Association >
MAC Orphaning (Rejoin=1): MAC orphaning is performed.
ASW0104 MG245X- API Reference
V1.1 Page:25/52
www.radiopulse.co.kr
OriginatorApplication
OriginatorNWK
ZNWK_JOIN_REQ()(Rejoin=1)
OriginatorMAC
CONFIRM
CONFIRM
ZMAC_SCAN_REQ()(Orphan scan)
MAC Orphan Notification Command
MAC Coordinator Realignment Command
Orphan Scan
< Joining : Orphaning >
NWK Rejoining (Rejoin=2)
(1) Remove neighbor table: All neighbor table entries are removed.
(2) Active Scan: Active scan is performed.
(3) Choosing a parent: The NWK layer chooses a parent to join. The condition for parent-
capable device is as follows.
(4) The operating channel of the parent is included in the list indicated by ScanChan field.
(5) The extended PAN ID of the parent is equal to EPID field.
(6) NIB.nwkUpdateID of the parent is greater than or equal to that of the device to join.
(7) If bit[1] subfield of CapaInfo field of the device to join is 1, the RouterCapa of the parent
should be 1. Otherwise, the EndDevCapa of the parent should be 1.
(8) If there are parent candidates more than 1, the device which has minimum depth is
chosen as the parent.
(9) NWK Rejoining: NWK Rejoining is performed.
(10) Removing neighbor table entry: If joining is successful, all neighbor table entries which
have a different EPID are removed.
ASW0104 MG245X- API Reference
V1.1 Page:26/52
www.radiopulse.co.kr
OriginatorApplication
OriginatorNWK
ZNWK_JOIN_REQ()(Rejoin=2)
CONFIRM
NWK Rejoin Request Command
NWK Rejoin Response Command
<
Joining: NWK Rejoin >
Changing Channel (Rejoin=3): The channel indicated by ScanChan becomes the new
operating channel. (Only one bit in ScanChan should be set to 1. If not, the status of
CONFIRM is INVALID_REQ)
4.5.6. ZUSER_NWK_JOIN_IND(INDICATION)
When a new device is joined successfully by association or NWK rejoining, the NWK layer
notifies the upper layer.
4.5.6.1. INDICATION
Name Range Description
ShortAddr UINT16 The network address of the device which has been added.
ExtendAddr UINT8[8] 64-bit IEEE address of the device which has been added.
CapaInfo UINT8 Capability information of the device which has been added.
RejoinNwk UINT8 0=The device has been added by association.
2=The device has been added by NWK rejoining.
SecRejoin UINT8 1=Joining or rejoining is performed in secured method.
4.5.7. ZNWK_LEAVE_REQ(REQUEST, CONFIRM)
This function is used to make a child or itself to leave from a network.
4.5.7.1. REQUEST
Name Range Description
DevAddr UINT8[8] 64-bit IEEE address of the device to be removed. If DevAddr is
NULL(0x00…00), the device removes itself.
RmChild UINT8 1=The child devices of the device to be removed are removed also.
Rejoin UINT8 1=The device to be removed is requested to rejoin after being
removed.
4.5.7.2. CONFIRM
ASW0104 MG245X- API Reference
V1.1 Page:27/52
www.radiopulse.co.kr
Name Range Description
Sta UINT8 Status.
SUCCESS
INVALID_REQ: When the device is not a member of the network.
When the device indicated by DevAddr field is not present in the
neighbor table.
status returned from MAC
DevAddr UINT8[8] DevAddr field of REQUEST
4.5.7.3. Effect On Receipt
On receipt of this function, if DevAddr is NULL, the NWK layer broadcasts NWK LEAVE
command frame. In the procedure above, if the device is ZED, it unicasts NWK LEAVE
command frame to its parent and the parent broadcasts the frame. If DevAddr is not NULL,
the NWK layer unicasts NWK LEAVE command frame to the device which is indicated by
DevAddr.
OriginatorApplication
OriginatorNWK
ZNWK_LEAVE_REQ()
CONFIRM
NWK Leave Command
<Leaving a Network>
4.5.8. ZUSER_NWK_LEAVE_IND(INDICATION)
When a device left, the NWK layer notifies the upper layer.
4.5.8.1. INDICATION
Name Range Description
DevAddr UINT8[8] 64-bit IEEE address of the device which has been removed.
Rejoin UINT8 1=The device which has been removed is requested to rejoin.
4.5.9. ZNWK_RESET_REQ(REQUEST, CONFIRM)
This function is called to reset NWK layer.
4.5.9.1. REQUEST
Name Range Description
WarmStart UINT8 Reset Type
0=Reset NWK layer including tables and parameters.
1=Reset neighbor table and routing table.
4.5.9.2. CONFIRM
Name Range Description
ASW0104 MG245X- API Reference
V1.1 Page:28/52
www.radiopulse.co.kr
Sta UINT8 Status
SUCCESS
4.5.9.3. Effect On Receipt
On receipt of this function, if WarmStart is 0, the NWK layer clears its neighbor table and
routing table. Otherwise, it resets all stack values.
4.5.10. ZNWK_SYNC_REQ(REQUEST, CONFIRM)
This function is called to extract data from the parent device. (ZC or ZR)
4.5.10.1. REQUEST
Name Range Description
Track UINT8 Whether the tracking is performed.
This should be 0 in MG245X-ZigBeePRO.
4.5.10.2. CONFIRM
Name Range Description
Sta UINT8 Status.
SUCCESS
INVALID_REQ: When the device is not a member of the network.
When Track field of REQUEST is 1.
RP_NO_IMPLEMENT: The beacon order(BO) of the device is not
15.
The status from MLME_POLL_REQ
4.5.10.3. Effect On Receipt
On receipt of this function, the NWK layer checks for pending data at its parent device(ZC or
ZR). This procedure is called „polling‟.
OriginatorApplication
OriginatorNWK
ZNWK_SYNC_REQ()
OriginatorMAC
CONFIRM
CONFIRM
ZMAC_POLL_REQ()
MAC Data Request Command
< Synchronization >
4.5.11. ZNWK_ED_SCAN_REQ(REQUEST, CONFIRM)
This function is called to perform ED(energy detection) scan.
4.5.11.1. REQUEST
ASW0104 MG245X- API Reference
V1.1 Page:29/52
www.radiopulse.co.kr
Name Range Description
ScanChan UINT32 Channel List to scan. Each bit indicates whether the
corresponding channel is to be scanned.
bit[31:27] : reserved
bit[26] : 1=Channel 26(2480MHz) is to be scanned.
…
bit[11] : 1=Channel 11(2405MHz) is to be scanned.
bit[10:0] : reserved
ScanDur UINT8
(0x00~0x0E)
A value used to calculate spending time for scanning each
channel. The time is as follows.
0=33ms, 1=49ms, 2=81ms, 3=145ms
4=273ms, 5=529ms, 6=1.04sec, 7=2.06sec
8=4.11sec, 9=8.20sec, 10=16.40sec, 11=32.78sec
12~14=65.5sec
4.5.11.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
The status from ZMAC_SCAN_REQ()
UnscanChan UINT32 Channel List which is requested to scan but not scanned. Each
bit indicates whether the corresponding channel is to be
unscanned.
bit[31:27] : reserved
bit[26] : 1=Channel 26(2480MHz) is unscanned.
…
bit[11] : 1=Channel 11(2405MHz) is unscanned.
bit[10:0] : reserved
EnergyDetectList UINT8[16] The maximum detected energy value in each channel.
[0] : Channel 11(2405MHz)
[1] : Channel 12(2410MHz)
…
[15] : Channel 26(2480MHz)
4.5.11.3. Effect On Receipt
On receipt of this function, the NWK layer performs ED scan.
OriginatorApplication
OriginatorNWK
ED Scan
CONFIRM
ZNWK_ED_SCAN_REQ()
OriginatorMAC
ZMAC_SCAN_REQ()
CONFIRM
< ED Scan >
ASW0104 MG245X- API Reference
V1.1 Page:30/52
www.radiopulse.co.kr
4.5.12. ZNWK_GET_REQ(REQUEST, CONFIRM)
This function is called to read the value of an attribute from the NIB.
Note : In MG245X-ZigBeePRO, to read some NIB (Neighbor Table, Routing Table,
Broadcast Transaction Record Table, GroupID Table, Route Record Table, Address
Map Table), which consists of entries, ZNWK_GET_TABLE_REQ() should be used.
4.5.12.1. REQUEST
Name Range Description
AttID UINT8 The identifier of NIB to acquire.
4.5.12.2. CONFIRM
Name Range Description
Sta UINT8 Status.
SUCCESS
UNSUPPORT_ATTRI : AttID field of REQUEST is out of range.
AttID UINT8 AttID field of REQUEST
AttLen UINT16 The length of the NIB in byte.
AttValue UINT8[16] The acquired NIB values.
4.5.13. ZNWK_GET_TABLE_REQ(REQUEST, CONFIRM)
This function is called to read the value of an attribute from the NIB.
4.5.13.1. REQUEST
Name Range Description
AttID UINT8 The identifier of NIB to acquire.
0x87 : Neighbor Table
0x8B : Routing Table
0x98 : Broadcast Transaction Record Table
0x99 : Group ID Table
0x9C : Route Record Table
0xA9 : Address Map table.
4.5.13.2. CONFIRM
Name Range Description
Sta UINT8 Status.
SUCCESS
UNSUPPORT_ATTRI : AttID field of REQUEST is out of range.
AttID UINT8 AttID field of REQUEST
EntryLen UINT8 The number of entries in NIB.
pEntry UINT8* The pointer to 1st entry of NIB
(Note) pEntry has various structures by each NIB.
4.5.14. ZNWK_SET_REQ(REQUEST, CONFIRM)
This function is called to write the value of an attribute into the NIB.
4.5.14.1. REQUEST
Name Range Description
AttID UINT8 The identifier of NIB to set
AttLen UINT16 The length of NIB to set
ASW0104 MG245X- API Reference
V1.1 Page:31/52
www.radiopulse.co.kr
AttValue UINT8[16] The values to set
4.5.14.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
UNSUPPORT_ATTRI : AttID field of REQUEST is out of range
AttID UINT8 AttID field of REQUEST
4.5.15. ZNWK_SET_TABLE_REQ(REQUEST, CONFIRM)
This function is called to set Network Information Base(NIB) values.
4.5.15.1. REQUEST
Name Range Description
AttID UINT8 The identifier of NIB to acquire.
0x87 : Neighbor Table
0x8B : Routing Table
0x98 : Broadcast Transaction Record Table
0x99 : Group ID Table
0x9C : Route Record Table
0xA9 : Address Map Table
AttLen UINT8 This field is not used.
AttEntry UINT8 Entry number
0=1st entry
1=2nd entry
…
N-1= Nth entry
pEntry UINT8* The pointer to the structure of entry to set.
4.5.15.2. CONFIRM
Name Range Description
Sta UINT8 Status.
SUCCESS
INVALID_REQ : AttEntry field of REQUEST is out of range.
UNSUPPORT_ATT : AttID field of REQUEST is out of range
AttID UINT8 The identifier of NIB to set
4.5.16. ZNWK_ROUTE_DISC_REQ(REQUEST, CONFIRM)
This function is called to discover the route to other device.
4.5.16.1. REQUEST
Name Range Description
DstMode UINT8 Specifying the kind of DstAddr field
0=DstAddr field has no meaning(Many-To-One Route)
1=Multicast Group ID
2=Device Address
DstAddr UINT16 The destination of the route discovery
Radius UINT8 The number of hops that the route request will travel through the
network
ASW0104 MG245X- API Reference
V1.1 Page:32/52
www.radiopulse.co.kr
NoRouteCache UINT8 1=Route record table is not established
0=Route record table is established
4.5.16.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
INVALID_REQ : When DstMode is 1 and the device is a
member of the group indicated by DstAddr.
ROUTE_ERROR : Route discovery is failed because the
device doesn‟t have route capacity.
BT_TABLE_FULL : Route discovery is failed because the
device does not have an empty Braodcast Transacton Record
Table.
RP_DISCOVERING : a Route Request Command frame is
transmitted successfully.
NwkStaCode UINT8 This field is valid if and only if Sta indicates ROUTE_ERROR
0x04 : No route capacity
4.5.16.3. Effect On Receipt
On receipt of this function, the NWK layer initiates route discovery by transmitting a Route
Request Command frame.
OriginatorApplication
OriginatorNWK
ZNWK_ROUTE_DISC_REQ()
CONFIRM
NWK Route Request Command
Route Discovery duration
NWK Route Reply Command
NWK Route Reply Command
ZUSER_NWK_CON()
< Route Discovery >
4.5.17. ZNWK_DIRECT_JOIN_REQ(REQUEST, CONFIRM)
This function is not implemented in MG245X-ZigBeePRO.
ASW0104 MG245X- API Reference
V1.1 Page:33/52
www.radiopulse.co.kr
4.6. NWK Function
4.6.1. NWKLIB_DevMgmt_GetIEEEAddr()
Syntax UINT8 NWKLIB_DevMgmt_GetIEEEAddr
(UINT16 InNwkAddr, UINT8 *pOutIEEE)
Description This function searches the IEEE address of a device whose network address
is “InNwkAddr”, in the neighbor table and the address map table. If
succeeded, the searched IEEE address is appointed by “pOutIEEE”.
Parameter InNwkAddr : network address of a device to be searched.
pOutIEEE : pointer to searched IEEE address
Return Value 1=Searched, 0=Not Searched.
Example UINT8 IEEE_ADDR[8];
// Searches the IEEE address of the device(NwkAddr=0x0001)
if(NWKLIB_DevMgmt_GetIEEEAddr(0x0001, &IEEE_ADDR[0]))
{
zPrintf(1, “\n IEEE Address[0] = 0x%02x”, (short)IEEE_ADDR[0]);
}
else
{
// There is no matched entry in the neighbor and address map table
}
See Also NWKLIB_DevMgmt_GetNWKAddr(), NWKLIB_DevMgmt_DeleteNWKAddr()
Remark #include “INCLUDE_STACK.h”
4.6.2. NWKLIB_DevMgmt_DeleteNWKAddr()
Syntax void NWKLIB_DevMgmt_DeleteNWKAddr(UINT16 InNwkAddr)
Description This function deletes the device entry whose network address is “InNwkAddr”,
from the neighbor table and the address map table, if present.
Parameter InNwkAddr : network address of a device to be deleted
Return Value void
Example // Delete the device(NwkAddr=0x0001)
NWKLIB_DevMgmt_DeleteNWKAddr(0x0001);
See Also NWKLIB_DevMgmt_DeleteIEEEAddr(), NWKLIB_DevMgmt_GetIEEEAddr()
Remark #include “INCLUDE_STACK.h”
4.6.3. NWKLIB_DevMgmt_GetNwkAddr()
Syntax UINT8 NWKLIB_DevMgmt_GetNWKAddr
(UINT8 *pInIEEE, UINT16 *pOutNwkAddr)
Description This function searches the network address of a device whose IEEE address
is appointed by “pInIEEE” in the neighbor table and the address map table. If
successful, the searched network address is appointed by “pOutNwkAddr”
Parameter pInIEEE : pointer to IEEE address of a device to be searched
pOutNwkAddr : pointer to searched network address
Return Value 1=Searched, 0=Not Searched.
Example UINT8 IEEE_ADDR[8];
UINT16 NWK_ADDR;
// Searches the network address of the device(IEEEAddr=0x0807…01)
ASW0104 MG245X- API Reference
V1.1 Page:34/52
www.radiopulse.co.kr
IEEE_ADDR[7] = 0x08;
IEEE_ADDR[6] = 0x07;
…
IEEE_ADDR[0] = 0x01;
if(NWKLIB_DevMgmt_GetNWKAddr(&IEEE_ADDR[0], &NWK_ADDR))
{
zPrintf(1, “\n Network Address = 0x%04x”, NWK_ADDR);
}
else
{
// There is no matched entry in the neighbor and address map table
}
See Also NWKLIB_DevMgmt_GetIEEEAddr(), NWKLIB_DevMgmt_DeleteIEEEAddr()
Remark #include “INCLUDE_STACK.h”
4.6.4. NWKLIB_DevMgmt_DeleteIEEEAddr()
Syntax void NWKLIB_DevMgmt_DeleteIEEEAddr(UINT8 *pInIEEE)
Description This function deletes the device entry whose IEEE address is pointed by
“pInIEEE” from the neighbor table and the address map table, if present.
Parameter pInIEEE : pointer to IEEE address of a device to be deleted
Return Value void
Example UINT8 IEEE_ADDR[8];
// Delete the device(IEEEAddr=0x0807…01)
IEEE_ADDR[7] = 0x08;
IEEE_ADDR[6] = 0x07;
…
IEEE_ADDR[0] = 0x01;
NWKLIB_DevMgmt_DeleteIEEEAddr(&IEEE_ADDR[0]);
See Also NWKLIB_DevMgmt_DeleteNWKAddr(), NWKLIB_DevMgmt_GetNWKAddr()
Remark #include “INCLUDE_STACK.h”
4.6.5. NWKLIB_DevMgmt_UpdateIEEEAddr()
Syntax void NWKLIB_DevMgmt_UpdateIEEEAddr
(UINT16 TargetNwkAddr, UINT8 *pInIEEE)
Description If there is the entry whose network address is “TargetNwkAddr” in the
neighbor table, when the IEEE address field of the entry is NULL(0x00..00),
the IEEE address appointed by “pInIEEE” is written to that field. If the field is
not NULL, nothing occurs.
If there is no entry in the neighbor table and an empty entry in network
address map table, a new address map entry with network
address(TargetNwkAddr) and IEEE address(pointed by pInIEEE) are
generated.
Parameter TargetNwkAddr : network address of a device
pInIEEE : pointer to IEEE address of a device to be updated
Return Value 0=OK
1=Error. “TargetNwkAddr” is the device‟s own address
2=Error. There is no empty entry in network address map table
Example UINT8 IEEE_ADDR[8];
ASW0104 MG245X- API Reference
V1.1 Page:35/52
www.radiopulse.co.kr
// Update IEEE address or Generate a new address map entry
IEEE_ADDR[7] = 0x08;
IEEE_ADDR[6] = 0x06;
..
IEEE_ADDR[0] = 0x01;
NWKLIB_DevMgmt_UpdateIEEEAddr(0x0001, &IEEE_ADDR[0]);
See Also
Remark #include “INCLUDE_STACK.h”
4.6.6. NWKLIB_DevMgmt_AddNT()
Syntax UINT8 NWKLIB_AddNT(NS_NT *pNT)
Description This function adds a new neighbor table entry specified by “pNT” when there
is an empty entry in the neighbor table. When a new entry is added, if there is
a network address map table entry whose network address is equal to that of
added entry, the address map entry is deleted.
Note that neighbor table entries should be in ascending order by
network address. So, a new entry should be added only by this function.
After adding a new entry, this function rearranges entries in order.
Parameter pNT: pointer to a new neighbor table entry to be added.
Return Value 1=Fail(The network address is conflicted), 0=Success or No empty entry
Example NS_NT NewNT;
NewNT.EnaNT = 1;
NewNT.NwkAddr = 0x1234;
….
NWKLIB_DevMgmt_AddNT(&NewNT);
See Also
Remark #include “INCLUDE_STACK.h”
4.6.7. Others
There are other functions included in network library of MG245X-ZigBeePRO, listed in
ZNWK.h file.
These functions should be used restrictively in each special case. And, in the sample
application sources supplied by RadioPulse, these are being used properly. So, an
application does not need to use these functions.
4.6.7.1. NWKLIB_SEND_AddrConflict()
This function sends Address Confliction Command when address confliction is detected.
4.6.7.2. NWKLIB_PROC_AddrConflict()
This function processes the address confliction when the conflicted address is not its own
address.
4.6.7.3. NWKLIB_Get_RandomNwkAddr()
This function randomly gets a new network address which is not used in the network.
4.6.7.4. NWKLIB_DeleteRT_UsedEntry()
This function removes the current route table entry corresponding to destination address.
ASW0104 MG245X- API Reference
V1.1 Page:36/52
www.radiopulse.co.kr
5. APS LAYER
5.1. APS Frame Format
The APS frame consists of header and payload.
APS Header APS Payload
Octet:1 0/1 0/2 0/2 0/2 0/1 1 0/3 var
Frame
Control
Dst
EP
Group
Addr
Cluster
ID
Profile
ID
Src
EP
Seq
Num
Extended
Header
ASDU
NWK Header Description
FrameControl This field shows the frame characteristic.
bit[7] : 1=Extended Header field is present
bit[6] : 1=APS ACK frame is requested
bit[5] : 1=Secured frame
bit[4] : Ack Format. 0=Data Ack, 1=Command Ack
bit[3:2] : Delivery Mode. 0=Normal, 1=Indirect, 2=Broadcast, 3=Group
bit[1:0] : Frame Type. 0=Data, 1=Command, 2=Ack
DstEP Destination Endpoint.
GroupAddr Group Address. If Delivery Mode subfield indicates Group, this field
indicates the group address.
ClusterID Cluster Identifier.
ProfileID Profile Identifier.
SeqNum Sequence Number.
Extended
Header
Octet : 1 1 1
Extended Frame
Control
Block Number AckBitField
ASDU APS data.
5.2. APS Status
Name Value Description
SUCCESS 0x00 Success
ASDU_TOO_LONG 0xA0 The length of the packet is too long.
DEFRAG_DEFERED 0xA1 Defragmentation is deferred.
DEFRAG_UNSUPPORT 0xA2 Defragmentation is not supported
ILLEGAL_REQUEST 0xA3 Some parameters of REQUEST are illegal.
INVALID_BINDING 0xA4 Unbinding is failed because there is no matched binding
entry.
INVALID_GROUP 0xA5 Group information is not correct.
INVALID_PARAMETER 0xA6 Some parameters of REQUEST are out of range.
NO_ACK 0xA7 APS Ack is not received.
NO_BOUND_DEVICE 0xA8 Transmission is failed because there is no matched
binding entry.
NO_SHORT_ADDR 0xA9 Transmission is failed because there is no matched
address map entry.
NOT_SUPPORTED 0xAA The function is not supported.
SECURED_LINK_KEY 0xAB There is no link key.
ASW0104 MG245X- API Reference
V1.1 Page:37/52
www.radiopulse.co.kr
SECURED_NWK_KEY 0xAC There is no network key.
SECURITY_FAIL 0xAD There is an error during security procedure.
TABLE_FULL 0xAE There is no empty entry in a table.
UNSECURED 0xAF
UNSUPPORT_ATTRI 0xB0 The attribute is not supported.
***** Additional APS Status (APS Status defined by RadioPulse)
RP_AQ_BUSY 0xB1 All APS queues are occupied now.
RP_ROUTE_DISC_FAIL 0xB5 Route discovery is failed because there is no route reply
command frame.
5.3. APS Information Base(AIB)
5.3.1. Normal AIB
These AIB consist of 1Byte, 2Byte or 8Byte.
Name Att. ID Range Description Default
papsBindTable 0xC1 Refer to “Table AIB”
apsDesignCoord 0xC2 UINT8 1=the device becomes ZigBee
Coordinator on startup when using
commissioning
0
apsChannelMask 0xC3 UINT32 The mask of allowable channels for
this device to use for network
operations.
0x07FF
F800
apsUseExtPanID 0xC4 UINT8[8] 64-bit Extended PAN ID to form or to
join when using commissioning
NULL
papsGroupTable 0xC5 Refer to “Table AIB”
apsNonmemRadius 0xC6 UINT8 NonmeberRadius parameter when
using NWK layer multicast.
2
apsPermitConfig 0xC7 UINT8 Not used. 0
apsUseInsecureJoin 0xC8 UINT8 1=Insecure join on startup when using
commissioning
1
apsInterframeDelay 0xC9 UINT8 Not used. 10
apsLastChanEnergy 0xCA UINT8 Not used. 0
apsLastChanFailRate 0xCB UINT8 Not used. 0
apsChanTimer 0xCC UINT8 Not used. 0
5.3.1.1. Table AIB
Binding Table(Attribute ID = 0xC1)
Name Range Description
SrcIEEE UINT8[8] The source IEEE address for the binding entry.
SrcEP UINT8 The source endpoint for the binding entry
ClusterID UINT16 The identifier of the cluster on the source device that is to be
bound to the destination device.
DstMode UINT8 The addressing mode for the DstAdd_U. This parameter can
take one of the non-reserved values from the following list:
0x00 = reserved
0x01 = DstAdd_U indicates 16-bit group address. And
ASW0104 MG245X- API Reference
V1.1 Page:38/52
www.radiopulse.co.kr
DstEP parameter is invalid.
0x02 = reserved
0x03 = DstAdd_U indicates 64-bit extended address. And
DstEP parameter is valid.
0x04 . 0xff = reserved
DstAdd_U UINT16 or
UINT8[8]
The destination address for the binding entry. If DstMode is 1,
DstAdd_U.Short indicates group address. If DstMode is 3,
DstAdd_U.Ext indicates extended address.
DstEP UINT8 This parameter is valid only if the DstMode parameter has a
value of 0x03. This is the destination endpoint for the binding
entry.
EnaBT UINT8 1=Entry is enabled. 0=Entry is disabled.
Group Table(Attribute ID = 0xC5)
Name Range Description
GroupAddr UINT16 The 16-bit address of the group
GroupEP UINT8 The endpoint matched to the group
EnaGT UINT8 1=Entry is enabled. 0=Entry is disabled.
5.3.2. Additional AIB
These attributes are defined by RadioPulse, not by ZigBee specification.
Name Att. ID Range Description Default
DSN - UINT8 Sequence number of an APS packet 0
SIZE_BT - UINT8 The number of entries in binding table 0
SIZE_GT - UINT8 The number of entries in group address table 0
BroadcastAddr - UINT16 Broadcast address when broadcasting an
APS command packet.
0xFFFF
Option - UINT16 Option for APS layer
bit[15:1] : reserved
bit[0] : 1=Packet filtering in APS layer is
enabled
0x0001
5.4. APS Primitive
OriginatorHigher
OriginatorAPS
RecipientAPS
RecipientHigher
REQUEST
CONFIRM
APS Frame
INDICATION
APS consists of Request, Confirm, and Indication primitive. When receiving a request from
ASW0104 MG245X- API Reference
V1.1 Page:39/52
www.radiopulse.co.kr
upper layer, corresponding function is done and then returns confirmation. In addition, when
the event occurs, it can inform upper layer by indication.
[API List According To Primitive]
*** is defined by RadioPulse.
5.5. APS API
5.5.1. ZAPS_DATE_REQ(REQUEST, CONFIRM)
This function is called to transmit data to the destination.
5.5.1.1. REQUEST
Name Range Description
DstMode UINT8 Addressing mode for the destination.
0=no address mode. DstAdd_U and DstEP are not valid.
1=DstAdd_U is 16-bit group address and DstEP is not valid.
2=DstAdd_U is 16-bit device address and DstEP is valid
3=DstAdd_U is 64-bit device address and DstEP is valid
DstAdd_U UINT16
or
UINT8[8]
16-bit or 64bit address of the destination.
If DstMode is 1 or 2, DstAdd_U.Short indicates 16-bit address of the
destination. Otherwise, DstAdd_U.Ext indicates the 64-bit IEEE
address of the destination.
DstEP UINT8 Destination Endpoint
ProfileID UINT16 Profile identifier
ClusID UINT16 Cluster identifier
SrcEP UINT8 Source Endpoint
asduLen UINT8 The number of ASDU in bytes
TxOption UINT8 Transmission Option
bit[7:4] : reserved. always 0.
bit[3] : Fragmentation. This bit is not supported.
Primitive API
APSDE-DATA ZAPS_DATA_REQ()
APSME-SET ZAPS_SET_REQ()
APSME-GET ZAPS_GET_REQ()
APSME-ADD-GROUP ZAPS_ADD_GROUP_REQ()
APSME-REMOVE-GROUP ZAPS_REMOVE_GROUP_REQ()
APSME-REMOVE-ALL-GROUP ZAPS_REMOVE_ALL_GROUP_REQ()
APSME-BIND ZAPS_BIND_REQ()
APSME-UNBIND ZAPS_UNBIND_REQ()
APSME-ESTABLISH-KEY ZAPS_ESTABLISH_KEY_REQ()
APSME-TRANSPORT-KEY ZAPS_TRANSPORT_KEY_REQ()
APSME-SWITCH-KEY ZAPS_SWITCH_KEY_REQ()
APSME-REQUEST-KEY ZAPS_REQUEST_KEY_REQ()
APSME-UPDATE-DEVICE ZAPS_UPDATE_DEVICE_REQ()
APSME-REMOVE-DEVICE ZAPS_REMOVE_DEVICE_REQ()
APSME-SET ***ZAPS_SET_TABLE_REQ()
APSME-GET ***ZAPS_GET_TABLE_REQ()
ASW0104 MG245X- API Reference
V1.1 Page:40/52
www.radiopulse.co.kr
bit[2] : 1=APS ACK is requested.
bit[1] : 1=Use network key
bit[0] : 1=Security is used. This bit is not supported.
Radius UINT8 The number of hops in a transmission.
pasdu UINT8 * Pointer to ASDU which is to be transmitted.
5.5.1.2. CONFIRM
Name Range Description
DstMode UINT8 DstMode field of REQUEST
DstAdd_U UINT16
or
UINT8[8]
DstAdd_U field of REQUEST
DstEP UINT8 DstEP field of REQUEST
SrcEP UINT8 SrcEP field of REQUEST
Sta UINT8 Status
SUCCESS
ILLEGAL_REQUEST
ASDU_TOO_LONG
NO_BOUND_DEVICE
INVALID_PARAMETER
ILLEGAL_REQUEST
NO_SHORT_ADDR
RP_AQ_BUSY
RP_DISCOVERING
TxTime UINT16 A time indication for the transmitted packet based on the local clock.
5.5.1.3. Effect On Receipt
On receipt of this function, the APS layer performs followings according to the DstMode
value.
(1) DstMode is 0.
The APS layer searches a binding entry with SrcEP and ClusID. If an entry is found, the
destination is the device indicated by the entry. Otherwise, no packet is transmitted and the
status of CONFIRM is NO_BOUND_DEVICE.
(2) DstMode is 1.
A packet including group information is transmitted. If NIB.nwkUseMulticast is set to 1, NWK
multicast is used. Otherwise, APS multicast is used.
(3) DstMode is 2.
A packet is unicasted to the destination.
(4) DstMode is 3.
The APS layer searches the network address of the destination device in the address map
table. If there is a matched entry, a packet is unicasted to the device. Otherwise, no packet is
transmitted and the status of CONFIRM is NO_SHORT_ADDR.
5.5.1.4. Unicast
When a transmission is unicast, the next hop device is determined as follows;
ASW0104 MG245X- API Reference
V1.1 Page:41/52
www.radiopulse.co.kr
The destination is a child Use Neighbor Table
The originator is ZC or ZR.
YES
The destination is present
in the neighbor tableYES Use Neighbor Table
Route Discovery
NO
The destination is present in
the routing tableUse Routing Table
NO
YES
Routing Capacity
The destination is present in
the route record table. Source RoutingYES
NO
YES
NO
NO
Failure
< In case of ZC or ZR >
The originator is ZED
The parent device is present
in the neighbor table
NO
YES Use Neighbor Table
Failure
< In case of ZED >
ASW0104 MG245X- API Reference
V1.1 Page:42/52
www.radiopulse.co.kr
5.5.1.5. Multicast
If the originator has the destination group address in its group ID table, a multicast frame is
transmitted. Then, the multicast mode field of the frame is 1.
If the group address is not present in the group ID table, it searches the routing table entry
matched to the group address. And, if found, a multicast frame, whose multicast mode field
is 0, is transmitted.
The transmitted multicast frame is relayed as follows;
Non-member
Device
Member
Device
Unicast
Broadcast
NonMember
Radius
3
3 3
3
2 1
3
< In case of Multicast Mode=1 >
ASW0104 MG245X- API Reference
V1.1 Page:43/52
www.radiopulse.co.kr
Non-member
Device
Member
Device
Unicast
Broadcast
NonMember
Radius
3
3 3
3
2 1
3
< In case of Multicast Mode=0 >
5.5.1.6. Broadcast
A broadcast frame is transmitted when the broadcast transaction table has an empty entry. If
not, the returned status indicates an error, BT_TABLE_FULL.
5.5.1.7. Transmitting after Route Discovery
When a unicast frame should be transmitted after route discovery, the frame is first pended
and route discovery is initiated. After discovering a route, the pending frame is unicasted.
ASW0104 MG245X- API Reference
V1.1 Page:44/52
www.radiopulse.co.kr
OriginatorAPS
ZAPS_DATA_REQ()There is no routing
table to the destination. So, Route Discovery is needed.
OriginatorApplication
ZNWK_ROUTE_DISC_REQ()
OriginatorNWK
CONFIRM with Sta=0xDF
CONFIRM with Sta=0xDF
APS Data frame is pended in APS Queue
NWK Route Request Command
NWK Route Reply Command
ZNWK_DATA_REQ()
CONFIRM
ZUSER_APS_CON()
ZUSER_NWK_CON()
Route Discovery duration is expired
If Route Reply Command is not received during route discovery
ZUSER_APS_CON()
If Route Reply Command is received during route discovery
<Transmitting after Route Discovery>
5.5.2. ZUSER_APS_DATA_IND(INDICATION)
This function is called by the stack to notify the upper layer when a packet is received and
the packet is not a ZDP command.
5.5.2.1. INDICATION
Name Range Description
DstMode UINT8 Addressing mode for the destination.
0=no address mode. DstAdd_U and DstEP are not valid.
1=DstAdd_U is 16-bit group address and DstEP is not valid.
2=DstAdd_U is 16-bit device address and DstEP is valid.
3=DstAdd_U is 64-bit device address and DstEP is valid.
DstAdd_U UINT16
or
UINT8[8]
16-bit or 64bit address of the destination.
If DstMode is 1 or 2, DstAdd_U.Short indicates 16-bit address of the
destination. Otherwise, DstAdd_U.Ext indicates the 64-bit IEEE
address of the destination.
DstEP UINT8 Destination Endpoint
SrcMode UINT8 Addressing mode for the source
ASW0104 MG245X- API Reference
V1.1 Page:45/52
www.radiopulse.co.kr
0=no address mode. SrcAdd_U and SrcEP are not valid.
2=SrcAdd_U is 16-bit device address and SrcEP is valid.
3=SrcAdd_U is 64-bit device address and SrcEP is valid.
SrcAdd_U UINT16
or
UINT8[8]
16-bit or 64bit address of the destination.
If SrcMode is 2, SrcAdd_U.Short indicates 16-bit address of the
source. Otherwise, SrcAdd_U.Ext indicates the 64-bit IEEE address of
the source.
SrcEP UINT8 Source Endpoint
ProfileID UINT16 Profile identifier
ClusID UINT16 Cluster identifier
asduLen UINT8 The number of ASDU in bytes
Sta UINT8 Status. Always 0.
SecSta UINT8 Security status. Always 0.
LQI UINT8 The link quality of the received packet.
255=Best quality.
0=Worst quality.
RxTime UINT16 A time that packet is received based on the local clock.
pasdu UINT8 * Pointer to ASDU which is received.
5.5.3. ZZDP_APS_DATA_IND(INDICATION)
This function is called by the stack to notify the upper layer when a packet is received and
the packet is a ZDP command.
The structure of INDICATION is equal to that of ZUSER_APS_DATA_IND().
5.5.4. ZAPS_SET_REQ(REQUEST, CONFIRM)
This function is called to write the value of an attribute into the AIB.
5.5.4.1. REQUEST
Name Range Description
Attribute UINT8 The identifier of the AIB attribute to be written.
AttributeLength UINT16 The length, in octets, of the attribute value being set.
AttributeValue UINT8[16] The value of the AIB attribute that should be written.
5.5.4.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
UNSUPPORT_ATTRI: When the attribute is not correct. When
the attribute indicates an unsupported attribute.
Attribute UINT8 The identifier of the AIB attribute which was written
5.5.5. ZAPS_SET_TABLE_REQ(REQUEST, CONFIRM)
This function is called to write an entry of table AIB.
5.5.5.1. REQUEST
ASW0104 MG245X- API Reference
V1.1 Page:46/52
www.radiopulse.co.kr
Name Range Description
ExtendAtt UINT8 The identifier of the AIB attribute to be written.
0xC1 : Binding table
0xC5 : Group address table
ExtendAttLen UINT8 reserved
ExtendEntry UINT8 the entry number to be written.
pEntry UINT8* pointer to an entry to be written
5.5.5.2. CONFIRM
Name Range Description
ExtendSta UINT8 Status
SUCCESS
INVALID_PARAMETER : ExtendEntry is not correct.
UNSUPPORT_ATTRI : ExtendAtt is not correct.
ExtendAtt UINT8 The identifier of the AIB attribute which was written
5.5.6. ZAPS_GET_REQ(REQUEST, CONFIRM)
This function is called to read the value of an attribute from AIB.
5.5.6.1. REQUEST
Name Range Description
Attribute UINT8 The identifier of the AIB attribute to read
5.5.6.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
UNSUPPORT_ATTRI : When the attribute is not correct. When
the attribute indicates an unsupported attribute.
Attribute UINT8 The identifier of the AIB attribute which was read.
AttributeLength UINT16 The length of the attribute in bytes.
AttributeValue UINT8[16] The value of the attribute which was read.
5.5.7. ZAPS_GET_TABLE_REQ(REQUEST, CONFIRM)
This function is called to read an entry of table AIB.
5.5.7.1. REQUEST
Name Range Description
ExtendAtt UINT8 The identifier of the AIB attribute to read.
0xC1 : Binding table
0xC5 : Group address table
5.5.7.2. CONFIRM
Name Range Description
ExtendSta UINT8 Status
SUCCESS
UNSUPPORT_ATTRI : ExtendAtt is not correct.
ExtendAtt UINT8 The identifier of the AIB attribute which was read.
ExtendEntryLen UINT8 The number of entries in the AIB table.
ASW0104 MG245X- API Reference
V1.1 Page:47/52
www.radiopulse.co.kr
pEntry UINT8* A pointer to the AIB table.
5.5.8. ZAPS_BIND_REQ(REQUEST, CONFIRM)
This function is called to request to bind two devices together, or to bind a device to a group,
by creating an entry in its local binding table. When this function is called, any packet is not
transmitted.
5.5.8.1. REQUEST
Name Range Description
SrcIEEE UINT8[8] The source IEEE address for the binding entry.
SrcEP UINT8 The source endpoint for the binding entry
ClusID UINT16 The identifier of the cluster on the source device that is to be bound to
the destination device.
DstMode UINT8 The addressing mode for the DstAdd_U. This parameter can take one
of the non-reserved values from the following list:
0x00 = reserved
0x01 = DstAdd_U indicates 16-bit group address. And DstEP
parameter is invalid.
0x02 = reserved
0x03 = DstAdd_U indicates 64-bit extended address. And DstEP
parameter is valid.
0x04 . 0xff = reserved
DstAdd_U UINT16
or
UINT8[8]
The destination address for the binding entry. If DstMode is 1,
DstAdd_U.Short indicates group address. If DstMode is 3,
DstAdd_U.Ext indicates extended address.
DstEP UINT8 This parameter is valid only if the DstMode parameter has a value of
0x03. This is the destination endpoint for the binding entry.
5.5.8.2. CONFIRM.
Name Range Description
Sta UINT8 Status.
SUCCESS
ILLEGAL_REQUEST: When DstMode is not 1 or 3. When binding
table is not present.
TABLE_FULL: There is no empty binding table entry.
NOT_SUPPORTED: Binding is not supported.
SrcIEEE UINT8[8] The source IEEE address for the binding entry.
SrcEP UINT8 The source endpoint for the binding entry
ClusID UINT16 The identifier of the cluster on the source device that is to be bound to
the destination device.
DstMode UINT8 The addressing mode for the DstAdd_U. This parameter can take one
of the non-reserved values from the following list:
0x00 = reserved
0x01 = DstAdd_U indicates 16-bit group address. And DstEP
parameter is not invalid.
0x02 = reserved
0x03 = DstAdd_U indicates 64-bit extended address. And DstEP
parameter is valid.
0x04 . 0xff = reserved
DstAdd_U UINT16
or
The destination address for the binding entry. If DstMode is 1,
DstAdd_U.Short indicates group address. If DstMode is 3,
ASW0104 MG245X- API Reference
V1.1 Page:48/52
www.radiopulse.co.kr
UINT8[8] DstAdd_U.Ext indicates extended address.
DstEP UINT8 This parameter is valid only if the DstMode parameter has a value of
0x03. This is the destination endpoint for the binding entry.
5.5.9. ZAPS_UNBIND_REQ(REQUEST, CONFIRM)
This function is called to request to unbind two devices, or to unbind a device from a group,
by removing an entry in its local binding table. When this function is called, any packet is not
transmitted.
5.5.9.1. REQUEST
Name Range Description
SrcIEEE UINT8[8] The source IEEE address for the binding entry.
SrcEP UINT8 The source endpoint for the binding entry
ClusID UINT16 The identifier of the cluster on the source device that is to be bound to
the destination device.
DstMode UINT8 The addressing mode for the DstAdd_U. This parameter can take one
of the non-reserved values from the following list:
0x00 = reserved
0x01 = DstAdd_U indicates 16-bit group address. And DstEP
parameter is not invalid.
0x02 = reserved
0x03 = DstAdd_U indicates 64-bit extended address. And DstEP
parameter is valid.
0x04 . 0xff = reserved
DstAdd_U UINT16
or
UINT8[8]
The destination address for the binding entry. If DstMode is 1,
DstAdd_U.Short indicates group address. If DstMode is 3,
DstAdd_U.Ext indicates extended address.
DstEP UINT8 This parameter is valid only if the DstMode parameter has a value of
0x03. This is the destination endpoint for the binding entry.
5.5.9.2. CONFIRM.
Name Range Description
Sta UINT8 Status.
SUCCESS
ILLEGAL_REQUEST : When DstMode is not 1 or 3. When the
binding table is not present.
INVALID_BINDING : There is no matched binding table entry.
NOT_SUPPORTED : Binding is not supported.
SrcIEEE UINT8[8] The source IEEE address for the binding entry.
SrcEP UINT8 The source endpoint for the binding entry.
ClusID UINT16 The identifier of the cluster on the source device that is to be bound to
the destination device.
DstMode UINT8 The addressing mode for the DstAdd_U. This parameter can take one
of the non-reserved values from the following list;
0x00 = reserved
0x01 = DstAdd_U indicates 16-bit group address. And DstEP
parameter is invalid.
0x02 = reserved
0x03 = DstAdd_U indicates 64-bit extended address. And DstEP
ASW0104 MG245X- API Reference
V1.1 Page:49/52
www.radiopulse.co.kr
parameter is valid.
0x04. 0xff = reserved
DstAdd_U UINT16
or
UINT8[8]
The destination address for the binding entry. If DstMode is 1,
DstAdd_U.Short indicates group address. If DstMode is 3,
DstAdd_U.Ext indicates extended address.
DstEP UINT8 This parameter is valid only if the DstMode parameter has a value of
0x03. This is the destination endpoint for the binding entry.
5.5.10. ZAPS_ADD_GROUP_REQ(REQUEST, CONFIRM)
This function is called to request that group membership for a particular group added for a
particular endpoint. When called, the group address and endpoint are written into the group
address table. And, if there is an empty nwkGroupIDTable entry, a new nwkGroupIDTable
entry is generated.
5.5.10.1. REQUEST
Name Range Description
GroupAddr UINT16 16-bit address of the group being added.
EndPoint UINT8 The endpoint to which the given group is being added.
5.5.10.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
INVALID_PARAMETER: „EndPoint‟ parameter is out of range.(0x00
or more than 0xF0)
TABLE_FULL: There is no group address table entry.
GroupAddr UINT16 16-bit address of the group being added.
EndPoint UINT8 Group address endpoint to be added.
5.5.11. ZAPS_REMOVE_GROUP_REQ(REQUEST, CONFIRM)
This function is called to request that group membership in a particular group for a particular
endpoint to be removed. The specified group table entry is removed. And, if there is a
corresponding nwkGroupIDTable entry, it is also removed.
5.5.11.1. REQUEST
Name Range Description
GroupAddr UINT16 16-bit address of the group being removed.
EndPoint UINT8 Group address endpoint to be removed.
5.5.11.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
INVALID_PARAMETER: „EndPoint‟ parameter is out of range.(0x00
or more than 0xF0)
INVALID_GROUP: There is no group address table entry matched
to “GroupAddr” and “EndPoint” parameters.
ASW0104 MG245X- API Reference
V1.1 Page:50/52
www.radiopulse.co.kr
GroupAddr UINT16 16-bit address of the group being removed.
EndPoint UINT8 The endpoint to which the given group is being removed.
5.5.12. ZAPS_REMOVE_ALL_GROUP_REQ(REQUEST, CONFIRM)
This function is called to request that group membership in all groups from an endpoint. All
group table entries which include the specified endpoint will be removed. And, the
corresponding nwkGroupIDTable entries are removed also.
5.5.12.1. REQUEST
Name Range Description
EndPoint UINT8 Group address endpoint to be removed.
5.5.12.2. CONFIRM
Name Range Description
Sta UINT8 Status
SUCCESS
INVALID_PARAMETER: „EndPoint‟ parameter is out of range.
(0x00 or more than 0xF0). Or, there is no matched entry.
EndPoint UINT8 Group address endpoint to be removed.
5.5.13. ZAPS_ESTABLISH_KEY_REQ(REQUEST, CONFIRM)
TBD
5.5.14. ZAPS_TRANSPORT_KEY_REQ(REQUEST, CONFIRM)
TBD
5.5.15. ZAPS_UPDATE_DEVICE_REQ(REQUEST, CONFIRM)
TBD
5.5.16. ZAPS_REMOVE_DEVICE_REQ(REQUEST, CONFIRM)
TBD
5.5.17. ZAPS_REQUEST_KEY_REQ(REQUEST, CONFIRM)
TBD
5.5.18. ZAPS_SWITCH_KEY_REQ(REQUEST, CONFIRM)
TBD
5.6. APS Function
5.6.1. APSLIB_FindGT_GroupAddr()
ASW0104 MG245X- API Reference
V1.1 Page:51/52
www.radiopulse.co.kr
Syntax UINT8 APSLIB_FindGT_GroupAddr(UINT16 GroupAddress, UINT8 EP)
Description This function finds a group address table entry whose group address is
“GroupAddress”. If the entry is found, the entry number is “NumGT”.
Parameter GroupAddress : group address to be found
EP : endpoint to be found
Return Value 1=Found, 0=Not found.
Example if(APSLIB_FindGT_GroupAddr(0xABCD, 0x20))
{
zPrintf(1, “\n EntryNum=0x%02x”, (short)NumGT);
zPrintf(1, “\n EP=0x%02x”, (short)AIB.papsGroupTable[NumGT].GroupEP);
}
See Also
Remark #include “INCLUDE_STACK.h”
ASW0104 MG245X- API Reference
V1.1 Page:52/52
www.radiopulse.co.kr
RadioPulse Inc
3rd Fl., Hans B/D II, 111-6 Seongnae-Dong,
Gangdong-Gu, Seoul, Korea, 134-883, Korea
URL: www.radiopulse.co.kr
Tel: +82-2-478-2963~5
Fax: +82-2-478-2967
About RadioPulse Inc.
RadioPulse is a Being Wireless solution provider offering wireless communication & network
technologies and developing next generation wireless networking technologies.
The new wireless networking solutions envisioned by RadioPulse will enable user to enjoy wireless
technologies with easy interface.
Founded in April of 2003, the company maintains it headquarters and R&D center in Seoul, Korea.
Copyright (c) 2011 RadioPulse. All rights reserved.