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

Connect a peripheral always with the same central when an event is produced

Hi,

I am developing an application that needs to activate a relay on a central device when an event occurs on the peripheral device.
The peripheral will always connect to the same
central device.
I need direct communication because there will be more central-peripheral modules with the same functions in the vicinity.
I have studied the example "ble_app_hids_keyboard" and I see that it uses whitelist.
After reading several articles on DevZone, I can't quite understand how data is entered into lists (whitelist_set ()).
Is it possible to use direct communication with the same central device without using whitelist?
How do I enter the ID of the central device in the peripheral the first time? I can use a switch the first time to syncronice peripheral/central if it is necessary.
Both the peripheral and the central are powered by batteries.
Once the ID of the central device has been entered in the peripheral, when changing the batteries, will the ID of the central device disappear on the peripheral?
In this case, is it necessary to use an external E2PROM to save the ID or is it saved directly to the internal flash?

Thanks in advance and Merry Christmas
Parents
  • 
    Hi,

    For the same project, I need to know where I can find information about the following:
    1) How to generate a random ID in the central when powering up for the first time
    2) How to store in the peripheral the ID received from the central in the first connection
    In the example "ble_app_hids_keyboard" it is not clear how to save in the peripheral the ID received from the central.
    I have tried to advertise the central in direct mode and it automatically switches to fast mode because it does not find any stored ID

    Best regards
    Juan

  • Hi,

    1) Our examples already uses a random address by default, and this address is unique to each device (DEVICEADDR).  But you can also change to a different address through the sd_ble_gap_addr_set() call once the Softdevice is enabled.

    2) You need to pair/bond with the peripheral. The peer manager will then store the ID information to flash.

    You can use our nRF connect app on Android or iOS to test with if your central doesn't support bonding yet.

    Best regards,

    Vidar

Reply Children
No Data
Related