This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to use the APP_ERROR_CHECK

i find that the macro APP_ERROR_CHECK call the macro APP_ERROR_HANDLER

do                                                      \
{                                                       \
    const uint32_t LOCAL_ERR_CODE = (ERR_CODE);         \
    if (LOCAL_ERR_CODE != NRF_SUCCESS)                  \
    {                                                   \
        APP_ERROR_HANDLER(LOCAL_ERR_CODE);              \
    }                                                   \
} while (0)   

and than the APP_ERROR_HANDLER shows here

#define APP_ERROR_HANDLER(ERR_CODE)
do
{
app_error_handler((ERR_CODE), 0, 0);
} while (0) #endif

finally ,the main function of the app_error_handler shows here

volatile bool loop = true;
UNUSED_VARIABLE(loop);

m_error_code = error_code;
m_line_num = line_num;
m_p_file_name = p_file_name;

UNUSED_VARIABLE(m_error_code);
UNUSED_VARIABLE(m_line_num);
UNUSED_VARIABLE(m_p_file_name);
__disable_irq();

while(loop);

i do not know how to take use of this function?

can i get some suggestion here?

thank you very much.

Parents
  • What do you mean "take use of it"? There's a function returns non zero, APP_ERROR_CHECK eventually calls the error handler routine. You can break in it to see how you got an error or replace it with a function of your own to reset the chip, dump a stack trace to flash or anything else.

  • i am sorry for my Vague questions

    i mean ,should i set a break point in this function,,when jump in this function , i can check the values : m_error_code , m_line_num , m_p_file_name ,

    the m_error_code is a Integer value, and i should determine the extra error with the integer value.

Reply
  • i am sorry for my Vague questions

    i mean ,should i set a break point in this function,,when jump in this function , i can check the values : m_error_code , m_line_num , m_p_file_name ,

    the m_error_code is a Integer value, and i should determine the extra error with the integer value.

Children
No Data
Related