espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.63k stars 7.28k forks source link

"example_ble_sec_gatts_demo" examples central device connect with pairing successfully for most of device but only one central device facing pairing and connection failed (IDFGH-1554) #3815

Closed sagarvegg closed 4 years ago

sagarvegg commented 5 years ago

Environment

Problem Description

I try to run esp-idf "example_ble_sec_gatts_demo" example with pairing/bonding work for several central devices mobile phone but only one central device refuse to connect by pairing...

Expected Behavior bt_bta_dm: BTM_LE_COMPLT_EVT BT_SMP: result state = SMP_STATE_IDLE BT_SMP: result state = SMP_STATE_IDLE SEC_GATTS_DEMO: key type = ESP_LE_KEY_LENC SEC_GATTS_DEMO: key type = ESP_LE_KEY_LID SEC_GATTS_DEMO: key type = ESP_LE_KEY_PENC SEC_GATTS_DEMO: key type = ESP_LE_KEY_PID SEC_GATTS_DEMO: remote BD_ADDR: dc912192a457 SEC_GATTS_DEMO: address type = 1 SEC_GATTS_DEMO: pair status = success SEC_GATTS_DEMO: auth mode = ESP_LE_AUTH_BOND SEC_GATTS_DEMO: Bonded devices number : 2 SEC_GATTS_DEMO: Bonded devices list : 2 SEC_GATTS_DEMO: dc 91 21 92 a4 57 SEC_GATTS_DEMO: 5f 2f 6d 8d ef d2

Actual Behavior

bt_bta_dm: BTM_LE_COMPLT_EVT BT_SMP: result state = SMP_STATE_IDLE BT_BTM: Device not found SEC_GATTS_DEMO: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x1f SEC_GATTS_DEMO: remote BD_ADDR: 6ee455b2a853 SEC_GATTS_DEMO: address type = 1 SEC_GATTS_DEMO: pair status = fail SEC_GATTS_DEMO: fail reason = 0x66 SEC_GATTS_DEMO: Bonded devices number : 2 SEC_GATTS_DEMO: Bonded devices list : 2 SEC_GATTS_DEMO: dc 91 21 92 a4 57 SEC_GATTS_DEMO: 5f 2f 6d 8d ef d2 SEC_GATTS_DEMO: advertising start success

Steps to repropduce

hare different between successfully pairing device and connected with fail to pair and connect device

diff_file.zip

