This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

Connecting to only one central. How to? detailed

Hi, i know this question has been ask before but, i was reading and readind and i could find a way to do it. I got the theory but when i'm going to implement it in my code i get confused.

Starting by symple, i have 2 devices, one of this as central and one of this as peripheral.

I need the peripheral only get connected to this specific central and avoide connection to another.

1-. How i can setup an static address to my central? which part of the code i do that?

2-.I know that it is possible to create a whitelist to save bond info about the connection that has been made but i think i don't need it because i only have 1 central and just want to connect to him. wich part of the code i have to writte to set the address of my central in order to only connect to him? What would be this address, the peer addres or another one?

3-. I have read about directed advertising, what i got was that, you use direct adv when you want to connect to a specific central, but again, where do you specify that?

4-. My peripheral could be scannable but i just want my central could connect not any other device.

Maybe these are newbie question, but how i wrote above, i have read and read and i don't find a good explanation to do that.

Sorry and thanks in advance.

  • @Antonio: In the sniffer, if you click on a Connect request packet, you can find the address of the init device (Init address).

    To change the address of a nRF52 central, you can call sd_ble_gap_address_set().

  • but sd_ble_gap_address_set() in main???

  • what i am doing... in the central i am looking the specific uuid service with is_uiid_present() and it is ok, the central only connect with specific peripheral. In the peripheral i am advertising with the specific peer address, but how i change the the device address in the central in order to match with my advertising??? you said sd_ble_gap_address_set() but where? in main???

    but now

  • Another question... i was reading about peer and device manager. Peer manager is on experimental, so i will use device manager.

    you write above that i can use whitelist, i limit the number of peer devices that i want to store on my whitelist, this way if i limit to only 1, the unique device that could connect to my peripheral will be the first one.. How i can set the maximun number of peer device?where?

  • @Antonio: it's the DEVICE_MANAGER_MAX_BONDS you need to modify to 1.

    Also make sure you always advertise with whitelist (BLE_FAST_ADV_WHITELIST) after you have the address /IRK. I suggest you to get familiar to our example in the SDK, for example the proximity example, where whitelist is used.

Related