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

how can I find out the reason of error_info?

When my program was running,An error occurred.The program ran here

(app_error_handler_bare)and the error_info is

0x00000004, how can I find out the reason of error_info?

void app_error_handler_bare(ret_code_t error_code) { error_info_t error_info = { .line_num = 0, .p_file_name = NULL, .err_code = error_code, };

app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));

UNUSED_VARIABLE(error_info);

}

  • Hi, hong. Can you specify what

    IDE (for instance, Keil ARM-MDK 5 / IAR EWARM 7 / etc.),

    what chip (nRF52832-QFAA, etc)

    and what SDK / SoftDevice version you are using?

    Also, are you running an example project provided by the SDK?

    // In, nrf_error.h (SDK 12)
    #define NRF_ERROR_BASE_NUM      (0x0)       ///< Global error base
    #define NRF_SUCCESS                           (NRF_ERROR_BASE_NUM + 0)  ///< Successful command
    #define NRF_ERROR_NO_MEM                      (NRF_ERROR_BASE_NUM + 4)  ///< No Memory for operation
    

    you've received an "no memory error".

    To answer your question, I suggest using the IDE's help like the below.

    First, set the breakpoint at the app_error_handler_bare like you did.

    Second, the IDEs may provide you call stack / call graph.

    • When using Keil MDK 5

    keil

    • When using IAR EWARM 7

    IAR

    IAR ref. link

    These methods can help you to figure out why the error 0x00000004 was returned from what function.

    Also, the functions, provided from the SDK, has described the reasons for returning those error at the comment sections.

    P.S.) I've only used Keil MDK and IAR EWARM.

    So if you use other IDEs, I suggest you to investigate how to view call stack when debugging with the IDE which you are using.

    -Best Regards, Mango

  • Sorry,I forget to indicate the IDE and SDK. I use keil4 and SDK is 12.2.
    When I call app_timer_stop,the error will occurre.

  • You don't need to apologize. :D

    The app_timer_stop calls timer_stop_op_schedule. If you check the comment section of timer_stop_op_schedule,

    /**@brief Function for scheduling a Timer Stop operation.
    * @param[in]  timer_id   Id of timer to stop.
    * @param[in]  op_type    Type of stop operation
    * @return NRF_SUCCESS on successful scheduling a timer stop operation.
     NRF_ERROR_NO_MEM when there is no memory left to schedule the timer stop operation.
    */
    static uint32_t timer_stop_op_schedule(timer_node_t * p_node, timer_user_op_type_t op_type){
        timer_user_op_t * p_user_op = user_op_alloc(&last_index);
        if (p_user_op == NULL) err_code = NRF_ERROR_NO_MEM; // omitted other parts
    
  • I'm not 100% sure (since I'm a novice developer...) but this might be related with the APP_TIMER_OP_QUEUE_SIZE in the main.c.

    Most of the examples, the value of this will be 4.

    #define APP_TIMER_OP_QUEUE_SIZE     4  /**< Size of timer operation queues. */
    

    How about increasing the value? Also, what example project are you using?

    If this doesn't help, I recommend you to close this case and open a new question to receive support.

    -Best Regards

  • Hi Hong,

    If you want to track down the line and file name causing the error, you should add DEBUG in the C/C++ "Preprocessor Symbols" in project setting. It's mentioned here. Then app_error_handler will be called, instead of app_error_handler_bare. You should be able to find the file name and line number.

Related