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

To be in Non-scannable non-connectable mode

Hi, 

I am on SDK 15.2 and NRF52832. I think that I am quite stupid because I do not succeed to be in Non-scannable non-connectable mode.

I tried few stuffs, change directly the line from the ble_advertising_init from ble_advertising library like that : 

p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;

But I am still at the same point. I Have tried also to add these lignes after the ble_advertising_init call in my advertising_init function : 

err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    //We modify few parameters from ble_advertising_init //AKR
m_advertising.adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
ret = sd_ble_gap_adv_set_configure(&m_advertising.adv_handle, NULL, &m_advertising.adv_params);

But even with these changes, when I use some sniffers, like NRF connect, I can see that I can connect to my device, and I have a scan response. 

Can you help me?

  • I would like to advertise data in non connectable and non scannable mode, and to update it when I receive new data from UART bus. 

    What are you using the "Copy advertising data" function for exactly?

    If you are talking about the Copy advertising data, there is first the initialization of my handle if it is not made, then I put 31 in len, because it is an imput parameter of the encode function, to  specify the maximum size, and finally I will encode my advertising data. 

    Have you checked (by debugging) that the FAST and SLOW if-loops you are using are executed as expected in your init function?

    Yeah, it works well. 

  • Oh, I am so stupid, It works actually. I think it was a bug with my hardware, after debug mode. But if you have some advices, to clean my code, i am open. 

  • Hi

    Glad you got it working! Depending on what tool you're using to flash your device, you should make sure you erase the flash on your chip before flashing. To make sure the device isn't in debug mode after you've flashed the device, you should power cycle it to make sure you exit from debug mode. 

    I don't see any flaws with the way your advertising is set up, so if it's working as intended now, I think you're good.

    Best regards,

    Simon

Related