Nimble server ble disconnection reason 531

Zubize
Posts: 1
Joined: Wed Oct 19, 2022 7:40 pm

Nimble server ble disconnection reason 531

Postby Zubize » Wed Oct 19, 2022 7:53 pm

Hi guys, i'm use a nimble server from version v4.4.2 release IDF framework. When i connect my PC Windows 11 to the device in a first Time my device esp32 paired my PC but immediatly after the connection the remote device close the connection.

Where is the error?

My ESP32 logs:
I (3365849) BLEDevice: connection established; status=0; handle=0
I (3365849) BLEDevice: handle=0 our_ota_addr_type=0 our_ota_addr=a6:d3:62:d1:8:f0
I (3365859) BLEDevice: our_id_addr_type=0 our_id_addr=a6:d3:62:d1:8:f0
I (3365869) BLEDevice: peer_ota_addr_type=0 peer_ota_addr=8d:e0:77:cb:77:4c
I (3365879) BLEDevice: peer_id_addr_type=0 peer_id_addr=8d:e0:77:cb:77:4c
I (3365879) BLEDevice: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=0 authenticated=0 bonded=0

I (3366459) BLEDevice: connection updated; status=0
I (3366469) BLEDevice: GAP connection find; handle=0
I (3366629) BLEDevice: encryption change event; status=0
I (3366629) BLEDevice: handle=43984 our_ota_addr_type=17 our_ota_addr=80:f0:bf:fe:3f:0
I (3366629) BLEDevice: our_id_addr_type=0 our_id_addr=00:0:0:0:0:0
I (3366649) BLEDevice: peer_ota_addr_type=0 peer_ota_addr=00:0:23:f:6:0
I (3366649) BLEDevice: peer_id_addr_type=0 peer_id_addr=00:0:0:0:3c:68
I (3366659) BLEDevice: conn_itvl=32785 conn_latency=49152 supervision_timeout=16382 encrypted=0 authenticated=0 bonded=0

I (3366679) BLEDevice: mtu update event; conn_handle=0 mtu=256
I (3366839) Characteristic: Access to BATTERY_CP[20]
I (3366849) Characteristic: Read original: 100
I (3366929) Descriptor: Reading descriptor: 01-0
I (3366979) BLEDevice: disconnect; reason=531
I (3366979) NimBLE: GAP procedure initiated: advertise;
I (3366979) NimBLE: disc_mode=2
My code, nimble init:

Code: Select all

        ble_hs_cfg.sync_cb = blehr_on_sync;
        ble_hs_cfg.reset_cb = blehr_on_reset;
        ble_hs_cfg.sm_sc = 0;
        ble_hs_cfg.sm_bonding = 1;
        ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
        ble_hs_cfg.gatts_register_arg = this;
        ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
        ble_hs_cfg.store_status_arg = this;
        ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_NO_IO;

        // authentication request
        ESP_LOGW(LOG_TAG, "Passkey actived: %d", mPasskey);
        if (mPasskey>0) // This is 1234
        {
            ble_hs_cfg.sm_bonding = 1;
            ble_hs_cfg.sm_mitm = 1;
            ble_hs_cfg.sm_sc = 1;
            ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID;
            ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID;
            ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_DISP_ONLY;
        }

Zeni241
Posts: 86
Joined: Tue Nov 20, 2018 4:28 am

Re: Nimble server ble disconnection reason 531

Postby Zeni241 » Sat Nov 12, 2022 2:46 pm

May be there is some mistake while accessing services and characteristics. Check the UUIDs you are using on client and server side matches. Also check you are not trying to read or write to a characteristic which is not configured for that.

Who is online

Users browsing this forum: No registered users and 306 guests