I'm a beginner, the question might be simple but its really important for me. where does this error codes get store?? How to make use of err_code and whats the best way to debug my application?
I'm a beginner, the question might be simple but its really important for me. where does this error codes get store?? How to make use of err_code and whats the best way to debug my application?
The error code does not get stored anywhere. You have to either print it on serial port devzone.nordicsemi.com/.../
or Segger RTT devzone.nordicsemi.com/.../
or you have to set a break in keil debugger and break at the line error is generated and find out what error code is. Once you know the error code number, you can find its documentation in the relevant header files.
One way to use the err_code is to define DEBUG globally, like shown in the image, and hence use APP_ERROR_CHECK(err_code);
to assert the error code. This way, if you get an error, you will end up in a while forever loop in app_error_handler()
(defined in app_error.c) and you can find out in which file and line number your error occurred using the debugger.
Thanks Martin for your help.
I wanted to add that I supplied my own app_error_handler and could not get line number & filename without the DEBUG preprocessor directive. Hope this helps someone in the future.