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

Swift Pairing for custom gatt service

Hi,

I am using custom gatt service & I have included some of the code which supports swift pairing from ble_hid_mouse example. Here is my sniffer log -

mtu_log.pcapng

& the jlink rtt log -

paired - Copy.txt

For my application, the MTU size is 32 & data length is 36.

Windows keeps negotiating the size to be 512.

After I pair to the peripheral by connecting through the Windows bluetooth menu, it takes 1 minute to establish the ble connection & start data communication. If I dont pair, then the connection is quick. Now I know you will tell me the app has to make a connection. But I would also like to support manual pairing. Our device gets bricked if someone accidentally pairs with the device through Windows bluetooth menu. To avoid this I had to add the swift pairing support.

How do I expedite the connection on Windows for swift pairing? (note the same firmware without swift pairing feature works on Android OS perfectly fine with or without pairing.)

Parents
  • Hi Sonal

    You added the lines suggested in your ble_evt_handler function, correct? 

    The disconnect reason is still the same (0x2A) and is defined by the spec. as: "The Different Transaction Collision error code indicates that an LMP transaction or LL Procedure was started that collides with an ongoing transaction". 

    Please also try calling sd_ble_opt_set(BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, &opt); to trigger a LL_PING_REQ from the peripheral side.

    Best regards,

    Simon

Reply
  • Hi Sonal

    You added the lines suggested in your ble_evt_handler function, correct? 

    The disconnect reason is still the same (0x2A) and is defined by the spec. as: "The Different Transaction Collision error code indicates that an LMP transaction or LL Procedure was started that collides with an ongoing transaction". 

    Please also try calling sd_ble_opt_set(BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, &opt); to trigger a LL_PING_REQ from the peripheral side.

    Best regards,

    Simon

Children
  • Yes Simonr, I added all the above 4 lines & I attached the corresponding logs in my previous reply.

    case BLE_GAP_EVT_CONNECTED:
    			NRF_LOG_DEBUG("Connected.");
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
    			
    			opt.gap_opt.auth_payload_timeout.conn_handle = m_conn_handle;
    			opt.gap_opt.auth_payload_timeout.auth_payload_timeout = 3000;
    			err_code = sd_ble_opt_set(BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, &opt);
    			APP_ERROR_CHECK(err_code);		
    		
    			connection_tx_power_set();	/* +4dB Radio Setting */
    			/*SET CONN PIN HIGH AFTER BLUETOOTH CONNECTION*/
    			nrf_gpio_pin_set(0);  
    			/*AFTER BLUETOOTH CONNECTION, SET THE FLAG HIGH*/
    			ble_connected = true;
    			NRF_LOG_DEBUG("Connected to %x:%x:%x:%x:%x:%x\r\n", p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[0]);
    			/*Testing*/
    			// only trigger event if more than 3 rssi samples have deviated from the last reported rssi by 10db or more
         		// sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count))
    			sd_ble_gap_rssi_start(m_conn_handle, 10, 3);	/*rssi*/ //Print RSSI every time it changes with more than 10dB
                break;

    But that did not solve the issue.

Related