nrf_ble_gq: SD GATT procedure (2) failed on connection handle 0 with error: 0x00000007.

When using the nrf52832 to scan and connect to a BLE central device, the first connection is successful. However, after the first connection is disconnected and I attempt to connect again, an error occurs (error> nrf_ble_gq: SD GATT procedure (2) failed on connection handle 0 with error: 0x00000007). Then the system restarts. After the system restarts, BLE connections can be established normally again。

void qr_scan_init(void)
{
  ret_code_t err_code;
  nrf_ble_scan_init_t init_scan;
  memset(&init_scan, 0, sizeof(init_scan));
  init_scan.connect_if_match = true; 
  init_scan.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
  init_scan.p_scan_param = &gap_scan;
  err_code = nrf_ble_scan_init(&QR_scan, &init_scan, scan_evt_handler);
  APP_ERROR_CHECK(err_code);
}

I used init_scan.connect_if_match = true; to automatically connect after a scan match. The strange thing is, the first connection always works normally after a system reset. However, after the first connection is disconnected, subsequent connection attempts result in this error.

Related