Hardfault logging

Hi,

Sdk 17.1.0

Trying to log all the necessary information in the event of a hardfault when the product is deployed in the fields and to retrieve it later.

  1.  Is it okay to use nrf sdk flash apis in the hardfault handler to store the data to the internal flash ? Are there any risk in using the internal flash in the exception handler ?
  2. Are there any examples for this ?
  3. Is there a need of external flash or can we use the internal one ?
Parents
  • Hello,

    You can find some pointers here:
    Error Handling for Soft Device and Application 

    So the general idea is that you store the error information to a RAM buffer when there is an assert, then execute system reset, and then after reset you can either store the RAM buffer to flash (e.g. using FDS or NVMC directly if you have a designated flash page available) or send it through some BLE link to the peer. External flash is not needed.

    Kenneth

  • Thank you so much Kenneth for your reply.

    Did you mean 'NVIC_SystemReset' by system reset ?

    Is there any reason you advised to store the RAM buffer to flash 'after' a reset ? Cannot we store the RAM buffer to flash inside the fault handler before resetting, Is there a risk doing so ?

  • Luke_123 said:
    Did you mean 'NVIC_SystemReset' by system reset ?

    Yes.

    Luke_123 said:
    Is there any reason you advised to store the RAM buffer to flash 'after' a reset ? Cannot we store the RAM buffer to flash inside the fault handler before resetting, Is there a risk doing so ?

    Part of the reason is simply that you don't really know what caused the assert to trigger, so you can't really depend on software modules will be able to write successfully to flash in such case, unless you implement bare-bone hardware usage of the NVMC to write to flash within the fault handler.

    Kenneth 

Reply
  • Luke_123 said:
    Did you mean 'NVIC_SystemReset' by system reset ?

    Yes.

    Luke_123 said:
    Is there any reason you advised to store the RAM buffer to flash 'after' a reset ? Cannot we store the RAM buffer to flash inside the fault handler before resetting, Is there a risk doing so ?

    Part of the reason is simply that you don't really know what caused the assert to trigger, so you can't really depend on software modules will be able to write successfully to flash in such case, unless you implement bare-bone hardware usage of the NVMC to write to flash within the fault handler.

    Kenneth 

Children
Related