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

set static pass key for nrf51822 in example code--hrs with dfu ,nrf51822 reboot

we add static pass key in example code hrs with dfu,but when connecting with phone,input passkey on phone,the nrf51822 will rebootdevice_manager_cnfg.h main.c

Parents
  • Hi RiverYWang,

    in your main.c file you have device_manager_evt_handler and when you have entered a wrong pass key or if the authentication has failed for some other reasons then you do not handle the error. Instead you say that event_result can never fail and if it fails then your default handling is system_reboot in in app_error.c (app_error_handler->NVIC_SystemReset)

    So you have to do two things.

    1. you have to handle error AUTH status errors (Search for BLE_GAP_SEC_STATUS) OR remove APP_ERROR_CHECK(event_result); from your main.c device_manager_evt_handler

    2. The default of APP_ERROR_CHECK failures for you seems to be system reset. Please override the error handler in app_error.c so that you handle the errors as you wish rather than system restarts.

    Please have a look at this post, to understand better on how error handling works.

Reply
  • Hi RiverYWang,

    in your main.c file you have device_manager_evt_handler and when you have entered a wrong pass key or if the authentication has failed for some other reasons then you do not handle the error. Instead you say that event_result can never fail and if it fails then your default handling is system_reboot in in app_error.c (app_error_handler->NVIC_SystemReset)

    So you have to do two things.

    1. you have to handle error AUTH status errors (Search for BLE_GAP_SEC_STATUS) OR remove APP_ERROR_CHECK(event_result); from your main.c device_manager_evt_handler

    2. The default of APP_ERROR_CHECK failures for you seems to be system reset. Please override the error handler in app_error.c so that you handle the errors as you wish rather than system restarts.

    Please have a look at this post, to understand better on how error handling works.

Children
No Data
Related