This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Central and a custom peripheral device

Hi,

Can the central device (ble_app_hrs_c for example) scan for and connect to a custom peripheral device (not nRF based)?

  • How to achieve that? Because the ble_evt_dispatch() function gets called only with the nRF based peripheral.

  • No, it is called by your BLE stack (Nordic Soft Device) when any relevant event happens. There is no way to find out if adv. device is running from Nordic chip or not (you can put some string into data and claim it as proof but I can take any other BLE chip and fake it, in general no way to tell the difference).

    To ble_app_hrs_c example: what I see in nRF SDK v13.0.0 is that once it starts scanning it gets BLE_GAP_EVT_ADV_REPORT and there it looks for any device which has either specific Adv. address or Device Name AD object in the data or Service UUID in the data. So as long as your peripheral meets one of these criteria ble_app_hrs_c example should find it and connect to it. And if you enable logging on that event you will see Adv. reports from ANY BLE peripheral in the range (again regardless if it is Nordic example running on Nordic chip or anything else...)

  • Well that's not how the central works in my case. The BLE_GAP_EVT_ADV_REPORT event happens only when I turn on the nRF peripheral device with the ble_app_hrs example (or any other peripheral example). With any other BLE peripheral device, even with the matching advertising name, address or UUID, the ble_evt_dispatch() function never gets called...

  • This example has pretty complex functionality as it bonds with the peer and establishes security (from what I see). Isn't it so that you've connected these two boards/FWs together once and then scanner/central looks for its peer only? I see there is whitelist used at some point which would explain that it sees only particular peer (running sensor example). If you re-flash the board, do you see different adv. reports? Have you added some NRF_LOG_xxx right after case BLE_GAP_EVT_ADV_REPORT: ? Because if not then you won't see all reports on UART, there are logging functions only for these which matches one of conditions (specific hardcoded Adv. address, Device Name or Service UUID in Adv. data...)

Related