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

Use of MSP in error handler

We are currently getting intermittent errors in our ANT enabled application in field testing.  To try to understand where this is happening I want to send over ANT an indication of what line of code is causing the fault.

I had thought that the main stack pointer would be a good way to do this.  I am overriding the "app_error_fault_handler" function but putting in this code:

// Get stack pointer:
  uint32_t *sp = (uint32_t *) __get_MSP(); // Get stack pointer
  ia = sp[12];
  velo_status.error_status.stack_ptr = ia;
 

However the address returned is 0x000000BD which doesn't seem feasible.  Am I doing something wrong?  I have stolen the idea from the hard fault handler, and perhaps this just isn't possible in the app_error handler?

is there another way to go about it?  i can get the filename and line number, but that is a bit awkward to send over a 7 byte ANT payload.

Parents Reply Children
No Data
Related