when receive the BLE_GAP_EVT_SEC_PARAMS_REQUEST event,to call sd_ble_gap_sec_params_reply return NRF_ERROR_INVALID_STATE(code 8);
when receive the BLE_GAP_EVT_SEC_PARAMS_REQUEST event,to call sd_ble_gap_sec_params_reply return NRF_ERROR_INVALID_STATE(code 8);
Have you included the Peer manager module in your project? In that case, you should let the peer manager handle the event.
thanks for you answer!
yes , include the peer manager module in my project .
please. tell me how to do it?
Sure you don't have it already? I assumed that was the reason you got the error in the first place. Please check if peer_manager.c is included in your project. If it is you need to remove the BLE_GAP_EVT_SEC_PARAMS_REQUEST handling in your code.
yes. include peer_manager.c ,if I remove the BLE_GAP_EVT_PARAMS_REQUEST handing ,I can not use static passkey to connect other device!
You need to initialize the Peer manager to support pairing with passkey. See my answer here: https://devzone.nordicsemi.com/f/nordic-q-a/48417/ble-peripheral-nordic52832-use-static-passkey-at-same-time-i-have-one-nordic52840-central-how-to-use-static-passkey