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

Two centrals both scanning

I have two nRF52832 side by side scanning for advertisement with filter by name. Because I will have a number of peripherals advertising, so I want to have multiple centrals to serve them. I notice both centrals will connect to the same device, and one connection eventually timeouts and one connection succeeds. The one that fails take a little longer like 500 to 600 msec to connect, while the good one take 20 to 30 msec to connect. How can I make a earlier detection it is not a real connection so that it can scan for the next peripheral?

Bad one:

[01:51:46.648,925] <debug> ble_scan: Scanning
[01:51:46.690,917] <debug> ble_scan: Connecting
[01:51:46.690,917] <debug> ble_scan: Connection status: 0
[01:51:47.326,171] <debug> nrf_ble_gatt: on_connected_evt
[01:51:47.326,171] <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.

Good one:

[01:51:30.124,023] <debug> ble_scan: Scanning
[01:51:46.173,828] <debug> ble_scan: Connecting
[01:51:46.173,828] <debug> ble_scan: Connection status: 0
[01:51:46.197,265] <debug> nrf_ble_gatt: on_connected_evt
[01:51:46.197,265] <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.

Thanks.

Parents
  • two nRF52832 side by side scanning for advertisement

    You mean they are physically located together - on the same board, or in the same enclosure?

    Perhaps you could make one of them the "master" and have it decide which of the two nRF52832s is to attempt to make the connection to each peripheral ?

  • The two centrals are in the same enclosure. Actually, I am surprise the second central can connect to it after the first one since the peripheral should stop the advertisement after the connection. I saw from the MultiPeripheral example, that when NRF_SDH_BLE_PERIPHERAL_LINK_COUNT is set to more than 1, a peripheral can connect to multiple centrals at the same time? Not sure how the advertisement work in that case.

    The peripheral is a third party device so I have little control over the parameters. I hope to find something in the Central side which is my Nordic code to tell if it is the second connection or invalid connection, and abort from it.

  • I am surprise the second central can connect to it after the first one since the peripheral should stop the advertisement after the connection.

    Of course, they will both see the advertising.

    Then they might both try to initiate connecting at the "same" time - but only one will actually succeed to fully establish the connection. The other one will just time out, because the peripheral will not accept the connection.

    I would guess that you are getting a BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED - as described here: https://devzone.nordicsemi.com/f/nordic-q-a/40808/connect-procedure-and-the-disconnect-reason-0x3e-ble_hci_conn_failed_to_be_established ?

    I hope to find something in the Central side which is my Nordic code to tell if it is the second connection or invalid connection,

    Again, I think you need one of your Centrals to make the decision on which of the two is to initiate the connection.

    Or, maybe, a 3rd processor to make the decision?

    Or perhaps you could have only one of them scanning - and it will tell the other the necessary details of the peripheral(s) for it to connect to ?

Reply
  • I am surprise the second central can connect to it after the first one since the peripheral should stop the advertisement after the connection.

    Of course, they will both see the advertising.

    Then they might both try to initiate connecting at the "same" time - but only one will actually succeed to fully establish the connection. The other one will just time out, because the peripheral will not accept the connection.

    I would guess that you are getting a BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED - as described here: https://devzone.nordicsemi.com/f/nordic-q-a/40808/connect-procedure-and-the-disconnect-reason-0x3e-ble_hci_conn_failed_to_be_established ?

    I hope to find something in the Central side which is my Nordic code to tell if it is the second connection or invalid connection,

    Again, I think you need one of your Centrals to make the decision on which of the two is to initiate the connection.

    Or, maybe, a 3rd processor to make the decision?

    Or perhaps you could have only one of them scanning - and it will tell the other the necessary details of the peripheral(s) for it to connect to ?

Children
Related