Debug Logs

ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x33 (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:6380 load:0x40078000,len:11304 load:0x40080400,len:6700 entry 0x40080764 I (29) boot: ESP-IDF v4.0-dev-478-gdf61612f8-dirty 2nd stage bootloader I (29) boot: compile time 14:29:10 I (36) boot: Enabling RNG early entropy source... I (36) boot: SPI Speed : 40MHz I (40) boot: SPI Mode : DIO I (44) boot: SPI Flash Size : 4MB I (48) boot: Partition Table: I (51) boot: ## Label Usage Type ST Offset Length I (59) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (66) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (74) boot: 2 factory factory app 00 00 00010000 00100000 I (81) boot: End of partition table I (85) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x2530c (152332) map I (148) esp_image: segment 1: paddr=0x00035334 vaddr=0x3ffbdb60 size=0x02c0c ( 11276) load I (152) esp_image: segment 2: paddr=0x00037f48 vaddr=0x40080000 size=0x00400 ( 1024) load 0x40080000: WindowOverflow4 at E:/msys32/home/Admin/esp/esp-idf/components/freertos/xtensa vectors.S:1779

I (155) esp_image: segment 3: paddr=0x00038350 vaddr=0x40080400 size=0x07cc0 ( 31936) load I (177) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0x7356c (472428) map 0x400d0018: _flash_cache_start at ??:?

I (342) esp_image: segment 5: paddr=0x000b358c vaddr=0x400880c0 size=0x097cc ( 38860) load 0x400880c0: ld_inq_frm_isr_wrapper at ??:?

I (369) boot: Loaded app from partition at offset 0x10000 I (369) boot: Disabling RNG early entropy source... I (370) cpu_start: Pro cpu up. I (373) cpu_start: Application information: I (378) cpu_start: Project name: sec_gatts_demo I (383) cpu_start: App version: v4.0-dev-478-gdf61612f8-dirty I (390) cpu_start: Compile time: Jul 23 2019 14:29:28 I (396) cpu_start: ELF file SHA256: b866debd051d960f... I (402) cpu_start: ESP-IDF: v4.0-dev-478-gdf61612f8-dirty I (409) cpu_start: Starting app cpu, entry point is 0x40081030 0x40081030: call_start_cpu1 at E:/msys32/home/Admin/esp/esp-idf/components/esp32/cpu_start.c :267

I (401) cpu_start: App cpu up. I (420) heap_init: Initializing. RAM available for dynamic allocation: I (427) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM I (433) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM I (439) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM I (445) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM I (451) heap_init: At 3FFC8E48 len 000171B8 (92 KiB): DRAM I (457) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (464) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (470) heap_init: At 4009188C len 0000E774 (57 KiB): IRAM I (476) cpu_start: Pro cpu start user code I (159) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (180) BTDM_INIT: BT controller compile version [484c057] I (180) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (280) phy: phy_version: 4100, 2a5dd04, Jan 23 2019, 21:00:07, 0, 0 I (510) SEC_GATTS_DEMO: app_main init bluetooth D (520) BT_L2CAP: L2CA_RegisterFixedChannel() CID: 0x0004, 0x3ffcd0d0 D (520) BT_SMP: SMP_Init D (520) BT_SMP: SMDBG l2c smp_l2cap_if_init D (520) BT_L2CAP: L2CA_RegisterFixedChannel() CID: 0x0006, 0x3ffcd0b0 D (630) BT_L2CAP: num_lm_ble_bufs = 10 D (640) BT_SMP: SMP_Register state=0 I (660) btm_ble: bd_addr:63-1c-9d-69-1c-9f I (660) btm_ble: bd_addr:63-1c-9d-69-1c-9f I (660) btm_ble: bd_addr:63-1c-9d-69-1c-9f I (680) SEC_GATTS_DEMO: The number handle = 8 D (700) BT_SMP: static passkey 123456 I (710) SEC_GATTS_DEMO: advertising start success D (21990) BT_L2CAP: l2c_ble_link_adjust_allocation num_hipri: 0 num_lowpri: 1 low_quota: 10 round_robin_quota: 0 qq: 10 D (21990) BT_L2CAP: l2c_ble_link_adjust_allocation LCB 0 Priority: 0 XmitQuota: 10 D (22000) BT_L2CAP: SentNotAcked: 0 RRUnacked: 0 D (22010) BT_L2CAP: l2cu_allocate_ccb: cid 0x0000 D (22010) BT_L2CAP: l2c_link_adjust_chnl_allocation D (22020) BT_L2CAP: CID:0x0040 FCR Mode:0 Priority:2 TxDataRate:1 RxDataRate:1 Quota:200 D (22040) BT_L2CAP: l2cu_process_fixed_chnl_resp D (22040) BT_SMP: SMDBG l2c smp_connect_callback

D (22040) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22040) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22050) BT_L2CAP: l2c_link_check_send_pkts D (22060) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22060) BT_L2CAP: l2c_link_send_to_lower D (22070) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 I (22070) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0 I (22080) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT D (22090) BT_SMP: SMP_Pair state=0 br_state=0 flag=0x0

I (22090) BT_L2CAP: L2CA_ConnectFixedChnl() CID: 0x0006 BDA: dc912192a457 D (22100) BT_L2CAP: l2cu_allocate_ccb: cid 0x0000 D (22100) BT_L2CAP: l2c_link_adjust_chnl_allocation D (22110) BT_L2CAP: CID:0x0004 FCR Mode:0 Priority:2 TxDataRate:1 RxDataRate:1 Quota:200 D (22120) BT_L2CAP: CID:0x0041 FCR Mode:0 Priority:2 TxDataRate:1 RxDataRate:1 Quota:200 D (22120) BT_SMP: SMDBG l2c smp_connect_callback

