espressif / esp-idf

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

Nimble peripheral doesn't connect to central (IDFGH-6956) #8576

Closed listout closed 2 years ago

listout commented 2 years ago

Environment

Problem Description

I'm trying to use the NimBLE central and peripheral example, but the central is unable to connect to the peripheral. The connection is immediately terminated and I get an NimBLE: Error: Peer doesn't support the Supported New Alert Category characteristic error. I've tried turning on/off MTMI, use secure connection, use bonding ... nothing helps.

Expected Behavior

The NimBLE central connects to the peripheral

Actual Behavior

The NimBLE central doesn't connects to the peripheral

Steps to reproduce

  1. Flash blecent on one ESP device
  2. Flash bleprph on another ESP device
  3. Check output i.g.

Code to reproduce this issue

Just the provided example code from ESP-IDF github.

Debug Logs

Central

I (18595) NimBLE: GAP procedure initiated: connect; 
I (18595) NimBLE: peer_addr_type=0 peer_addr=
I (18595) NimBLE: 24:62:ab:c3:ad:d2
I (18595) NimBLE:  scan_itvl=16 scan_window=16 itvl_min=24 itvl_max=40 latency=0 supervision_timeout=256 min_ce_len=0 max_ce_len=0 own_addr_type=0
I (18615) NimBLE: 

I (18645) NimBLE: Connection established 
I (18645) NimBLE: 

I (18645) NimBLE: GATT procedure initiated: discover all services

I (18845) NimBLE: GATT procedure initiated: discover all characteristics; 
I (18845) NimBLE: start_handle=1 end_handle=5

I (19045) NimBLE: GATT procedure initiated: discover all characteristics; 
I (19045) NimBLE: start_handle=6 end_handle=9

I (19245) NimBLE: GATT procedure initiated: discover all characteristics; 
I (19245) NimBLE: start_handle=10 end_handle=65535

I (19545) NimBLE: GATT procedure initiated: discover all descriptors; 
I (19545) NimBLE: chr_val_handle=8 end_handle=9

I (19645) NimBLE: GATT procedure initiated: discover all descriptors; 
I (19645) NimBLE: chr_val_handle=14 end_handle=65535

E (19745) NimBLE: Service discovery complete; status=0 conn_handle=0

E (19745) NimBLE: Error: Peer doesn't support the Supported New Alert Category characteristic

Peripheral

I (5493) NimBLE: connection established; status=0 
I (5493) NimBLE: handle=0 our_ota_addr_type=0 our_ota_addr=
I (5493) NimBLE: 24:62:ab:c3:ad:d2
I (5493) NimBLE:  our_id_addr_type=0 our_id_addr=
I (5503) NimBLE: 24:62:ab:c3:ad:d2
I (5503) NimBLE:  peer_ota_addr_type=0 peer_ota_addr=
I (5513) NimBLE: 58:bf:25:32:e3:1a
I (5513) NimBLE:  peer_id_addr_type=0 peer_id_addr=
I (5523) NimBLE: 58:bf:25:32:e3:1a
I (5523) NimBLE:  conn_itvl=40 conn_latency=0 supervision_timeout=256 encrypted=0 authenticated=0 bonded=0

I (5533) NimBLE: 

I (6693) NimBLE: disconnect; reason=531 
I (6693) NimBLE: handle=0 our_ota_addr_type=0 our_ota_addr=
I (6693) NimBLE: 24:62:ab:c3:ad:d2
I (6703) NimBLE:  our_id_addr_type=0 our_id_addr=
I (6703) NimBLE: 24:62:ab:c3:ad:d2
I (6713) NimBLE:  peer_ota_addr_type=0 peer_ota_addr=
I (6713) NimBLE: 58:bf:25:32:e3:1a
I (6723) NimBLE:  peer_id_addr_type=0 peer_id_addr=
I (6723) NimBLE: 58:bf:25:32:e3:1a
I (6733) NimBLE:  conn_itvl=40 conn_latency=0 supervision_timeout=256 encrypted=0 authenticated=0 bonded=0
rahult-github commented 2 years ago

Hi @listout ,

We have made a change today to address this issue. Change is merged and should be visible on github soon. I will update this comment with commit id information, once it is available.

Thanks, Rahul

listout commented 2 years ago

Read the edit message, thank you @rahult-github.

@rahult-github On github I cannot see the commit you mentioned. Last commit for bleperiph was last month and blecent was 4 months ago. Are you talking about the nimble port ? Like the component?

listout commented 2 years ago

@rahult-github can you please tell when will the fix be available on github?

rahult-github commented 2 years ago

Hi @listout ,

Mirroring of repository is an automated process and will take its own time. If you are completely stuck, you can try attached patch.

ans_svc_init.txt

Thanks, Rahul

listout commented 2 years ago

Thanks @rahult-github, the patch fixes the issue.