Periodic Advertising

Hi,

I recently started with nRF52840-DK, Zephyr and nRF Connect SDK (v. 1.9.1). I want to test extended advertising, that's why I use the periodic_adv example coming with thr SDK. Compiling and downloading without problems, I see in the terminal the printed outputs, mainly the counting of the simple counter in the example.

Using a Sodera sniffer, I see the three advertising frames in channels 37/38/39 of type ADV_EXT_IND, as well as the frame in one of the data channels (channel given in the advertising frames) of type AUX_ADV_IND (this frame includes too the device name I can set in the prj.conf).  What I don't see is the data, which I would expect to be in a frame shortly after AUX_ADV_IND.

When I use the periodic_sync example for reception, I'm informed too about the existence of a device with the given name (I assume that I'll receive only the data channels). But again, there is no data frame.

What have I missed to configure to be able to send data in the extended advertising?

Thanks!

Parents
  • Hi Axel, 


    I suspect that the sniffer was not able to follow and sync with the periodic advertising from the device. 

    I did a quick test here with the periodic_sync sample and can get this log: 

    Notice the manufacturer data increment from 1 to 3 in the log. This matched with what coded in the periodic_adv sample. 

    At the beginning when I tested the example out of the box the periodic_sync always failed immediately after the sync established. I found that it might be due to too short timeout. By default it's set to 0x0a  (100ms): 
    https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/bluetooth/periodic_sync/src/main.c#L232

    But the adv interval is 1200ms. 

    So I changed the sync_create_param.timeout to 0xa00 and can follow and capture the periodic adv data. 

  • Hi Hung Bui,

    thanks for your suggestion, which at least took me a step forward.

    Now I can find some frames of type AUX_SYNC_IND, which finally also include data. But what I see again raises questions.

    First, but minor issue: As long as the varying data part (mfg_data[2] in the example) = 0, there are no data added, the data section remains empty. Data inclusion starts with mfg_data[2] = 1. Why?

    Second issue: How can I access the data to do the output myself resp. work with the data further one? Data handling for now is hidden in the stack.

    Thanks!

  • Hi Axel, 

    axel_s said:
    As long as the varying data part (mfg_data[2] in the example) = 0, there are no data added, the data section remains empty. Data inclusion starts with mfg_data[2] = 1. Why?

    I think this happens because it's a bug in the periodic_adv code. There were no call to set the data bt_le_per_adv_set_data() before the first 10 seconds sleep elapsed. See here: 

    So only after the mfg_data[2] was increased from 0 to 1 then it will be added to the advertising data. 

    You can call bt_le_per_adv_set_data() before the while loop so that you can see the 0xff ff 00 data. 

    axel_s said:
    How can I access the data to do the output myself resp. work with the data further one? Data handling for now is hidden in the stack.

    How did you print data out ? The data handling is done inside the stack but in the application you should receive the callback .recv (recv_cb() function in periodic_sync ) and you should be able to process the data there. The same way as how we print the log out as I showed in my screenshot earlier (it's from the periodic_sync code)

Reply
  • Hi Axel, 

    axel_s said:
    As long as the varying data part (mfg_data[2] in the example) = 0, there are no data added, the data section remains empty. Data inclusion starts with mfg_data[2] = 1. Why?

    I think this happens because it's a bug in the periodic_adv code. There were no call to set the data bt_le_per_adv_set_data() before the first 10 seconds sleep elapsed. See here: 

    So only after the mfg_data[2] was increased from 0 to 1 then it will be added to the advertising data. 

    You can call bt_le_per_adv_set_data() before the while loop so that you can see the 0xff ff 00 data. 

    axel_s said:
    How can I access the data to do the output myself resp. work with the data further one? Data handling for now is hidden in the stack.

    How did you print data out ? The data handling is done inside the stack but in the application you should receive the callback .recv (recv_cb() function in periodic_sync ) and you should be able to process the data there. The same way as how we print the log out as I showed in my screenshot earlier (it's from the periodic_sync code)

Children
No Data
Related