D (22130) BT_SMP: smp_connect_callback() for pairing BDA: dc912192a457 Event: connected

D (22140) BT_SMP: main smp_sm_event

D (22140) BT_SMP: SMP Role: Slave State: [SMP_STATE_IDLE (0)], Event: [L2CAP_CONN_EVT (18)] D (22150) BT_SMP: State change: SMP_STATE_IDLE(0) ==> SMP_STATE_WAIT_APP_RSP(1) D (22160) BT_SMP: smp_send_app_cback p_cb->cb_evt=1

D (22160) BT_SMP: io_cap = 4 D (22170) BT_SMP: callback_rc=0 p_cb->cb_evt=1

D (22170) BT_SMP: rcvd auth_req: 0x05, io_cap: 1 loc_oob_flag: 1 loc _enc_size: 16,local_i_key: 0x03, local_r_key: 0x03

D (22180) BT_SMP: set auth_req: 0x05, local_i_key: 0x03, local_r_key: 0x03

D (22190) BT_SMP: main smp_sm_event

D (22190) BT_SMP: SMP Role: Slave State: [SMP_STATE_WAIT_APP_RSP (1)], Event: [API_IO_RSP_EV T (20)] D (22200) BT_SMP: State change: SMP_STATE_WAIT_APP_RSP(1) ==> SMP_STATE_PAIR_REQ_RSP(3) D (22210) BT_SMP: smp_process_io_response

D (22220) BT_SMP: State change: SMP_STATE_PAIR_REQ_RSP(3) ==> SMP_STATE_SEC_REQ_PENDING(2) D (22220) BT_SMP: smp_send_cmd on l2cap cmd_code=0xb

D (22230) BT_SMP: smp_build_security_request

D (22230) BT_SMP: opcode=11 auth_req=0x5 D (22240) BT_SMP: smp_send_msg_to_L2CAP I (22240) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0006 BDA: dc912192a457 D (22250) BT_L2CAP: l2c_link_check_send_pkts D (22250) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22260) BT_L2CAP: l2c_link_send_to_lower D (22260) BT_L2CAP: TotalWin=8,Hndl=0x0,Quota=10,Unack=2,RRQuota=0,RRUnack=0 D (22270) BT_SMP: result state = SMP_STATE_SEC_REQ_PENDING

D (22280) BT_SMP: smp_send_app_cback return

D (22280) BT_SMP: result state = SMP_STATE_SEC_REQ_PENDING

D (22290) BT_L2CAP: l2c_link_check_send_pkts D (22290) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22300) BT_L2CAP: TotalWin=9,LinkUnack(0x0)=1,RRCheck=0,RRUnack=0

D (22310) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22310) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22320) BT_L2CAP: l2c_link_check_send_pkts D (22320) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22330) BT_L2CAP: l2c_link_send_to_lower D (22330) BT_L2CAP: TotalWin=8,Hndl=0x0,Quota=10,Unack=2,RRQuota=0,RRUnack=0 D (22340) BT_L2CAP: l2c_link_check_send_pkts D (22340) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22350) BT_L2CAP: TotalWin=9,LinkUnack(0x0)=1,RRCheck=0,RRUnack=0

