Connection terminated by remote user, why?

Dear All

I tried to connect to an apple device, it is successful but soon after that, it is disconnected with reason code 0x13 - terminated by remote user, I tried to change the connection parameters to its preference, and disconnection still happens . Here is the log file using nrf connection desktop as suggested by the post here connection parameters ,  sorry I accidently closed the ticket, so have to open a new discussion here. The MAC address of the device is AC233F8153CE, the connection/disconnection happens at the end of logs. Can someone have a look at it and let me know the reason please?

Thank you.

Ping 

2022-06-14T11_22_34.031Z-log.txt

Parents Reply
  • PingISTL said:
    See the attachment please. It was caught a few days ago,

    Here we can see the central do a service discovery, does read requests, enables notifications, etc. So the activity here likely makes the connection stay alive. If there is no activity, you just connect, the slave in the other sniffer trace seems to detect that, and deliberately disconnects after a timeout period with no activity. 

Children
  • possibly, but some other peripherals do not do that - just stay connected even no activities going on. 

    I am about to do service discovery immediately after connection, have a question here - how do I determine which service UUID I pass to the discovery manager? for this particular one, it seems advertising manufacturer data which has its own manufacturer ID and 128 bits service UUID, so I presume I need to know the manufacturer's advertising data protocol ? is this published somewhere?

    Thank you for your patience!

    Ping

  • Probably easiest is to use e.g. nRF Connect Desktop BLE app, or nRF Connect for mobile app, connect to the device, and check out the services and UUIDs.

  • I am developing a central app - a generic one applies to all peripherals hopefully, so need to figure out what other centrals do in terms of findings all services and UUIDs - there must be a procedure/way for these centrals like nRF Connect to follow to find all services available from any peripheral without knowing its protocols already - am I right?   

    Regards!

    Ping  

  • You can use the bt_gatt_discover() API for that. From: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/bluetooth/gatt.html#generic-attribute-profile-gatt

    "Discover procedures can be initiated with the use of bt_gatt_discover() API which takes the bt_gatt_discover_params struct which describes the type of discovery. The parameters also serves as a filter when setting the uuid field only attributes which matches will be discovered, in contrast setting it to NULL allows all attributes to be discovered."

  • Hello, Sigurd

    Thank you for reply.

    I started from central BAS example, and call the following to do discovery.

    err = bt_gatt_dm_start(conn, BT_UUID_BAS, &discovery_cb, NULL);  //or NULL 
    when I pass BT_UUID_BAS as uuid, the service it found is printed as below:
    The discovery procedure succeeded
    
    ATT[1]:     UUID: 0x2803    Handle: 0x0011    Value:
    
        Characteristic: 0x2a19    Properties: 0x0012
    
    ATT[2]:     UUID: 0x2a19    Handle: 0x0012    Value:
    
    ATT[3]:     UUID: 0x2902    Handle: 0x0013    Value:
    
        CCCD
    while when I pass NULL as uuid, following attributes are found - it is the mandatory Generic Attribute(0x1801) of the peripheral rather than BT_UUID_BAS.

    The discovery procedure succeeded
    
    ATT[1]:     UUID: 0x2803    Handle: 0x0002    Value:
    
        Characteristic: 0x2a05    Properties: 0x0020
    
    ATT[2]:     UUID: 0x2a05    Handle: 0x0003    Value:
    
    ATT[3]:     UUID: 0x2902    Handle: 0x0004    Value:
    
        CCCD
    
    ATT[4]:     UUID: 0x2803    Handle: 0x0005    Value:
    
        Characteristic: 0x2b29    Properties: 0x000A
    
    ATT[5]:     UUID: 0x2b29    Handle: 0x0006    Value:
    
    ATT[6]:     UUID: 0x2803    Handle: 0x0007    Value:
    
        Characteristic: 0x2b2a    Properties: 0x0002
    
    ATT[7]:     UUID: 0x2b2a    Handle: 0x0008    Value:
    

    They are for same peripheral - the Nordic mouse one. I expect it to find all services include BT_UUID_BAS(0x180F) and another one 0x1812, and more. But it doesn't.

    Could you explain what I have done wrong please? how can I find all without knowing the UUID in advance please?

    Regards!

    Ping

Related