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

APP_ERROR_CHECK() and ZigBee stack

Hello everyone,

I have a question regarding logging errors on debug console (UART or RTT) while using ZigBee stack:

My problem is that I can't get any debug print when APP_ERROR_CHECK() occurs. Application just hangs in zb_nrf52840_abort() without printing any useful info.
Normally, in application without ZigBee stack, I can define my custom app_error_fault_handler() or just get info from weak function in app_error_weak.c. But it's impossible with ZigBee stack since it declares its own app_error_fault_handler() inside libzboss.a
I have found this question (https://devzone.nordicsemi.com/f/nordic-q-a/47312/custom-application-error-handler-zigbee) where Nordic's Engineer wrote that  app_error_fault_handler() inside libzboss.a should print the same info as handler from app_error_weak.c but I can't see any print.

So, the question is: How get debug print on APP_ERROR_CHECK() with ZigBee stack?

Test environment:

  nRF5SDKforThreadandZigbeev310c7c4730/examples/multiprotocol/ble_zigbee/ble_zigbee_dynamic_light_switch_nus/pca10056 example compiled with GCC and added APP_ERROR_CHECK(1); just under first print:

/**@brief Function for application main entry.
 */
int main(void)
{
    zb_ret_t   zb_err_code;

    /* Initialize loging system and GPIOs. */
    log_init();
    timer_init();
    leds_buttons_init();

    /* Bluetooth initialization. */
    ble_stack_init();
    /* NUS Commander initialization. */
    nus_init(NULL);
    
    /* Add commands to NUS */
    add_nus_commands();

    /* Initialize Zigbee stack. */
    zigbee_init();

#ifdef ARDUINO_JOYSTICK_SHIELD_V1A
    /* Initialize the Joystick routines. */
    joystick_init(joystick_cb);
#endif

    /* Start execution. */
    NRF_LOG_INFO("BLE Zigbee dynamic light switch example started.");
    APP_ERROR_CHECK(1); // Test debug print
    
    /** Start Zigbee Stack. */
    zb_err_code = zboss_start();
    ZB_ERROR_CHECK(zb_err_code);

    while(1)
    {
        zboss_main_loop_iteration();
        UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
    }
}

Best regards,

Michal

Parents Reply
  • Hi Michal,

    Sorry for the late answer. The app_error_fault_handler inside ZBOSS will be changed into a weak function so the user can overwrite it in a future release.

    For now you may try to use the debugger to see arguments passed to the app_error_fault_handler implemented inside the Zigbee stack or just change the APP_ERROR_HANDLER macro (inside components/libraries/util/app_error.h) to call a custom handler:

    #ifdef DEBUG
    #define APP_ERROR_HANDLER(ERR_CODE)                                    \
        do                                                                 \
        {                                                                  \
            app_error_handler_customized((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \
        } while (0)
    
    #else
    #define APP_ERROR_HANDLER(ERR_CODE)                                    \
        do                                                                 \
        {                                                                  \
            app_error_handler_bare((ERR_CODE));                            \
        } while (0)
    #endif
    

    Best regards,

    Marjeris

Children
Related