D (22360) BT_L2CAP: l2c_link_check_send_pkts D (22360) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22370) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (22380) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22380) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22390) BT_L2CAP: l2c_link_check_send_pkts D (22390) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22400) BT_L2CAP: l2c_link_send_to_lower D (22400) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (22430) BT_L2CAP: l2c_link_check_send_pkts D (22430) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22430) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (22440) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22440) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22450) BT_L2CAP: l2c_link_check_send_pkts D (22460) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22460) BT_L2CAP: l2c_link_send_to_lower D (22470) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (22520) BT_L2CAP: l2c_link_check_send_pkts D (22530) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22530) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (22530) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22540) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22540) BT_L2CAP: l2c_link_check_send_pkts D (22550) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22560) BT_L2CAP: l2c_link_send_to_lower D (22560) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (22600) BT_L2CAP: l2c_link_check_send_pkts D (22600) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22600) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (22610) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22610) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22620) BT_L2CAP: l2c_link_check_send_pkts D (22620) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22630) BT_L2CAP: l2c_link_send_to_lower D (22640) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (22670) BT_L2CAP: l2c_link_check_send_pkts D (22680) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22680) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (22680) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22690) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22690) BT_L2CAP: l2c_link_check_send_pkts D (22700) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22710) BT_L2CAP: l2c_link_send_to_lower D (22710) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (22770) BT_L2CAP: l2c_link_check_send_pkts D (22770) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22770) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (22780) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (22780) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (22790) BT_L2CAP: l2c_link_check_send_pkts D (22790) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22800) BT_L2CAP: l2c_link_send_to_lower D (22800) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (22810) BT_L2CAP: L2CAP - rcv_cid CID: 0x0006

D (22820) BT_SMP: SMDBG l2c smp_data_received

D (22820) BT_SMP: main smp_sm_event

D (22820) BT_SMP: SMP Role: Slave State: [SMP_STATE_SEC_REQ_PENDING (2)], Event: [PAIRING_RE Q_EVT (1)] D (22830) BT_SMP: State change: SMP_STATE_SEC_REQ_PENDING(2) ==> SMP_STATE_PAIR_REQ_RSP(3) D (22840) BT_SMP: smp_proc_pair_cmd

D (22850) BT_SMP: smp_command_has_invalid_parameters for cmd code 0x01

D (22850) BT_SMP: smp_command_has_valid_fixed_length for cmd code 0x01

D (22860) BT_SMP: smp_pairing_request_response_parameters_are_valid for cmd code 0x01

D (22870) BT_SMP: smp_select_association_model

D (22870) BT_SMP: smp_select_association_model p_cb->peer_io_caps = 4 p_cb->local_io_capabil ity = 1

D (22880) BT_SMP: smp_select_association_model p_cb->peer_oob_flag = 0 p_cb->loc_oob_flag = 1

D (22890) BT_SMP: smp_select_association_model p_cb->peer_auth_req = 0x05 p_cb->loc_auth_req = 0x05

D (22900) BT_SMP: smp_select_association_model p_cb->secure_connections_only_mode_required = FALSE

D (22910) BT_SMP: use_sc_process = 0

D (22910) BT_SMP: smp_select_legacy_association_model

D (22920) BT_SMP: smp_get_auth_mode model 3 D (22920) BT_SMP: smp_send_pair_rsp

D (22930) BT_SMP: smp_send_cmd on l2cap cmd_code=0x2

D (22930) BT_SMP: smp_build_pairing_cmd D (22930) BT_SMP: smp_send_msg_to_L2CAP I (22940) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0006 BDA: dc912192a457 D (22950) BT_L2CAP: l2c_link_check_send_pkts D (22950) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (22960) BT_L2CAP: l2c_link_send_to_lower D (22960) BT_L2CAP: TotalWin=8,Hndl=0x0,Quota=10,Unack=2,RRQuota=0,RRUnack=0 D (22970) BT_SMP: smp_decide_association_model Association Model = 3

D (22980) BT_SMP: Need to generate Passkey

D (22980) BT_SMP: smp_generate_passkey use static passkey 123456 D (22990) BT_SMP: main smp_sm_event

D (22990) BT_SMP: SMP Role: Slave State: [SMP_STATE_PAIR_REQ_RSP (3)], Event: [KEY_READY_EVT (16)] D (23000) BT_SMP: State change: SMP_STATE_PAIR_REQ_RSP(3) ==> SMP_STATE_PAIR_REQ_RSP(3) D (23010) BT_SMP: smp_proc_sl_key

D (23010) BT_SMP: smp_generate_srand_mrand_confirm

