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

Peer Manager Unknown CONN_SEC Error Number

I'm using an Nrf52 with S132v3.0 I'm using Peer Manager to manage pairing and bonding. I'm running as a central connecting to a peripheral (iOS/Android peripheral).

I'm using "out of the box" peer management code using the following link from the SDK as an example. infocenter.nordicsemi.com/index.jsp

Most of the time the connection/pairing/bonding works just fine. On occasion I've experienced PM_EVT_CONN_SEC_FAILED.

Below is my switch statement broken up for debug purposes.

switch (p_evt->params.conn_sec_failed.error)
        {
            case PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING:
                // Rebond if one party has lost its keys.
                err_code = pm_conn_secure(p_evt->conn_handle, true);
                if (err_code != NRF_ERROR_INVALID_STATE)
                {
                    APP_ERROR_CHECK(err_code);
                }
                break;//PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING
									
							case PM_CONN_SEC_ERROR_MIC_FAILURE:
                NRF_LOG_DEBUG("error: PM_CONN_SEC_ERROR_MIC_FAILURE");
									sd_ble_gap_disconnect(p_evt->conn_handle, BLE_HCI_AUTHENTICATION_FAILURE);
                break;//PM_CONN_SEC_ERROR_MIC_FAILURE

            case PM_CONN_SEC_ERROR_DISCONNECT :
                NRF_LOG_DEBUG("error: PM_CONN_SEC_ERROR_DISCONNECT ");
									sd_ble_gap_disconnect(p_evt->conn_handle, BLE_HCI_AUTHENTICATION_FAILURE);
                break;//PM_CONN_SEC_ERROR_DISCONNECT

            case PM_CONN_SEC_ERROR_SMP_TIMEOUT:
                NRF_LOG_DEBUG("error: PM_CONN_SEC_ERROR_SMP_TIMEOUT");
									sd_ble_gap_disconnect(p_evt->conn_handle, BLE_HCI_AUTHENTICATION_FAILURE);
                break;//PM_CONN_SEC_ERROR_SMP_TIMEOUT
							
            default:
									/* Close the connection and move on */
									sd_ble_gap_disconnect(p_evt->conn_handle, BLE_HCI_AUTHENTICATION_FAILURE);
                break;
        }

The error I'm getting is "Unknown" with an error ID of 0x0001.
Looking at the documentation: infocenter.nordicsemi.com/index.jsp

The only valid error IDs are 0x6, 0x3D, 0x100 ,0x101. Has anyone seen 0x0001? Any idea what it means?

Parents
  • I have conferred with a colleague. The error you are getting is most likely a BLE_GAP_SEC_STATUS_TIMEOUT, which is a timeout that can occur during pairing when the device you are trying to pair to do not respond within a predefined time. This time is defined in the Bluetooth specification and is set to 30 seconds. The normal response to this error is to retry the pairing process.

  • I agree. After removing the pm code and just doing normal connect logic with service discovery I'm getting the GATTC timeout on service discovery. After some digging it looks like my Android phone is treating the bonded connection as a connection with a peripheral, rather than a connection AS a peripheral. After my central connects to the phone the phone (at the OS level) continuously tries to bond with my device assuming my device is a peripheral. I have a non-connectable peripheral for advertising as well as a central on my Noridc device and it appears as if Android gets confused. After removing the secure bonding all is well. I still get the service discovery timeout but after a retry it seems to work just fine.

Reply
  • I agree. After removing the pm code and just doing normal connect logic with service discovery I'm getting the GATTC timeout on service discovery. After some digging it looks like my Android phone is treating the bonded connection as a connection with a peripheral, rather than a connection AS a peripheral. After my central connects to the phone the phone (at the OS level) continuously tries to bond with my device assuming my device is a peripheral. I have a non-connectable peripheral for advertising as well as a central on my Noridc device and it appears as if Android gets confused. After removing the secure bonding all is well. I still get the service discovery timeout but after a retry it seems to work just fine.

Children
No Data
Related