文档详情

协调器自启动模式.doc

发布:2017-04-04约1.41万字共23页下载文档
文本预览下载声明
使用的协议栈版本信息: ZigBee2006\ZStack-1.4.3-1.2.1 Zigbee网络设备启动流程—协调器(自启动模式)—以SampleApp的协调器为例.1、协调器预编译信息 通过project-options-c/c++compiler-extraOptions可以看到协调器所带的配置文件为: -f $PROJ_DIR$\..\..\..\Tools\CC2430DB\f8wCoord.cfg -f $PROJ_DIR$\..\..\..\Tools\CC2430DB\f8wConfig.cfg 即编译了ZDO_COORDINATOR和RTR_NWK. 通过project-options-c/c++compiler-Preprocessor-Defined symbols可以看到协调器预编译包含了: CC2430EB; ZTOOL_P1; MT_TASK; LCD_SUPPORTED=DEBUG; MANAGED_SCAN 没有编译HOLD_AUTO_START和SOFT_START. 2、具体流程 main()-osal_init_system()-osalInitTasks()-ZDApp_Init() 进入ZDApp_Init()函数:************************************** void ZDApp_Init( byte task_id ) { ??uint8 capabilities; ??// Save the task ID ??ZDAppTaskID = task_id; ??// Initialize the ZDO global device short address storage ??ZDAppNwkAddr.addrMode = Addr16Bit; ??ZDAppNwkAddr.addr.shortAddr = INVALID_NODE_ADDR;?//0xFFFE ??(void)NLME_GetExtAddr();?// Load the saveExtAddr pointer. ??// Check for manualHold Auto Start ??//检测到有手工设置SW_1则会设置devState = DEV_HOLD,从而避开网络初始化 ??ZDAppCheckForHoldKey(); // Initialize ZDO items and setup the device - type of device to create. ??ZDO_Init();?//通过判断预编译来开启一些函数功能 ??// Register the endpoint description with the AF ??// This task doesnt have a Simple description, but we still need ??// to register the endpoint. ??afRegister( (endPointDesc_t *)ZDApp_epDesc ); #if defined( ZDO_USERDESC_RESPONSE ) ??ZDApp_InitUserDesc(); #endif?// ZDO_USERDESC_RESPONSE ??// set broadcast address mask to support broadcast filtering ??NLME_GetRequest(nwkCapabilityInfo, 0, capabilities); ??NLME_SetBroadcastFilter( capabilities ); ??// Start the device? ??if ( devState != DEV_HOLD ) ??{ ????ZDOInitDevice( 0 ); ??} ?? ??else ??{ ????// Blink LED to indicate HOLD_START ????HalLedBlink ( HAL_LED_4, 0, 50, 500 ); ??} ??ZDApp_RegisterCBs(); } ************************************** 协调器没有编译HOLD_AUTO_START,也没有手工设置SW_1,初始化devState = DEV_INIT(参见基本问题说明3).因此直接在ZDApp_Init()中进入ZDOInitDevice( 0 )开启设备. ************************************** uint8 ZDOInitDevice( uint16 s
显示全部
相似文档