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

Reinitializing advertising packet stops scanner?

I am working on a project using the nRFDK51 as BLE scanner with s130 and BLE peripheral an nrf51822 custom PCB design. The BLE peripheral is the device we are developing for sensor measurement project.

We are assigning id's to the devices during the connection. The way the id assignment works for each device is:

  1. The peripheral advertisement packet contains:
  • full name
  • manufacturer's data with Nordic company identifier(0x0059) and 8 bytes set to zero.

2)Scanner connects on name and zero manufacturer's data.

3)During connection scanner sends timestamp to peripheral

4)Peripheral acknowledges the timestamp by sending back to scanner a specific message

  1. When scanner receives this message it disconnects.

  2. Peripheral uses this timestamp as id and reinitialises the advertisement packet with 8 bytes of manufacturer's data set to timestamp and starts advertising.

This is where we encounter the problem The scanner shuts off when we reinitialize the advertisement. Instead of continuing to scan. It is definitely disconnected from the peripheral during re initialization and should be no longer able to connect to it after manuf data is changed since empty manuf data is still a criteria for connection. Why are we encountering a problem with scanner when peripheral is the device changing its packet during disconnection? Also, the peripheral continues advertising with new manuf data with no problem.

To debug, I reinitialize it to zero again, it causes no problem since it same as original. Thus, the problem causing the scanner shut off is not reinitializing function but with changing the manuf data from what it originally was. I also tried a scan_start() to restarting scanning, but it didn’t work.

It looks like scanner saves address of periph and its advertsing packet, and when that changes it causes a SystemReset or NVICSystemReset().

Any suggestions on what problem might be? Do you know if scanner remembers peer's advertising parameters and uses them for future connections and how a scan “refresh” or restart can be made?

Parents
  • The line where the application was failing is in is_manuf_data_present() function call here:

    memcmp(adv_data, manuf_data, manuf_data_length).
    

    The problem was that I didnt pass address in memcmp of the both adv_data and manuf_data values.

    Just for clarification the function is supposed to be written as:

    memcmp(&adv_data, &manuf_data, manuf_data_length)
    
Reply
  • The line where the application was failing is in is_manuf_data_present() function call here:

    memcmp(adv_data, manuf_data, manuf_data_length).
    

    The problem was that I didnt pass address in memcmp of the both adv_data and manuf_data values.

    Just for clarification the function is supposed to be written as:

    memcmp(&adv_data, &manuf_data, manuf_data_length)
    
Children
No Data
Related