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

Intermittent Advertisement Reception

I am getting intermittent pickup of advertising packet from a peripheral known to advertise every 2 second.  Basically I get ~20 sec gaps where nothing is received.

Below is my debug output from my central app where I output a dot  each time the BLE_GAP_EVT_ADV_REPORT event is fired.   I only output an exclamation sign when peer address matches a hardcoded address for the peripheral advertising every 2 second.

The dots are pretty constant based on other surrounding devices, and the regular 2 exclamation signs are the advertising packet and the scan response, as expected.

What is strange is the gap in time (~20s) where other devices are still recieved, but nothing is received from that particular device. That pattern repeats regularly.

I have verified with NRFconnect that the devices is in fact advertising even in these gaps.

I'm using SD 132 and SDK 15.3 on  PCA10040.  I checked that channel_mask is all zeroes, thinking it might be channel related...

.......................!.!................!.!.................!.!................!.!................!.!...............!.!................!.!..............!.!..............!...............................................................................................................................!.!..............!.!................!.!................!.!......................!.!.....................!.!...............!.!.................!.!......

.......................!.!................!.!.................!.!................!.!................!.!...............!.!................!.!..............!.!..............!...............................................................................................................................!.!..............!.!................!.!................!.!......................!.!.....................!.!...............!.!.................!.!......

.......................!.!................!.!.................!.!................!.!................!.!...............!.!................!.!..............!.!..............!...............................................................................................................................!.!..............!.!................!.!................!.!......................!.!.....................!.!...............!.!.................!.!......

Parents
  • Hi

    This seems very strange. First thing I'm noticing is that the last event before the "pause" only provides one exclamation mark, so there is no scan response coming. Are you able to see what happens after that last event? And even if an error occurs there, I don't see why it would take 20 seconds to start receiving advertisements again. I am guessing there is a timeout or that the central is going to sleep in some way, but it's really hard to tell when I don't know more about your application. 

    Are the peripheral and central both nRF52832DKs? Are you building the application based on any of the examples in the SDK, in that case, what examples, and what exactly have you changed (if anything)?

    Best regards,

    Simon

Reply
  • Hi

    This seems very strange. First thing I'm noticing is that the last event before the "pause" only provides one exclamation mark, so there is no scan response coming. Are you able to see what happens after that last event? And even if an error occurs there, I don't see why it would take 20 seconds to start receiving advertisements again. I am guessing there is a timeout or that the central is going to sleep in some way, but it's really hard to tell when I don't know more about your application. 

    Are the peripheral and central both nRF52832DKs? Are you building the application based on any of the examples in the SDK, in that case, what examples, and what exactly have you changed (if anything)?

    Best regards,

    Simon

Children
  • I'm using the ble_center "experimenta" CLI example, and have basically only added the logging.

    Inside the BLE GAP event handler for the case: BLE_GAP_EVT_ADV_REPORT,  I have inserted the below (m_scan_substring is just taking as an arg from scan on command).

    if (m_scan_substring) {
      ble_gap_addr_t *addrp;
      addrp = &p_gap_evt->params.adv_report.peer_addr;
      sprintf(str,"%02X%02X%02X%02%02X%02X",addrp->addr[0],addrp->addr[1],addrp->addr[2],addrp->addr[3],addrp-addr[4],addrp->addr[5]);
      if (strstr(str,m_scan_substring)) {
              NRF_LOG_RAW_INFO("!");
       }
    }

    So I'm wondering if the problem is that NRF_LOG_RAW_INFO is not reliable inside the event  handler, which is presumably an active Interrupt?   Do I need to implement some sort of queue and print from that queue in the main process?

Related