ESP32-WROOM NimBle cannot connect multiple clients to GATT server

User avatar
redradist
Posts: 30
Joined: Sat Apr 11, 2020 8:33 am

ESP32-WROOM NimBle cannot connect multiple clients to GATT server

Postby redradist » Sun Apr 12, 2020 4:32 am

Hi all,

I have faced with issue that using NimBle it is not possible to connect more than one client to GATT Server !!
Test was done based on esp_idf/examples/bluetooth/nimble/bleprph

I have not found how to configure NimBle stack to have multiple connections (:

Have anyone faced with the same issue ? Any help would be appreciated ...

Aussie Susan
Posts: 44
Joined: Thu Aug 22, 2019 3:48 am

Re: ESP32-WROOM NimBle cannot connect multiple clients to GATT server

Postby Aussie Susan » Mon Apr 13, 2020 4:36 am

I believe there is a parameter in the menuconfig settings for the number of connections - have you checked that?
(I say 'believe' because I've not needed to change it but I do recall seeing it there - I'm not able to check right now.)
Susan

User avatar
redradist
Posts: 30
Joined: Sat Apr 11, 2020 8:33 am

Re: ESP32-WROOM NimBle cannot connect multiple clients to GATT server

Postby redradist » Mon Apr 13, 2020 2:45 pm

Aussie Susan wrote:
Mon Apr 13, 2020 4:36 am
I believe there is a parameter in the menuconfig settings for the number of connections - have you checked that?
(I say 'believe' because I've not needed to change it but I do recall seeing it there - I'm not able to check right now.)
Susan
Thank you for relay, but I have already figured out the issue !!

It was due to this implementation:

Code: Select all

case BLE_GAP_EVENT_CONNECT:
        /* A new connection was established or a connection attempt failed. */
        MODLOG_DFLT(INFO, "connection %s; status=%d ",
                    event->connect.status == 0 ? "established" : "failed",
                    event->connect.status);
        if (event->connect.status == 0) {
            rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
            assert(rc == 0);
            bleprph_print_conn_desc(&desc);
        }
        MODLOG_DFLT(INFO, "\n");        if (event->connect.status != 0) {
            /* Connection failed; resume advertising. */
            bleprph_advertise();
        }
        return 0;
It was due to not enabling advertising back after connection was established.
Proper code should be as following:

Code: Select all

case BLE_GAP_EVENT_CONNECT:
        /* A new connection was established or a connection attempt failed. */
        MODLOG_DFLT(INFO, "connection %s; status=%d ",
                    event->connect.status == 0 ? "established" : "failed",
                    event->connect.status);
        if (event->connect.status == 0) {
            rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
            assert(rc == 0);
            bleprph_print_conn_desc(&desc);
        }
        MODLOG_DFLT(INFO, "\n");
        bleprph_advertise();
        return 0;
Thanks to @chris from https://app.slack.com/client/T5LSQUYKZ/C8QF8JMK7 that supported me and answered question !!

Who is online

Users browsing this forum: No registered users and 280 guests