Simple Bluetooth Pairing using a Button, based on peripheral_uart example, not working

Hi guys,

I am trying to implement the possibility to have one central device made with a nrf52840DK and a peripheral with another nrf52840DK.

As I could have more nrf52840DK with the same BLE Name, I wanted to pair one particoular DK to the central, and be able to connect only to that board.
So, as I found bonding examples in the classic central_uart example, and in the perpheral example, I wanted to know how to use that part of the code, to implement this simple situation.


I am using the simple example of central_uart and peripheral_uart, I have went deep inside the KConfigs related, but I'm not able to see the activation of callbacks called 

	err = bt_conn_auth_cb_register(&conn_auth_callbacks);
	if (err) {
		printk("Failed to register authorization callbacks.\n");
		return;
	}

	err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks);
	if (err) {
		printk("Failed to register authorization info callbacks.\n");
		return;
	}


even if they are configured properly, in the main() ...... is it normal ?
I also added, trying to check if it was a problem of KConfigs, this:

CONFIG_BT_NUS_SECURITY_ENABLED=y
CONFIG_BT_SMP=y

in the conf file, but nothing happens.

the callbacks are registered properly, but they are not called.
And the central connects without any pariring request to the peripheral.

I also tryed with nRF connect for iPhone, but the same result: directy connected to the peripheral.


Starting Nordic UART service example
*** Booting Zephyr OS build v3.2.99-ncs2 ***
[00:00:00.014,984] <inf> fs_nvs: 8 Sectors of 4096 bytes
[00:00:00.015,075] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.015,106] <inf> fs_nvs: data wra: 0, 0
[00:00:00.015,441] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            d8 0c 2d 2f 36 ae e2 5c  80 26 80 4c 3f 4d 16 53 |..-/6..\ .&.L?M.S
                                            50 96 c7 73                                      |P..s             
[00:00:00.023,529] <inf> bt_hci_core: No ID address. App must call settings_load()
[00:00:00.023,529] <inf> peripheral_uart: Bluetooth initialized
[00:10:49.892,028] <inf> peripheral_uart: Connected F5:A0:02:E4:32:BC (random)

 

I think it's a child game, but I'm not able to continue... 

Related