D (23020) BT_SMP: result state = SMP_STATE_PAIR_REQ_RSP

D (23020) BT_SMP: sec_level=4

D (23020) BT_SMP: result state = SMP_STATE_PAIR_REQ_RSP

D (23030) BT_L2CAP: l2c_link_check_send_pkts D (23030) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23040) BT_L2CAP: TotalWin=9,LinkUnack(0x0)=1,RRCheck=0,RRUnack=0

D (23050) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23050) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23060) BT_L2CAP: l2c_link_check_send_pkts D (23060) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23070) BT_L2CAP: l2c_link_send_to_lower D (23080) BT_L2CAP: TotalWin=8,Hndl=0x0,Quota=10,Unack=2,RRQuota=0,RRUnack=0 D (23080) BT_L2CAP: l2c_link_check_send_pkts D (23090) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23090) BT_L2CAP: TotalWin=9,LinkUnack(0x0)=1,RRCheck=0,RRUnack=0

D (23100) BT_SMP: smp_rand_back state=0x7 D (23100) BT_SMP: smp_generate_rand_cont

I (23110) SEC_GATTS_DEMO: The passkey Notify number:123456 D (23110) BT_SMP: smp_rand_back state=0x8 D (23120) BT_SMP: smp_generate_confirm

D (23120) BT_SMP: smp_calculate_comfirm

D (23130) BT_SMP: smp_gen_p1_4_confirm

D (23130) BT_SMP: smp_concatenate_peer

D (23130) BT_SMP: smp_concatenate_local

D (23140) BT_SMP: smp_xor_128

D (23140) BT_SMP: smp_calculate_comfirm_cont

D (23150) BT_SMP: smp_gen_p2_4_confirm

D (23150) BT_SMP: smp_gen_p2_4_confirm

D (23150) BT_SMP: smp_xor_128

D (23160) BT_SMP: p_cb->rand_enc_proc_state=2

D (23160) BT_SMP: smp_process_confirm

D (23170) BT_SMP: main smp_sm_event

D (23170) BT_SMP: SMP Role: Slave State: [SMP_STATE_PAIR_REQ_RSP (3)], Event: [KEY_READY_EVT (16)] D (23180) BT_SMP: State change: SMP_STATE_PAIR_REQ_RSP(3) ==> SMP_STATE_PAIR_REQ_RSP(3) D (23190) BT_SMP: smp_proc_sl_key

D (23190) BT_SMP: State change: SMP_STATE_PAIR_REQ_RSP(3) ==> SMP_STATE_WAIT_CONFIRM(4) D (23200) BT_SMP: result state = SMP_STATE_WAIT_CONFIRM

D (23200) BT_L2CAP: l2c_link_check_send_pkts D (23210) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23220) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23220) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23230) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23230) BT_L2CAP: l2c_link_check_send_pkts D (23240) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23250) BT_L2CAP: l2c_link_send_to_lower D (23250) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23280) BT_L2CAP: l2c_link_check_send_pkts D (23280) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23280) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23280) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23290) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23290) BT_L2CAP: l2c_link_check_send_pkts D (23300) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23310) BT_L2CAP: l2c_link_send_to_lower D (23310) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23350) BT_L2CAP: l2c_link_check_send_pkts D (23350) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23350) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23360) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23360) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23370) BT_L2CAP: l2c_link_check_send_pkts D (23370) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23380) BT_L2CAP: l2c_link_send_to_lower D (23390) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23430) BT_L2CAP: l2c_link_check_send_pkts D (23430) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23430) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23430) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23440) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23440) BT_L2CAP: l2c_link_check_send_pkts D (23450) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23460) BT_L2CAP: l2c_link_send_to_lower D (23460) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23500) BT_L2CAP: l2c_link_check_send_pkts D (23500) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23500) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23510) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23510) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23520) BT_L2CAP: l2c_link_check_send_pkts D (23520) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23530) BT_L2CAP: l2c_link_send_to_lower D (23540) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23570) BT_L2CAP: l2c_link_check_send_pkts D (23570) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23580) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23580) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23590) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23590) BT_L2CAP: l2c_link_check_send_pkts D (23600) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23610) BT_L2CAP: l2c_link_send_to_lower D (23610) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23650) BT_L2CAP: l2c_link_check_send_pkts D (23650) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23650) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (23660) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (23660) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (23670) BT_L2CAP: l2c_link_check_send_pkts D (23670) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23680) BT_L2CAP: l2c_link_send_to_lower D (23680) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (23720) BT_L2CAP: l2c_link_check_send_pkts D (23720) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (23720) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (52770) BT_L2CAP: L2CAP - rcv_cid CID: 0x0006

