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

[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.

case ZB_NLME_STATUS_INDICATION: 
{
    NRF_LOG_INFO("ZB_NLME_STATUS_INDICATION\r\n");
    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: ZB_NLME_STATUS_INDICATION
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.

Related