Z-stack MAC API & TI cc2530 platform introduction

advertisement
Z-stack MAC API & TI cc2530
platform introduction
Speaker: 葉俊克
Date: 2010/11/16
1
Outline
•
•
•
•
ZigBee Architecture
MAC Layer Operation Scenarios
Introduction to Platform(CC 2530ZDK)
Directory Hierarchy in Developing An
Application
• Demo Environment
• Demo
2
ZigBee Architecture
3
ZigBee Node Type
• ZigBee Node Type :
– Coordinator
•
•
•
•
Forms network
Routes packets
Security Trust Center
Allows nodes to join network
– Router
• Join network
• Routes packets
• Allows nodes to join network
– End-Device
• Join network
• Battery operated and may sleep
• Smallest code size
4
MAC API
NAME
DESCRIPTION
MAC_MlmeResetReq()
This direct execute function resets the MAC.
MAC_MlmeScanReq()
This function initiates an energy detect, active,
passive, or orphan scan on one or more channels.
MAC_MLME_SCAN_CNF
Callback Function Event. This event sends data
from the MAC to the application.
MAC_MlmeSetReq()
This direct execute function sets an attribute value
in the MAC PIB.
MAC_MlmeStartReq()
This function is called by a coordinator or PAN
coordinator to start or reconfigure a network.
MAC_MLME_START_CNF
Callback Function Event.
MAC_MlmeAssociateReq()
This function sends an associate request to a
coordinator device.
MAC_MLME_ASSOCIATE_IND
Callback Function Event.
MAC_MlmeAssociateRsp()
This function sends an associate response to a
device requesting to associate.
MAC_MLME_ASSOCIATE_CNF
Callback Function Event.
5
MAC Layer Operation Scenarios
Non Beacon-Enabled Network Start
6
Non Beacon-enabled Network Scan
and Associate
7
MAC API (Con.)
NAME
DESCRIPTION
MAC_BEACON_NOTIFY_IND
Callback Function Event. This event sends data from
the MAC to the application.
MAC_MLME_SYNC_LOSS_IND
Callback Function Event.
MAC_MlmeOrphanRsp()
This function is called in response to an orphan
notification from a peer device.
MAC_McpsDataReq()
This function sends application data to the MAC for
transmission in a MAC data frame.
MAC_MCPS_DATA_IND
This event sends data from the MAC to the
application.
MAC_MCPS_DATA_CNF
Callback Function Event.
MAC_McpsPollReq()
This function is used to request pending data from
the coordinator.
MAC_MCPS_POLL_CNF
Callback Function Event.
MAC_McpsPurgeReq()
This function purges and discards a data request
from the MAC data queue.
MAC_MCPS_PURGE_CNF
Callback Function Event.
8
Beacon-Enabled Network Scan and
Sync
9
Orphan Procedure
10
Direct Data Transactions
11
Indirect Data Transactions, Data Poll
and Purge
12
Introduction to Platform
• Devices of TI CC2530 ZDK (zigbee
development kit):
– 2 Collectors (SmartRF05EB Evaluation Boards)
– 5 End-devices (SmartRF05 Battery Boards)
– 7 CC2530EM Evaluation Modules
– USB Dongle Antennas and batteries IAR EW8051
C-compiler with C-SPY debugger
• IAR Embedded Workbench for MCS-51 7.51A
Evaluation
13
CC2530ZDK
14
Directory Hierarchy in Developing An
Application
HAL(Hardware (H/W) Abstraction Layer):硬體層目錄,
包含有與硬體相關的配置和驅動及操作函數。
MAC:MAC層目錄,包含了MAC層的參數配置文件及其
MAC的LIB庫的函數介面文件。
NWK(ZigBee Network Layer):網路層目錄,含網路層
配置參數文件及網絡層的函數介面文件,APS層的函數介
面。
Profile:AF(Application Framework)層目錄,包含AF層處
理函數文件。
ZDO(ZigBee Device Objects):ZDO目錄。
Security:安全層目錄,安全層處理函數,比如加密函數
等。
15
Directory Hierarchy in Developing An
Application Con.
APP(Application Programming):應用層目錄,這是用戶
創建各種不同動作的區域,在這個目錄中包含了應用層的
內容和這個項目的主要內容。
MT(Monitor Test):實現通過序列埠可控各層,於各層
進行直接溝通。
OSAL(Operating System (OS) Abstraction Layer):
protocol stack的操作系統。
Services:地址處理函數目錄,包括著地址模式的定義及
地址處理函數。
Tools:工程配置目錄,包括空間劃分及Z-Stack相關配置
信息。
ZMac: MAC層目錄,包括MAC層參數配置及MAC層LIB
API回傳處理。
ZMain:主函數目錄,包括初始化函數及硬件配置。
Output:輸出文件目錄,這個EW8051 IDE自動生成的。
16
Demo Environment
•
•
•
•
•
CC2530ZDK Sensor Demo Software
ZStack-CC2530-2.3.0-1.4.0
SmartRF Flash Programmer(swrc044i)
IAR 8051 7.51A
Zigbee SFTP
– 10.10.59.32
• Driver
– C:\Program Files\Texas Instruments\Extras\Drivers
17
Open Workspace
IAR Embedded Workbench
18
Open Workspace
IAR Embedded Workbench
19
EDIT
IAR Embedded Workbench
20
Set Virtual Registers
IAR Embedded Workbench
21
Rename and Output Format
IAR Embedded Workbench
22
Build Hex
IAR Embedded Workbench
23
Download hex
SmartRF Flash Programmer
24
Demo 情境1
• Non enable security over NWK layer
• Coordinator
– CollectorEB.hex
• Sensor
– SensorEB.hex
25
情境2
• Enable security over NWK layer
• Network key is preconfigured (Set
zgPreConfigkeys = TRUE in ZGlobals.c)
• Setting preconfigured Network key ( Defaultkey =
{KEY} in nwk_globals.c)
• Coordinator
– CollectorEB_ssec.hex
• Sensor
– SensorEB_ssec.hex
– SensorEB_sseck.hex (different key)
26
情境3
• Enable security over NWK layer
• Network key is not preconfigured (Set
zgPreConfigkeys = FALSE in ZGlobals.c)
• Setting preconfigured Network key ( Defaultkey =
{KEY} in nwk_globals.c)
• Coordinator
– CollectorEB_ssecf.hex
• Sensor
– SensorEB_ssecf.hex
27
參考資料
• TI 802.15.4_MAC_API.pdf
• IAR 設定
– http://e2e.ti.com/support/low_power_rf/f/160/p
/18242/70813.aspx#70813
28
Download