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

Can two masters connect two slaves at the same time ?

I have a question. Two slaves connect one Master. At that time, Can another Master automatically connect the two slaves ? I know softdevice110_v7 has connection state and advertizing state, but I don't know for sure.

  • Hi

    Yes, you are correct, S110 7 (BLE peripheral/slave softdevice) can be in a connection and advertise in a non-connectable state simultaneously. But a BLE peripheral can not be in a connection with two centrals/masters simultaneously.

    However, with S110 8, a nRF51 peripheral/slave can be in a connection and adverstise in scannable mode and receive RSSI signals from any centrals/masters in vicinity, therefore knowing of their presence. With that strategy, the peripheral could disconnect from master 1 and establish connection with master 2, or periodically alter connection between central 1 and central 2 and virtually have 2 connections to 2 centrals.

    Update 14.4.2015 Letting a S110 peripheral switch between two devices should not be too hard. You advertise in a scannable mode and configure the softdevice to send the application scan request reports. The following example is set up to receive scan request reports. It is made for nRF51 SDK 8.0.0 and softdevice 8.0.0. It is based on the heart rate example in SDK 8.0.0.

    ble_app_hrs_with_scan_req_report.zip

    The setup in the example is the following:

    Configure the softdevice to send the application scan request reports in the main function:

    uint32_t opt_id = BLE_GAP_OPT_SCAN_REQ_REPORT;
    ble_opt_t ble_options;
    ble_options.gap_opt.scan_req_report.enable = 1;
    ble_stack_init();
    err_code = sd_ble_opt_set(opt_id, &ble_options);
    

    Then create a switch case to receive the scan request reports in on_ble_evt:

    uint8_t rssi_value;
    ble_gap_addr_t peer_address;
    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_SCAN_REQ_REPORT:
            peer_address = p_ble_evt->evt.gap_evt.params.scan_req_report.peer_addr;
            rssi_value = p_ble_evt->evt.gap_evt.params.scan_req_report.rssi;
            break;
    }
    

    Then you need two scanners that performs active scanning, i.e. sends scan requests when advertising packets are received. You should be able to test the above example with the Master Control Panel or IOS device. They should normally send scan requests. Then set a breakpoint in the BLE_GAP_EVT_SCAN_REQ_REPORT case to see if the scan request report is received.

    To analyse how to set up and configure a nRF51 central device application that performs scan requests and connects to your device, I recommend to look at the ble_app_uart_c_120 example on Nordic's Github which is analyzed here.

  • Thanks to reply. I understand that with S110 8, peripheral don't have two masters simultaneously. But, with S110 8, peripheral can switch connection central 1 to central 2, and vice versa. Is switching between central 1 and central 2 easy ?

  • I tried what is explained here ...and looks working fine... But my peer address in the received SCAN_REQ_REPORT and device bluetooth address do not match...

    I run the code with the changes above and in my android device run NRF master control panel and hit scan button ...and with the breakpoint in the code, stops there ...to see the peer_adddress...but they do not match ...

  • Phones generally use private resolvable address. This means that the address of a central device changes and you need to resolve it with using IRK. IRK is distributed during bonding, so you need to bond. There is a function for IRK resolution in nRF5 SDK 11.0.0, im_address_resolve

Related