Other Parts Discussed in Thread: Z-STACK
你好,我想请问下有没有install code方式入网的资料,最好有一些例程,网上关于这部分的资料太少了,谢谢!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: Z-STACK
你好,我想请问下有没有install code方式入网的资料,最好有一些例程,网上关于这部分的资料太少了,谢谢!
10.1 Install codes
This section describes the out of band process for establishing pre-configured Trust Center link keys, the format of the Install Code required, and the hashing function used to derive the pre-configured link key from the Install Code. Note that Install Codes SHALL be random but MAY NOT be unique.
As portrayed in Figure 11, during the manufacturing process a random Install Code is created for each of the nodes. This Install Code is provided for the node in a manufacturer-specific way (labeling, etc.) and referred to during installation. The space of Install Codes SHOULD possess the same randomness properties as a key space. Knowing a set of Install Codes SHOULD NOT yield any knowledge of another Install Code and each Install Code SHOULD be equally probable.
具体流程请去ZigBee Alliance 下载Base-Device-Behavior-Specification
1.zgAllowInstallCodes必须宏定义为ZG_IC_SUPPORTED_NOT_REQUIRED或ZG_IC_MUST_USED
2.在应用层定义全局变量
/*********************************************************************
*测试全局变量区
*/
/*宏定义默认Install code */
/*注意:最后两个字节为CRC校验结果*/
#define INSTALL_CODE_DEFAULT {0x83,0xFE,0xD3,0x40,0x7A,0x93,0x97,0x23,0xA5,\
0xC6,0x39,0xB2,0x69,0x16,0xD5,0x05,0xC3,0xB5}
static uint8 uiInstallCode[] = INSTALL_CODE_DEFAULT;
/*宏定义默认的install code的目标终端IEEE地址*/
#define INSTALL_CODE_ADDR_DEFAULT {0xA9,0xB6,0x4A,0x0E,0x00,0x4B,0x12,0x00}
static uint8 uiInstallCodeAddr[Z_EXTADDR_LEN] = INSTALL_CODE_ADDR_DEFAULT;
/*添加Install code的返回状态*/
static ZStatus_t uiAddInstallCodeLastStatus = 0xFF;
3.在应用层初始化函数中添加
uint16 crc = 0; /*为install code进行CRC校验*/ crc = bdb_GenerateInstallCodeCRC(uiInstallCode); /*install code后面两个字节为CRC校验的结果*/ uiInstallCode[INSTALL_CODE_LEN] = crc & 0xFF; uiInstallCode[INSTALL_CODE_LEN + 1] = crc >> 8; /*将install code和install code address添加进表里*/ uiAddInstallCodeLastStatus = bdb_addInstallCode(uiInstallCode, uiInstallCodeAddr);
4.调用创建网络的函数创建一个网络,并允许终端入网
bdb_StartCommissioning();
1.修改宏定义BDB_ATTRIBUTES_DEFAULT_CONFIG为BDB_INSTALL_CODE_DERIVED_PRECONFIGURED_LINK_KEY
2.在应用层定义全局变量
/*********************************************************************
*测试全局变量区
*/
/*宏定义默认Install code */
/*注意:最后两个字节为CRC校验结果*/
#define INSTALL_CODE_DEFAULT {0x83,0xFE,0xD3,0x40,0x7A,0x93,0x97,0x23,0xA5,\
0xC6,0x39,0xB2,0x69,0x16,0xD5,0x05,0xC3,0xB5}
static uint8 uiInstallCode[] = INSTALL_CODE_DEFAULT;
/*添加Install code的返回状态*/
static ZStatus_t uiAddInstallCodeLastStatus = 0xFF;
3.在应用层初始化函数中添加
uint16 crc = bdb_GenerateInstallCodeCRC(uiInstallCode); uiInstallCode[INSTALL_CODE_LEN] = crc & 0xFF; uiInstallCode[INSTALL_CODE_LEN + 1] = crc >> 8; /*将Install code添加进表里*/ uiAddInstallCodeLastStatus = bdb_setActiveCentralizedLinkKey(FALSE, uiInstallCode);
4.调用入网语句
bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING);
注意:在协调器中终端的IEEE地址和双方的install code必须一致,否则终端无法入网。
请问有抓包文件吗?终端配置都对,但是不能入网呢?抓包只有Association Request和应答。应该是什么过程呢