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)?

  • The FW on a peripheral device doesn't have to be the heart rate example, any other peripheral example will do the same thing. Yes, I've added NRF_LOG_xxx inside of the case BLE_GAP_EVT_ADV_REPORT:, at the beginning of the on_ble_evt() function and inside of the ble_evt_dispatch() function. I see this logs only when the nRF peripheral device is turned on (with any of the peripheral examples), so I assume it has to be something with the SoftDevice? Re-flashing the central FW didn't help.

  • Reflashing only the central application wouldn't remove the bonds that have the information used in the whitelist. You need to either erase the complete flash, or hold Button 2 on the nRF5x DK on reset.

  • @mtudan btw.I cannot compile ble_central\ble_app_hrs_c from nRF5 SDK v13.0.0 because code size exceeds limit in Keil for free/evaluation license but I took ble_central\ble_app_uart_c project and by adding following code to line #422 of main.c (right after case BLE_GAP_EVT_ADV_REPORT: { ) I can now observe load of adv. reports captured in the console.

        printf("on_ble_evt(BLE_GAP_EVT_ADV_REPORT):\r\n");
        if (p_gap_evt->params.adv_report.dlen > 0) {
            printf("[0x%02X", p_gap_evt->params.adv_report.data[0]);
        }
        for(uint32_t index = 1; index < p_gap_evt->params.adv_report.dlen; index++) {
            printf(":0x%02X", p_gap_evt->params.adv_report.data[index]);
        }
        if (p_gap_evt->params.adv_report.dlen > 0) {
            printf("]\r\n");
        }
    
  • @endnode thanks for the info. I found it really easy to scan for a custom peripheral device with the ble_app_hrs_c example. Just disable the whitelist and enable active scanning mode in the scan_start() function:

    m_scan_param.active   = 1;
    m_scan_param.use_whitelist  = 0;
    m_whitelist_disabled = true;
    
  • Great. Can you then mark the right answer and close the question?:)

Related