BLE event handler

I am currently using two nRF52840s to create a transmitter, one that acquires data and transmits it as advertisement data, and a receiver that receives data from the advertisement data.
The transmitter's configuration parameters are set via an NUS connection.
After starting up, the receiver starts BLE configuration and advertisement scanning, and when it finds a transmitter device, it connects to the NUS and sends parameters, and after disconnecting the NUS, it acquires data from the advertisement data.
Currently, it works as expected from startup to disconnecting the NUS, but when the NUS connection is disconnected, the ble_evt_handler, which I want to acquire advertisements from, is not executed even if I reconfigure the BLE stack and scan.

What do you think is the cause?

Parents
  • Hello,

    You are using the nRF5 SDK (v17.1.0)?

    So your peripheral is advertising, you can connect to it, and you can continue to see advertisements from the peripheral after disconnecting (e.g. if you scan using your phone)? However, on the central, you can't find the advertisements from the peripheral after you disconnect. Is that the case?

    In your ble_evt_handler(), it is possible to receive events on every advertisement scanned. To do so, you can add to the switch case in ble_evt_handler() : 

            case BLE_GAP_EVT_ADV_REPORT:
                // Do something
                break;

    So depending on what you want to filter on, you can implement this directly here. 

    I don't know what you initially were looking for in the ble_evt_handler()? Did you have some filtering, and e.g. the NRF_BLE_SCAN_EVT_FILTER_MATCH event in your ble_evt_handler? If so, what filtering were you using?

    And after the disconnection, did you change anything in the advertisement of the peripheral?

    Best regards,

    Edvin

Reply
  • Hello,

    You are using the nRF5 SDK (v17.1.0)?

    So your peripheral is advertising, you can connect to it, and you can continue to see advertisements from the peripheral after disconnecting (e.g. if you scan using your phone)? However, on the central, you can't find the advertisements from the peripheral after you disconnect. Is that the case?

    In your ble_evt_handler(), it is possible to receive events on every advertisement scanned. To do so, you can add to the switch case in ble_evt_handler() : 

            case BLE_GAP_EVT_ADV_REPORT:
                // Do something
                break;

    So depending on what you want to filter on, you can implement this directly here. 

    I don't know what you initially were looking for in the ble_evt_handler()? Did you have some filtering, and e.g. the NRF_BLE_SCAN_EVT_FILTER_MATCH event in your ble_evt_handler? If so, what filtering were you using?

    And after the disconnection, did you change anything in the advertisement of the peripheral?

    Best regards,

    Edvin

Children
No Data
Related