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

Receiving 2 advertising event per event on pc-ble-driver-py

Hello everyone, 

I am using the pc-be-driver-py library to start a scanning with IRK and I view the advertising events that I get. My peripheral is configured to do 1 advertising every second however when I view the advertising events, I see 2 that come together (seperated with 1ms) and having a different advertising type, that's an example:

[09:19:45.526] EVT_ADV_RECEIVED: address: 0x4770BE5FF24F, rssi: -40,peer_addr_type: Types.random_private_resolvable, adv_type: BLEGapAdvType.connectable_undirected
[09:19:45.529] WaitForEvent(): Event EVT_ADV_RECEIVED is received

[09:19:45.530] EVT_ADV_RECEIVED: address: 0x4770BE5FF24F, rssi: -39,peer_addr_type: Types.random_private_resolvable, adv_type: None

It was never a problem for me since I never needed to use the advertising type, but now that I do, I need to at least understand why the type passes from connectable_undirected to None, 

Thank you

  • Hello,

    Can you see the content of the packets? Are they the same, or different? Can you also see what channels they are coming on? I suspect that what you are seeing is an scan response. Does your peripheral/beacon have a scan response?

  • Hi, thank you for responding. My peripheral doesn't send a scan response and doesn't send advertising data either, however I think that the function ble_gap_connect() of the driver keeps the scan going. What I don't understand is why the advertising type is not the same knowing that the adress is the same so we are sure that it is tha same device. Is it a property of the softdevice? thank you

  • I suggest that you try to sniff the data. Have you tried the nRF Sniffer?

    I still didn't quite catch the answer of the questions that I had. The question you had is why you see two advertising reports, but only do one advertisement every second, right? Did you check the data in each of the advertisements? Is it the same event handler triggered twice, or is this logs from two different event handlers on the same advertisement?

  • I never used nRF sniffer. For the data, as I said, the peripheral is configured not to send any. The log I've sent you are generated from the same event Handler (I used the on_gap_evt_adv_report() from the library so having 2 advertisings shown means the event was triggered twice. Please tell me what are the data that you need me to verify with the sniffer if it could be any help , thank you

  • Imen said:
    Please tell me what are the data that you need me to verify with the sniffer if it could be any help , thank you

     Just try to capture a sniffer trace, and save it as a pcapng file and upload it here. This is what I want you to do with the nRF Sniffer.

    With your project, you can also try to print the data (not using the sniffer): 

    Edvin said:
    The question you had is why you see two advertising reports, but only do one advertisement every second, right? Did you check the data in each of the advertisements?

     Can you try to print the p_data in each event? I don't know where this callback is (I can't find it), but I am not that used to microsoft visual studio, which I use for pc-ble-driver. I assume it is quite similar to the normal SDK events, and the on_adv_report in main.c of e.g. the heart_rate_collector example (is that the example that you use?)

    Try to add this to your event handler:

        printf("Advertisement len: %d, data:", p_ble_gap_evt->params.adv_report.data.len);
    	for (uint8_t i = 0; i < p_ble_gap_evt->params.adv_report.data.len; i++)
    	{
    		printf("%02x:", p_ble_gap_evt->params.adv_report.data.p_data[i]);
    	}
    	printf("\n")

    What does your log say then?

Related