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.

关于install code入网

Other Parts Discussed in Thread: Z-STACK

你好,我想请问下有没有install code方式入网的资料,最好有一些例程,网上关于这部分的资料太少了,谢谢!

  • Z-Stack 3.0.1裡面的例程都有實做install code方式入网
  • 资料确实不多,参考下Z-Stack 3.0 Developer’s Guide 10.5.2
  • 你好,请问下有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必须一致,否则终端无法入网。

  • 如果此方法有什么问题,望指出!谢谢!
  • 参照light和switch里面的ui文件中有使用实例.
  • 请问有抓包文件吗?终端配置都对,但是不能入网呢?抓包只有Association Request和应答。应该是什么过程呢

    123.zip

  • 终端應該要發出device annoucement吧,你的终端沒看到發出來
  • 我就是按上楼说的,修改BDB_INSTALL_CODE_DERIVED_PRECONFIGURED_LINK_KEY
    bdb_setActiveCentralizedLinkKey(FALSE, uiInstallCode);
    还需要别的操作吗?
    协调器开启入网前加入code了呀
    不知道为啥没有announce
  • 楼上的终端 bdb_setActiveCentralizedLinkKey(FALSE, uiInstallCode); 可能不对把?
    我之前按照例程的ui里面函数UIActionSetInstallCode 启动installcode入网方式的,函数里的是bdb_setActiveCentralizedLinkKey(zstack_UseInstallCode, uiInstallCode);
    第一个参数是枚举的zstack_UseInstallCode,才是IC入网方式呀

    你能帮助测试看看吗