Directed advertising - peer address

Hello everyone

I am using BLE Peripheral UART and Central UART samples to send data between two nrf5340 dev. kits.

I'm trying to set the directed advertising on the peripheral, so it accepts only connections request from my peer, but I can't find, in which format should i set the address of the central. I tried to change it this way in peripheral main, but it did not connect.

err = bt_le_adv_start(((struct bt_le_adv_param[]) { 
{ .id = BT_ID_DEFAULT, .sid = 0, .secondary_max_skip = 0, 
.options = (BT_LE_ADV_OPT_CONNECTABLE), .interval_min = (0x00a0), 
.interval_max = (0x00f0), .peer = {0xF0,0x33,0x4D,0x3A,0x9F,0x6B}, } }),
ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

I am also a little bit confused of the Bluetooth LE Device Adress in addr.h library.

/** Bluetooth Device Address */
typedef struct {
	uint8_t  val[BT_ADDR_SIZE];
} bt_addr_t;
/**/

/** Length in bytes of an LE Bluetooth address. Not packed, so no sizeof() */
#define BT_ADDR_LE_SIZE 7
/** Bluetooth LE Device Address */
typedef struct {
	uint8_t      type;
	bt_addr_t a;
} bt_addr_le_t;

What does the variable type mean and in which way should I write the bt_addr_t?

Here is the log from J-Link RTT Viewer

00> [00:00:00.272,583] <inf> fs_nvs: 2 Sectors of 4096 bytes
00> [00:00:00.272,583] <inf> fs_nvs: alloc wra: 0, fc8
00> [00:00:00.272,583] <inf> fs_nvs: data wra: 0, 2c
00> [00:00:00.300,354] <inf> bt_hci_core: No ID address. App must call settings_load()
00> [00:00:00.300,354] <inf> peripheral_uart: Bluetooth initialized
00> [00:00:00.949,981] <inf> peripheral_uart: Connected F0:33:4D:3A:9F:6B (random)
00> [00:00:01.664,978] <wrn> peripheral_uart: Failed to send data over BLE connection

Could please somebody help me or give me any advice?

Sorry for maybe stupid questions, I am just beginner and did not find it anywhere.

Parents
  • Hi,


    Before we start digging into potential guides and tutorials I need to know which SDK and version of that SDK you are working with. Could you supply me with that information?
     
    And don't worry about this being a stupid or beginners question. The information can be hard to find at first if you don't quite know where to look, so I'll do my best to help you find it!

    Kind regards,
    Andreas

Reply
  • Hi,


    Before we start digging into potential guides and tutorials I need to know which SDK and version of that SDK you are working with. Could you supply me with that information?
     
    And don't worry about this being a stupid or beginners question. The information can be hard to find at first if you don't quite know where to look, so I'll do my best to help you find it!

    Kind regards,
    Andreas

Children
Related