D (52770) BT_SMP: SMDBG l2c smp_data_received

D (52770) BT_SMP: main smp_sm_event

D (52770) BT_SMP: SMP Role: Slave State: [SMP_STATE_WAIT_CONFIRM (4)], Event: [PAIRING_FAILE D_EVT (5)] D (52780) BT_SMP: State change: SMP_STATE_WAIT_CONFIRM(4) ==> SMP_STATE_IDLE(0) D (52790) BT_SMP: smp_proc_pair_fail D (52790) BT_SMP: smp_proc_pairing_cmpl

D (52790) BT_SMP: send SMP_COMPLT_EVT reason=0x8 sec_level=0x0

D (52800) BT_SMP: smp_reset_control_value

D (52810) BT_SMP: smp_remove_fixed_channel

I (52810) BT_L2CAP: L2CA_RemoveFixedChnl() CID: 0x0006 BDA: dc912192a457 D (52820) BT_L2CAP: l2cu_release_ccb: cid 0x0006 in_use: 1 D (52820) BT_SMP: smp_cb_cleanup

I (52830) bt_bta_dm: copy bda address

I (52830) btm_ble: btm_find_dev_type - device_type = 2 addr_type = 1 I (52840) bt_bta_dm: BTM Read Device Info

I (52840) bt_bta_dm: security device name present

I (52850) bt_bta_dm: p_data->complt.reason : 8

I (52850) bt_bta_dm: Authentication Fail Code: 85 I (52860) bt_bta_dm: bta_dm_remove_sec_dev_entry ACL is not down. Schedule for Dev Removal when ACL closes I (52870) bt_bta_dm: BTM_LE_COMPLT_EVT

D (52880) BT_SMP: result state = SMP_STATE_IDLE

I (52890) SEC_GATTS_DEMO: remote BD_ADDR: dc912192a457 I (52890) SEC_GATTS_DEMO: address type = 1 I (52890) SEC_GATTS_DEMO: pair status = fail I (52900) SEC_GATTS_DEMO: fail reason = 0x55 I (52900) SEC_GATTS_DEMO: Bonded devices number : 1

I (52910) SEC_GATTS_DEMO: Bonded devices list : 1

I (52910) SEC_GATTS_DEMO: 63 1c 9d 69 1c 9f D (54790) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (54790) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (54800) BT_L2CAP: l2c_link_check_send_pkts D (54800) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (54810) BT_L2CAP: l2c_link_send_to_lower D (54810) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 D (54850) BT_L2CAP: l2c_link_check_send_pkts D (54850) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (54850) BT_L2CAP: TotalWin=10,LinkUnack(0x0)=0,RRCheck=0,RRUnack=0

D (68930) BT_L2CAP: l2cu_release_ccb: cid 0x0004 in_use: 1 W (68930) BT_BTM: btm_sec_clr_temp_auth_service() - no dev CB

D (68930) BT_SMP: SMDBG l2c smp_connect_callback

E (68940) BT_BTM: Device not found

