Zboss "crash" in zb_schedule_alarm()

Hello,

I'm using the zboss stack to implement a zigbee end device on nrf5340.

My device is able to connect to a zigbee network and to notify sensor events on zigbee but after a random time a crash happens on the stack side :

I'm quite stuck to debug this issue.

it seems that the stack stops because of an error executing zb_schedule_alarm() but I have no more clues.

How do you debug such issue ?

Environment :

* nRF5340

* NRF_SDK_VERSION=v1.0.1
  NRF_SDK_NAME=ncs-zigbee-r22
  NRF_MAIN_SDK_VERSION=v2.9.0

Regards,

Gaël

Parents
  • Hello,

    I reproduce the same issue on nRF5340DK + example light_switch + send of periodic event.

    My network controller is Home assistant + ZHA + controller  EFR32MG21 based (firmare EZSP).

    To send periodic events (every 500 ms) :

    static void alarm_timers_init(void)
    {
    	k_timer_init(&buttons_ctx.alarm, light_switch_button_handler, NULL);
    	k_timer_init(&bulb_ctx.find_alarm, find_light_bulb_alarm, NULL);
    	k_timer_init(&periodic_send_evt_ctx.alarm, test_send_event_handler, NULL);
    }
    
    //...
    
    static void test_send_event_handler(struct k_timer *timer)
    {
    	zb_ret_t zb_err_code;
    	zb_uint16_t cmd_id;
    
    	/* toogle button state */
    	if (buttons_ctx.state == BUTTON_ON) {
    		buttons_ctx.state = BUTTON_OFF;
    		cmd_id = ZB_ZCL_CMD_ON_OFF_OFF_ID;
    	} else {
    		buttons_ctx.state = BUTTON_ON;
    		cmd_id = ZB_ZCL_CMD_ON_OFF_ON_ID;
    	}
    
    	/* Allocate output buffer and send step command. */
    	zb_err_code = zb_buf_get_out_delayed_ext(light_switch_send_on_off,
    							cmd_id,
    							0);
    	if (!zb_err_code) {
    		LOG_WRN("Buffer is full");
    	}
    }
    
    //...
    void zboss_signal_handler(zb_bufid_t bufid)
    {
            //...
        case ZB_BDB_SIGNAL_STEERING:
     		ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
     		if (status == RET_OK) {
     			/* Check the light device address. */
    #if 0
     			if (bulb_ctx.short_addr == 0xFFFF) {
     				k_timer_start(&bulb_ctx.find_alarm,
     					      MATCH_DESC_REQ_START_DELAY,
     					      MATCH_DESC_REQ_TIMEOUT);
     			}
    #endif
    			/* TEST : start timer to do periodic send over zigbee */
    			LOG_INF("Start periodic send event");
    			k_timer_start(&periodic_send_evt_ctx.alarm, BUTTON_LONG_POLL_TMO,
    			      BUTTON_LONG_POLL_TMO);
            //...
    }

    To pair with HA, the following option is enabled :

    CONFIG_ZIGBEE_CHANNEL_SELECTION_MODE_MULTI=y

Reply
  • Hello,

    I reproduce the same issue on nRF5340DK + example light_switch + send of periodic event.

    My network controller is Home assistant + ZHA + controller  EFR32MG21 based (firmare EZSP).

    To send periodic events (every 500 ms) :

    static void alarm_timers_init(void)
    {
    	k_timer_init(&buttons_ctx.alarm, light_switch_button_handler, NULL);
    	k_timer_init(&bulb_ctx.find_alarm, find_light_bulb_alarm, NULL);
    	k_timer_init(&periodic_send_evt_ctx.alarm, test_send_event_handler, NULL);
    }
    
    //...
    
    static void test_send_event_handler(struct k_timer *timer)
    {
    	zb_ret_t zb_err_code;
    	zb_uint16_t cmd_id;
    
    	/* toogle button state */
    	if (buttons_ctx.state == BUTTON_ON) {
    		buttons_ctx.state = BUTTON_OFF;
    		cmd_id = ZB_ZCL_CMD_ON_OFF_OFF_ID;
    	} else {
    		buttons_ctx.state = BUTTON_ON;
    		cmd_id = ZB_ZCL_CMD_ON_OFF_ON_ID;
    	}
    
    	/* Allocate output buffer and send step command. */
    	zb_err_code = zb_buf_get_out_delayed_ext(light_switch_send_on_off,
    							cmd_id,
    							0);
    	if (!zb_err_code) {
    		LOG_WRN("Buffer is full");
    	}
    }
    
    //...
    void zboss_signal_handler(zb_bufid_t bufid)
    {
            //...
        case ZB_BDB_SIGNAL_STEERING:
     		ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
     		if (status == RET_OK) {
     			/* Check the light device address. */
    #if 0
     			if (bulb_ctx.short_addr == 0xFFFF) {
     				k_timer_start(&bulb_ctx.find_alarm,
     					      MATCH_DESC_REQ_START_DELAY,
     					      MATCH_DESC_REQ_TIMEOUT);
     			}
    #endif
    			/* TEST : start timer to do periodic send over zigbee */
    			LOG_INF("Start periodic send event");
    			k_timer_start(&periodic_send_evt_ctx.alarm, BUTTON_LONG_POLL_TMO,
    			      BUTTON_LONG_POLL_TMO);
            //...
    }

    To pair with HA, the following option is enabled :

    CONFIG_ZIGBEE_CHANNEL_SELECTION_MODE_MULTI=y

Children
Related