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

Example for Extended advertisement receive node

Hi, 

I am using nrf SDK 1.9.0 and want to receive extended advertisements on a device (nrf52832) but I didn't got any example. Do you have any sample? 

Parents
  • Hi Ashish, 

    Which feature of extended advertising are you planning to do ? 

    You just need to add CONFIG_BT_EXT_ADV=y in the project config to allow scanning in extended advertising. 
    You would also need .type     = BT_LE_SCAN_TYPE_ACTIVE if you plan to do active scanning. 
     I would suggest to have a look at the central_hr_coded example. In the example we scan for CODED PHY extended advertising. 

  • I just wanted to send around 60 bytes in the secondary channel.

    I modify the example "periodic_adv" and setting the data as bt_le_ext_adv_set_data(adv, NULL, 0, ad, ARRAY_SIZE(ad))

    periodic_advCopy.zip

    I can not see data using central_hr_coded as I assume it need to be connected.

    Whereas, this would be broadcast extended messages. 

Reply Children
  • Hi Ashish, 

    If you simply want to send larger data (60bytes)  you don't need to use periodic advertising. I don't think the central_hr_coded would support periodic advertising. You would need to use periodic_sync central application for that. 

    If you want to test advertising with long packet, please have a look at the multiple_adv_sets example. The connectable advertising set is using extended advertising. 

    I would suggest to use a phone to scan for the packets before testing with NRF52 as the scanner. The central_hr_coded wouldn't work out of the box as the generic scanner, you would need to change scanning to 1MBps instead of CODED PHY and remove connect_if_match=1 to avoid connection. 

  • Hello Hung,

    Just to remind you that I am not using periodic advertisement but only the extended advertisement.

    I tried to use multiple_adv_sets example. 

    I am new to BLE so, as per my understanding there is no example in Nordic to scan the extended advertisement. Of course reading Primary channel is easy but I am trying to check the secondary channels. I am not sure if nRF connect app can read it as I read in devzone that sniffer does not.

  • Hi Ashish, 

    I attached here the code I modified to show how extended advertising can be scan. I based on the central_hr_coded but the advertising is on 1Mbps not CODED PHY. You can testing using nRF52832 dk. 

    You should see something like this in the log of the central: 

    Note that nRF Sniffer and many phones can scan for extended advertising. Please check your phone capability. 

    7571.central_hr_coded_universal.zip

    0537.peripheral_hr_coded_extended.zip

  • Hi Hung,

    Thanks for the code and verification. I see I have the same output. However to understand it better with compare to periodic_adv example, I see we need to add filtering using bt_scan_filter_add() and you added it based on UUID.

    So, I have one question:

    1) Why do we need this filtering? Is it not possible to get a message call back for all the messages received by this device? And can we just send the BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 40) in the advertisement (similar to periodic_adv example) without the filtering?

  • Hi Ashish, 

    The scan filter was there in the original code so I didn't modify it. The reason I kept the filter code is that there are many advertisers in my work so I need some filter otherwise I won't be able to see the advertising packet I want to see. 

    If you don't plan to use a filter you can use "scan_filter_no_match" callback. 
    I have a blog post here that you may want to have a look. Quoted from the blog: 

    If you are scanning without filter, then you need to define a "scan_filter_no_match" callback and you will receive a call back for every single advertising packet received. 

Related