I (68940) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0 I (68950) SEC_GATTS_DEMO: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x13 I (68970) SEC_GATTS_DEMO: advertising start success D (71610) BT_L2CAP: l2c_ble_link_adjust_allocation num_hipri: 0 num_lowpri: 1 low_quota: 10 round_robin_quota: 0 qq: 10 D (71610) BT_L2CAP: l2c_ble_link_adjust_allocation LCB 0 Priority: 0 XmitQuota: 10 D (71620) BT_L2CAP: SentNotAcked: 0 RRUnacked: 0 D (71630) BT_L2CAP: l2cu_allocate_ccb: cid 0x0000 D (71630) BT_L2CAP: l2c_link_adjust_chnl_allocation D (71640) BT_L2CAP: CID:0x0042 FCR Mode:0 Priority:2 TxDataRate:1 RxDataRate:1 Quota:200 D (71670) BT_L2CAP: l2cu_process_fixed_chnl_resp D (71670) BT_SMP: SMDBG l2c smp_connect_callback

D (71670) BT_L2CAP: L2CAP - rcv_cid CID: 0x0004

I (71670) BT_L2CAP: L2CA_SendFixedChnlData() CID: 0x0004 BDA: dc912192a457 D (71680) BT_L2CAP: l2c_link_check_send_pkts D (71680) BT_L2CAP: partial_segment_being_sent=0,link_state=4,power_mode=0 D (71690) BT_L2CAP: l2c_link_send_to_lower D (71700) BT_L2CAP: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0 I (71700) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0 I (71710) SEC_GATTS_DEMO: ESP_GATTS_CONNECT_EVT

sagarvegg commented 5 years ago

I used "nRF Connect APP" for connect ble "example_ble_sec_gatts_demo" with all idf version but all have same issue only one device face problem to connect with pairing... And all other device connect without any issue; so what should be problem for failing to connect

gengyuchao commented 5 years ago

How many devices did you try to connect? As far as I know, there are a maximum number of BLE connections.

sagarvegg commented 5 years ago

@gengyuchao I know that maximum 9 number of device able to connect with esp32 multi server but that was no issue I connect one by one device connect and disconnect that means at a single instance of time only single device try to connect with pairing...

I try to connect several device one by one but only single device have face issue of ble paring failure... [failure device: LG W30 mobile --> nRF connect app]

gengyuchao commented 5 years ago

Is the same device always in question? If so, it may be a problem with the device itself. And as far as I know, the maximum number of connections for ESP32 Bluetooth is 7.

sagarvegg commented 5 years ago

Is the same device always in question? If so, it may be a problem with the device itself. same device means what you actually tell me that all device os or ble version same? if yes than four device with 4.0 Bluetooth version and two device with 4.2 Bluetooth version

and issue with only one device connection which have Bluetooth version 4.2

chegewara commented 5 years ago

I have issue with my samsung S9+ smartphone. Some time ago i was testing esp32 with this smartphone, by running BLE server in nRF connect and i could connect to it, most the time.

Few weeks ago i updated android to v9.0 and since then i cant connect esp32 to samsung server(not even single time), but i still can connect from smartphone to esp32. When i am trying to connect esp32 to smartphone i am getting GATT error 0x85.

sagarvegg commented 5 years ago

@chegewara I have oppo f11 pro device and which have already android version 9.0 and Bluetooth version 4.2; every time I connect to this device successfully without any issue than how you say that problem related to android version?

chegewara commented 5 years ago

Im not saying its related to android version, it is related to device or device driver. It was working on my samsung before, but after update something has been changed in it and is no longer connecting.

sagarvegg commented 5 years ago

Okay, @chegewara than how to again connect ble device for samsung S9+ smartphone? Issue solved or not for that device and if solved than how?

chegewara commented 5 years ago

It is not solved for S9+, im no longer using it to test esp32 and instead using other esp32, which also from time to time has the same problems with connectivity (error 0x85). Im not saying your problem is not an issue, just wanted to share the info im having similar issues with connectivity, even without pairing, which may or may not be related to peer device not only esp32.

Alvin1Zhang commented 4 years ago

@sagarvegg Thanks for reporting. Sorry we don't have enough details to move forward, and we have tried but failed to reproduce the issue. Feel free to reopen the issue. Thanks.