[ZIGBEE] How to send "rejoin" request?

SDK: 4.1.0

CHIP: 52840

Hi, I have developed sleepy zed. It lost the connection with the network after joining in 1~3 days.

It assumes that the zed couldn't get the network key after refresh key of the coordinator.

so, the zed get this signal.

    zb_zdo_signal_nlme_status_indication_params_t * p_nlme_status_indication_params;
    p_nlme_status_indication_params = ZB_ZDO_SIGNAL_GET_PARAMS(p_sg_p, zb_zdo_signal_nlme_status_indication_params_t);
    NRF_LOG_INFO("status: %d\n", p_nlme_status_indication_params->nlme_status.status);
    NRF_LOG_INFO("network_addr: %X\n", p_nlme_status_indication_params->nlme_status.network_addr);
    NRF_LOG_INFO("unknown_command_id: %X\n", p_nlme_status_indication_params->nlme_status.unknown_command_id);
} break;

00> <info> app: status: 17
00> <info> app: network_addr: 0
00> <info> app: unknown_command_id: 7B

/** @cond internals_doc */
/** @brief Network command status codes. */
typedef enum zb_nwk_command_status_e
  ZB_NWK_COMMAND_STATUS_NO_ROUTE_AVAILABLE           = 0x00, /**< No route available */
  ZB_NWK_COMMAND_STATUS_TREE_LINK_FAILURE            = 0x01, /**< Tree link failure */
  ZB_NWK_COMMAND_STATUS_NONE_TREE_LINK_FAILURE       = 0x02, /**< None-tree link failure */
  ZB_NWK_COMMAND_STATUS_LOW_BATTERY_LEVEL            = 0x03, /**< Low battery level */
  ZB_NWK_COMMAND_STATUS_NO_ROUTING_CAPACITY          = 0x04, /**< No routing capacity */
  ZB_NWK_COMMAND_STATUS_NO_INDIRECT_CAPACITY         = 0x05, /**< No indirect capacity */
  ZB_NWK_COMMAND_STATUS_INDIRECT_TRANSACTION_EXPIRY  = 0x06, /**< Indirect transaction expiry */
  ZB_NWK_COMMAND_STATUS_TARGET_DEVICE_UNAVAILABLE    = 0x07, /**< Target device unavailable */
  ZB_NWK_COMMAND_STATUS_TARGET_ADDRESS_UNALLOCATED   = 0x08, /**< Target address unallocated */
  ZB_NWK_COMMAND_STATUS_PARENT_LINK_FAILURE          = 0x09, /**< Parent link failure */
  ZB_NWK_COMMAND_STATUS_VALIDATE_ROUTE               = 0x0a, /**< Validate route */
  ZB_NWK_COMMAND_STATUS_SOURCE_ROUTE_FAILURE         = 0x0b, /**< Source route failure */
  ZB_NWK_COMMAND_STATUS_MANY_TO_ONE_ROUTE_FAILURE    = 0x0c, /**< Many-to-one route failure */
  ZB_NWK_COMMAND_STATUS_ADDRESS_CONFLICT             = 0x0d, /**< Address conflict */
  ZB_NWK_COMMAND_STATUS_VERIFY_ADDRESS               = 0x0e, /**< Verify address */
  ZB_NWK_COMMAND_STATUS_PAN_IDENTIFIER_UPDATE        = 0x0f, /**< Pan ID update */
  ZB_NWK_COMMAND_STATUS_NETWORK_ADDRESS_UPDATE       = 0x10, /**< Network address update */
  ZB_NWK_COMMAND_STATUS_BAD_FRAME_COUNTER            = 0x11, /**< Bad frame counter  */
  ZB_NWK_COMMAND_STATUS_BAD_KEY_SEQUENCE_NUMBER      = 0x12, /**< Bad key sequence number */
  ZB_NWK_COMMAND_STATUS_UNKNOWN_COMMAND              = 0x13, /**< Command received is not known */

this is "ZB_NWK_COMMAND_STATUS_BAD_FRAME_COUNTER". I assumes that the decryption of old key extract bad frame counter.

But, the zed recognizes that it is joined to the network. I called ZB_JOINED()-> it returns true.

How to manipulate refresh key? 

I wants to add request of rejoin in this condition. the manufacture of the coordinator says that there should be request of rejoin after refresh key.

the zed already has request of rejoin after reset in joined condition. 

But, I failed to find the function of request of rejoin in zigbee_helpers.c file.

There are some functions ie. "start_network_rejoin_ED", "rejoin_the_network" and "start_network_steering" which doesn't be called after reset. but the rejoin procedure will be work.

  • Hi,

    I am not sure if I understood what you are asking for correctly, but the default signal handler will call start_network_rejoin() after ZB_ZDO_SIGNAL_LEAVE is called. See zigbee_default_signal_handler() in zigbee_helpers.c:

            case ZB_ZDO_SIGNAL_LEAVE:
                /* This signal is generated when the device itself has left the network by sending leave command.
                 * Note: this signal will be generated if the device tries to join legacy Zigbee network and the TCLK
                 *       exchange cannot be completed. In such situation, the ZB_BDB_NETWORK_STEERING signal will be generated
                 *       afterwards, so this case may be left unimplemented.
                if (status == RET_OK)
                    zb_zdo_signal_leave_params_t * p_leave_params = ZB_ZDO_SIGNAL_GET_PARAMS(p_sg_p, zb_zdo_signal_leave_params_t);
                    NRF_LOG_INFO("Network left (leave type: %d)", p_leave_params->leave_type);
                    /* Start network rejoin procedure */
                    NRF_LOG_ERROR("Unable to leave network (status: %d)", status);

    You can read more about the Zigbee network rejoining procedure by the default handler here: https://infocenter.nordicsemi.com/topic/sdk_tz_v4.1.0/zigbee_application_reference_component.html?cp=7_3_3_5_0_5#zarco_network_rejoin

    If you want to control the rejoining procedure by the application you need to handle each signal in which the Zigbee network rejoin procedure is managed by the application. Use start_network_rejoin() to start the rejoining procedure.



Reply Children
No Data