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

Getting HardFault Error when using BLE LESC pairing

I am using SDK nRF5_SDK_14.0.0_3bcc1f7 in my project. All the features was working but i need to add the security mode 1 level 4 security in our BLE device with LESC. I have added security in buttonless DFU code taking reference from ble_app_multirole_lesc example code. I am using a button for MITM.

#define LESC_DEBUG_MODE 0 /**< Set to 1 to use LESC debug keys, allows you to use a sniffer to inspect traffic. */
#define LESC_MITM_NC 1 /**< Use MITM (Numeric Comparison). */
#define SEC_PARAMS_BOND 1 /**< Perform bonding. */
#if LESC_MITM_NC
#define SEC_PARAMS_MITM 1 /**< Man In The Middle protection required. */
#define SEC_PARAMS_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_YESNO /**< Display Yes/No to force Numeric Comparison. */
#else
#define SEC_PARAMS_MITM 0 /**< Man In The Middle protection required. */
#define SEC_PARAMS_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O caps. */
#endif
#define SEC_PARAMS_LESC 1 /**< LE Secure Connections pairing required. */
#define SEC_PARAMS_KEYPRESS 0 /**< Keypress notifications not required. */
#define SEC_PARAMS_OOB 0 /**< Out Of Band data not available. */
#define SEC_PARAMS_MIN_KEY_SIZE 7 /**< Minimum encryption key size in octets. */
#define SEC_PARAMS_MAX_KEY_SIZE 16 /**< Maximum encryption key size in octets. */
#define BLE_GAP_LESC_P256_SK_LEN 32

Pairing and Bonding is working as expected, but sometimes I observed during pairing process if I press the device button, device go in hang state and sometimes cause HardFault Error. I check with debug mode, but nothing found the cause for that. How can i check what is causing the HardFault Error? And is there any known issue with this SDK for LESC connection that can cause this HardFault Error? 

Parents
  • Hi,

    How can i check what is causing the HardFault Error?

    For more info on debugging in general for nRF5 projects, take a look at this post.

    What error-handler is getting called? Is it HardFault_Handler or app_error_fault_handler ?

    If this is a hardfault, and HardFault_Handler is called, then to determine the root cause of the hardfault, make sure that the hardfault library is used:
    Add these to your projects:
    $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c
    $(SDK_ROOT)/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c //use the correct file depending on your toolchain
    And set HARDFAULT_HANDLER_ENABLED to 1 in sdk_config.h, and add DEBUG_NRF in your preprocessor definitions.

    And is there any known issue with this SDK for LESC connection that can cause this HardFault Error? 

     Not that I'm aware of. We have a known issues list for SDK v14 here, https://devzone.nordicsemi.com/f/nordic-q-a/29796/what-are-sdk-14-x-0-known-issues ,but I don't see any issues that resembles what you describe.

  • Hi there, I followed the step above and I got error :

    ..\..\..\..\..\..\components\libraries\hardfault\nrf52\handler\hardfault_handler_gcc.c(80): error:  #18: expected a ")"

    How can I fix it ? thanks

Reply Children
Related