This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[ZIGBEE] switch key procedure

SDK: 4.1.0

CHIP: 52840

old question

my sleepy zed lost connection to the coordinator after refreshing key of the coordinator.

1) how can I manipulate refresh key of the coordinator?

2) how can I callback to receive broadcast packet?

3) Is there rejoin request function without security? the coordinator manufacturer says that the plain request of rejoin must be procedured after switching key.

4) how can I callback to receive APS packet?

the zed received "switch key packet" but doesn't procedure anything.

5344.switch_key.pcapng

Parents
  • Hi,

    I'm not sure what you mean by manipulate refresh key, but for network key switching you can use the function zb_secur_setup_nwk_key(), which can be used to force the network key switch procedure. I would recommend taking a look at the documentation for security in the Zigbee SDK, where you can find more information about the Zigbee network security API.

    You can use the function zb_bdb_set_legacy_device_support(1) to disable the trust center require key exchange.

    As for your questions about callback, you can take a look at the information about it in the page about programming principles in Zigbee. Also, it depends on what the callback is for. For ZCL commands, you can take a look at the function zcl_device_cb, which you will find in several of the Zigbee examples in the SDK, and you can also find several examples of different callbacks in CLI, specifically in the file zigbee_cli_cmd_zdo.c.

    Best regards,

    Marte

  • Hi, thanks for the reply.

    The switch key doesn't have any key value.

    1) What key pass to the function zb_secur_setup_nwk_key()

    The callback I mentioned is about receiving packet handler.

    2) How can I register callback which handles APS layer packet? I currently handles ZCL packets by the code.

    ZB_AF_SET_ENDPOINT_HANDLER(DOOR_LOCK_ENDPOINT, izs_zcl_cmd_handler);

    I wants to watch receiving APS ack. The switch key/transport key also are in APS layer.

    3) Why switch key mechanism doesn't work?

    it is zigbee version problem?Is it up to zigbee developer?

    4) 

    zb_af_set_data_indication

    I used "zb_af_set_data_indication" function which callback when receiving packet is aps data frame type.

    but, I want to callback irrespective of frame type.

    5) Is there packet decryption failed signal?

  • I found the solutions about few my questions.

    2) How can I register callback which handles APS layer packet? I currently handles ZCL packets by the code.

    static bool zcl_check_send_result(zb_uint8_t param)
    {
        zb_zcl_command_send_status_t * p_cmd_status;
    
        if (param == 0)
        {
            return false;
        }
        uint8_t buf_len = zb_buf_len(param);
        p_cmd_status = ZB_BUF_GET_PARAM(param, zb_zcl_command_send_status_t);
        DEBUG_DATAL("ias_zone_result_cb data", zb_buf_begin(param), buf_len);
        DEBUG_PRINTF("Frame acknowledged. Status: %d\n", p_cmd_status->status);
        if (p_cmd_status->status != RET_OK)
        {
            /* No APS-ACK received. */
            DEBUG_PRINTF("No APS-ACK received.\n");
            return false;
        }
        return true;
    }
    

    I found the code in benchmark source in sdk.

    I summarizes my questions again.

    1) 

    Why switch key mechanism doesn't work?

    it is zigbee version problem? Is it up to zigbee developer?

    2)

    I wants to send zigbee network layer packet like below picture. Which function should I use?

    3) 

    How can I get network time? Is there the synchronization of time in zigbee stack?

Reply
  • I found the solutions about few my questions.

    2) How can I register callback which handles APS layer packet? I currently handles ZCL packets by the code.

    static bool zcl_check_send_result(zb_uint8_t param)
    {
        zb_zcl_command_send_status_t * p_cmd_status;
    
        if (param == 0)
        {
            return false;
        }
        uint8_t buf_len = zb_buf_len(param);
        p_cmd_status = ZB_BUF_GET_PARAM(param, zb_zcl_command_send_status_t);
        DEBUG_DATAL("ias_zone_result_cb data", zb_buf_begin(param), buf_len);
        DEBUG_PRINTF("Frame acknowledged. Status: %d\n", p_cmd_status->status);
        if (p_cmd_status->status != RET_OK)
        {
            /* No APS-ACK received. */
            DEBUG_PRINTF("No APS-ACK received.\n");
            return false;
        }
        return true;
    }
    

    I found the code in benchmark source in sdk.

    I summarizes my questions again.

    1) 

    Why switch key mechanism doesn't work?

    it is zigbee version problem? Is it up to zigbee developer?

    2)

    I wants to send zigbee network layer packet like below picture. Which function should I use?

    3) 

    How can I get network time? Is there the synchronization of time in zigbee stack?

Children
Related