@ESP_Prasad your observation of the peer address changing, being the cause for the bonding not persisting, makes sense. I don't know why my Android device (Samsung Galaxy S9) would change addresses, I did not restart or reset it.
To explore further, I tried using my iPhone 7 and LightBlue, the console log follow ... the peer address does not change, but the bonding is not persisted, so there has to be something else going on:
Code: Select all
--- idf_monitor on COM6 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6980
load:0x40078000,len:14044
load:0x40080400,len:4304
entry 0x400806e8
I (71) boot: Chip Revision: 1
I (71) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot: ESP-IDF v4.0-beta2-70-g0a03a55c1 2nd stage bootloader
I (39) boot: compile time 10:03:02
I (39) boot: Enabling RNG early entropy source...
I (45) boot: SPI Speed : 40MHz
I (50) boot: SPI Mode : DIO
I (54) boot: SPI Flash Size : 2MB
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (68) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (83) boot: 2 factory factory app 00 00 00010000 00100000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 1, min. application chip revision: 0
I (102) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0db00 ( 56064) map
I (131) esp_image: segment 1: paddr=0x0001db28 vaddr=0x3ffbdb60 size=0x024e8 ( 9448) load
I (135) esp_image: segment 2: paddr=0x00020018 vaddr=0x400d0018 size=0x50bec (330732) map
0x400d0018: _stext at ??:?
I (256) esp_image: segment 3: paddr=0x00070c0c vaddr=0x3ffc0048 size=0x0088c ( 2188) load
I (257) esp_image: segment 4: paddr=0x000714a0 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _WindowOverflow4 at C:/Users/ian.whitehead/Desktop/esp/esp-idf/components/freertos/xtensa_vectors.S:1778
I (263) esp_image: segment 5: paddr=0x000718a8 vaddr=0x40080400 size=0x12f88 ( 77704) load
I (316) boot: Loaded app from partition at offset 0x10000
I (316) boot: Disabling RNG early entropy source...
I (317) cpu_start: Pro cpu up.
I (320) cpu_start: Application information:
I (325) cpu_start: Project name: bleprph
I (330) cpu_start: App version: 1
I (335) cpu_start: Compile time: Nov 14 2019 10:34:23
I (341) cpu_start: ELF file SHA256: 5ee6e6edd5517063...
I (347) cpu_start: ESP-IDF: v4.0-beta2-70-g0a03a55c1
I (353) cpu_start: Starting app cpu, entry point is 0x400812a0
0x400812a0: call_start_cpu1 at C:/Users/ian.whitehead/Desktop/esp/esp-idf/components/esp32/cpu_start.c:272
I (0) cpu_start: App cpu up.
I (364) heap_init: Initializing. RAM available for dynamic allocation:
I (370) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (376) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (382) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (389) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (395) heap_init: At 3FFC6080 len 00019F80 (103 KiB): DRAM
I (401) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (407) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (414) heap_init: At 40093388 len 0000CC78 (51 KiB): IRAM
I (420) cpu_start: Pro cpu start user code
I (438) spi_flash: detected chip: generic
I (439) spi_flash: flash io: dio
W (439) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (449) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (515) BTDM_INIT: BT controller compile version [d6bb204]
I (515) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (605) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (855) NimBLE_BLE_PRPH: BLE Host Task Started
I (855) uart: queue free spaces: 8
GAP procedure initiated: stop advertising.
Device Address: 4c:11:ae:6c:55:02
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
connection established; status=0 handle=0 our_ota_addr_type=0 our_ota_addr=4c:11:ae:6c:55:02 our_id_addr_type=0 our_id_addr=4c:11:ae:6c:55:02 peer_ota_addr_type=1 peer_ota_addr=43:21:28:b2:02:9e peer_id_addr_type=1 peer_id_addr=43:21:28:b2:02:9e conn_itvl=24 conn_latency=0 supervision_timeout=72 encrypted=0 authenticated=0 bonded=0
mtu update event; conn_handle=0 cid=4 mtu=256
subscribe event; conn_handle=0 attr_handle=8 reason=1 prevn=0 curn=0 previ=0 curi=1
I (41625) NimBLE_BLE_PRPH: PASSKEY_ACTION_EVENT started
I (41625) NimBLE_BLE_PRPH: Passkey on device's display: 60590
I (41625) NimBLE_BLE_PRPH: Accept or reject the passkey through console in this format -> key Y or key N
I (56375) You entered: key Y
I (56375) NimBLE_BLE_PRPH: ble_sm_inject_io result: 0
encryption change event; status=0 handle=0 our_ota_addr_type=0 our_ota_addr=4c:11:ae:6c:55:02 our_id_addr_type=0 our_id_addr=4c:11:ae:6c:55:02 peer_ota_addr_type=1 peer_ota_addr=43:21:28:b2:02:9e peer_id_addr_type=1 peer_id_addr=43:21:28:b2:02:9e conn_itvl=24 conn_latency=0 supervision_timeout=72 encrypted=1 authenticated=1 bonded=1
subscribe event; conn_handle=0 attr_handle=8 reason=2 prevn=0 curn=0 previ=1 curi=0
disconnect; reason=531 handle=0 our_ota_addr_type=0 our_ota_addr=4c:11:ae:6c:55:02 our_id_addr_type=0 our_id_addr=4c:11:ae:6c:55:02 peer_ota_addr_type=1 peer_ota_addr=43:21:28:b2:02:9e peer_id_addr_type=1 peer_id_addr=43:21:28:b2:02:9e conn_itvl=24 conn_latency=0 supervision_timeout=72 encrypted=1 authenticated=1 bonded=1
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
connection established; status=0 handle=0 our_ota_addr_type=0 our_ota_addr=4c:11:ae:6c:55:02 our_id_addr_type=0 our_id_addr=4c:11:ae:6c:55:02 peer_ota_addr_type=1 peer_ota_addr=43:21:28:b2:02:9e peer_id_addr_type=1 peer_id_addr=43:21:28:b2:02:9e conn_itvl=24 conn_latency=0 supervision_timeout=72 encrypted=0 authenticated=0 bonded=0
mtu update event; conn_handle=0 cid=4 mtu=256
subscribe event; conn_handle=0 attr_handle=8 reason=1 prevn=0 curn=0 previ=0 curi=1
I'm using
release/v4.0 of ESP-IDF and running on an
ESP32-WROOM-32D.
I wondered if the Example Configuration setting "Use Secure Connection Feature" was affecting the peer address changing, or the Bonding persistence, so turned the feature off. It had no effect on either the peer address changing (on Android), or the Bonding persistence but it did affect the
I/O Capability - I had this set to DISPLAY YESNO in Menuconfig, but the image execute as if it were set to DISPLAY ONLY - I was prompted to enter a 6 digit code (123456) on the phone. Is this the intended result?
Any thoughts?
Ian