-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLE Client (NimBLE) not receiving data from BLE Server (NimBLE) (IDFGH-11057) #12236
Comments
Hi @Firmware-beginner , Can you please give more information :
|
I (593) NimBLE: Connection established I (593) NimBLE: GATT procedure initiated: discover all services I (703) NimBLE: GATT procedure initiated: discover all characteristics; I (903) NimBLE: GATT procedure initiated: discover all characteristics; I (1103) NimBLE: GATT procedure initiated: discover all characteristics; I (1303) NimBLE: GATT procedure initiated: discover all descriptors; I (1403) NimBLE: GATT procedure initiated: discover all descriptors; I (1603) NimBLE: Service discovery complete; status=0 conn_handle=1 I (1603) NimBLE: GAP procedure initiated: discovery; I (3313) NimBLE: GATT procedure initiated: write; I (3313) NimBLE_SPP_BLE_CENT: Write in uart task success! I (6643) NimBLE_SPP_BLE_CENT: Write in uart task success! |
I gave a quick try for the application at mentioned version and see it is working correctly. Shared above is console log of client side. Can you please do below and share log of both client and server side: Component Config --> Log Output --> Default Log Verbosity --> Debug |
Log of client: I (1505) NimBLE: Connection established I (1555) NimBLE: GATT procedure initiated: discover all services D (1555) NimBLE: host tx hci data; handle=1 length=11 D (1565) NimBLE: ble_hs_hci_acl_tx(): D (1605) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0016 len=2 D (1615) NimBLE: 0x16 D (1625) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (1635) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (1715) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=24 data= I (1765) NimBLE: GATT procedure initiated: discover all characteristics; D (1785) NimBLE: host tx hci data; handle=1 length=11 D (1785) NimBLE: ble_hs_hci_acl_tx(): D (1915) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=20 data= D (1955) NimBLE: host tx hci data; handle=1 length=11 D (1965) NimBLE: ble_hs_hci_acl_tx(): D (2065) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= I (2085) NimBLE: GATT procedure initiated: discover all characteristics; D (2095) NimBLE: host tx hci data; handle=1 length=11 D (2095) NimBLE: ble_hs_hci_acl_tx(): D (2215) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=13 data= D (2245) NimBLE: host tx hci data; handle=1 length=11 D (2245) NimBLE: ble_hs_hci_acl_tx(): D (2365) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= I (2385) NimBLE: GATT procedure initiated: discover all characteristics; D (2395) NimBLE: host tx hci data; handle=1 length=11 D (2395) NimBLE: ble_hs_hci_acl_tx(): D (2515) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=13 data= D (2545) NimBLE: host tx hci data; handle=1 length=11 D (2545) NimBLE: ble_hs_hci_acl_tx(): D (2665) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= I (2685) NimBLE: GATT procedure initiated: discover all descriptors; D (2695) NimBLE: host tx hci data; handle=1 length=9 D (2695) NimBLE: ble_hs_hci_acl_tx(): D (2815) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=10 data= I (2835) NimBLE: GATT procedure initiated: discover all descriptors; D (2845) NimBLE: host tx hci data; handle=1 length=9 D (2855) NimBLE: ble_hs_hci_acl_tx(): D (2965) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=10 data= D (2985) NimBLE: host tx hci data; handle=1 length=9 D (2985) NimBLE: ble_hs_hci_acl_tx(): D (3115) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= I (3135) NimBLE: Service discovery complete; status=0 conn_handle=1 I (3135) NimBLE: GAP procedure initiated: discovery; D (3155) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000b len=7 D (3165) NimBLE: 0x0b D (3195) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000c len=2 D (3195) NimBLE: 0x0c D (3235) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3235) NimBLE: flags=0x06 D (3235) NimBLE: uuids16(complete)= D (3245) NimBLE: name(complete)=nimble-ble-spp-svr D (3255) NimBLE: tx_pwr_lvl=9 D (3255) NimBLE: Device already connected D (3265) NimBLE: uuids16(complete)= D (3285) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3285) NimBLE: flags=0x1a D (3295) NimBLE: tx_pwr_lvl=-11 D (3295) NimBLE: svc_data_uuid16= D (3335) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3345) NimBLE: mfg_data= D (3425) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3435) NimBLE: mfg_data= D (3505) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3515) NimBLE: flags=0x1a D (3525) NimBLE: tx_pwr_lvl=12 D (3525) NimBLE: mfg_data= D (3555) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3565) NimBLE: flags=0x1a D (3565) NimBLE: tx_pwr_lvl=24 D (3575) NimBLE: mfg_data= D (3605) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3615) NimBLE: flags=0x1a D (3615) NimBLE: tx_pwr_lvl=8 D (3615) NimBLE: mfg_data= D (3645) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3655) NimBLE: flags=0x05 D (3655) NimBLE: uuids16(complete)= D (3675) NimBLE: mfg_data= D (3715) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3725) NimBLE: flags=0x06 D (3725) NimBLE: mfg_data= D (3795) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3805) NimBLE: flags=0x04 D (3805) NimBLE: svc_data_uuid16= D (3835) NimBLE: mfg_data= D (3855) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3865) NimBLE: uuids16(complete)= D (3885) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (3885) NimBLE: flags=0x06 D (3895) NimBLE: uuids128(incomplete)= D (3905) NimBLE: svc_data_uuid16= D (4085) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (4085) NimBLE: flags=0x06 D (4085) NimBLE: name(complete)=NinjaCalling D (4095) NimBLE: svc_data_uuid16= D (4165) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (4165) NimBLE: mfg_data= D (4305) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (4305) NimBLE: mfg_data= D (5055) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (5055) NimBLE: mfg_data= D (6285) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (6285) NimBLE: mfg_data= D (6725) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (6725) NimBLE: mfg_data= D (9795) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (9795) NimBLE: flags=0x06 D (9805) NimBLE: name(complete)=FB BSW049 D (9805) NimBLE: svc_data_uuid16= I (10465) NimBLE: GATT procedure initiated: write; D (10465) NimBLE: host tx hci data; handle=1 length=8 D (10465) NimBLE: ble_hs_hci_acl_tx(): I (10505) NimBLE_SPP_BLE_CENT: Write in uart task success! D (11105) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (11105) NimBLE: flags=0x1a D (11105) NimBLE: tx_pwr_lvl=8 D (11105) NimBLE: mfg_data= D (15595) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (15595) NimBLE: flags=0x02 D (15595) NimBLE: mfg_data= I (15705) NimBLE: GATT procedure initiated: write; D (15705) NimBLE: host tx hci data; handle=1 length=8 D (15705) NimBLE: ble_hs_hci_acl_tx(): I (15745) NimBLE_SPP_BLE_CENT: Write in uart task success! D (18555) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (18555) NimBLE: uuids16(complete)= D (19285) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (19285) NimBLE: mfg_data= D (20065) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (20075) NimBLE: flags=0x06 D (20075) NimBLE: uuids16(complete)= D (20085) NimBLE: mfg_data= I (47235) NimBLE: GATT procedure initiated: write; D (47235) NimBLE: host tx hci data; handle=1 length=8 D (47235) NimBLE: ble_hs_hci_acl_tx(): I (47275) NimBLE_SPP_BLE_CENT: Write in uart task success! Log of server: I (220570) NimBLE: connection established; status=0 I (220610) NimBLE: I (220620) NimBLE: GAP procedure initiated: advertise; I (229570) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c On the server side I am looping(sending) back the same data which the client sends. So client should receive what it sends. |
The default application doesn't do this. So ,
Edit: I saw the log again .. Server is receiving data. So IDF application is working as expected in your case too. I (229570) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c |
|
As requested , please share server side debug enabled logs and the changes done on server side |
I (26069) NimBLE: connection established; status=0 I (26119) NimBLE: D (26129) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0007 len=0 D (26129) NimBLE: 0x07 D (26139) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0008 len=32 D (26149) NimBLE: 0x08 I (26239) NimBLE: GAP procedure initiated: advertise; D (26259) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0006 len=15 D (26269) NimBLE: 0x06 D (26319) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000a len=1 D (26319) NimBLE: 0x0a D (26329) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0016 len=2 D (26339) NimBLE: 0x16 D (26359) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (26369) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (26399) NimBLE: host tx hci data; handle=1 length=24 D (26409) NimBLE: ble_hs_hci_acl_tx(): D (26489) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e D (26689) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (26709) NimBLE: host tx hci data; handle=1 length=20 D (26719) NimBLE: ble_hs_hci_acl_tx(): D (26889) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (26909) NimBLE: host tx hci data; handle=1 length=9 D (26919) NimBLE: ble_hs_hci_acl_tx(): D (27089) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (27109) NimBLE: host tx hci data; handle=1 length=13 D (27119) NimBLE: ble_hs_hci_acl_tx(): D (27289) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (27309) NimBLE: host tx hci data; handle=1 length=9 D (27319) NimBLE: ble_hs_hci_acl_tx(): D (27489) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (27509) NimBLE: host tx hci data; handle=1 length=13 D (27519) NimBLE: ble_hs_hci_acl_tx(): D (27689) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data= D (27709) NimBLE: host tx hci data; handle=1 length=9 D (27719) NimBLE: ble_hs_hci_acl_tx(): D (27889) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= D (27909) NimBLE: host tx hci data; handle=1 length=10 D (27909) NimBLE: ble_hs_hci_acl_tx(): D (28089) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= D (28109) NimBLE: host tx hci data; handle=1 length=10 D (28109) NimBLE: ble_hs_hci_acl_tx(): D (28339) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data= D (28359) NimBLE: host tx hci data; handle=1 length=9 D (28359) NimBLE: ble_hs_hci_acl_tx(): D (39839) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=8 data= I (39849) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c D (39869) NimBLE: ble_hs_hci_acl_tx(): D (59889) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=8 data= I (59899) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c D (59919) NimBLE: ble_hs_hci_acl_tx(): |
Can you please share the server side changes. It will help to reproduce issue locally and debug. |
In Callback function for custom service (ble_svc_gatt_handler) /* Callback function for custom service */
#if(1) /* BLE Loopback code /
} |
Hello @Firmware-beginner , I checked your code. My assumptions are that above provided code is the only change done on server side , and rest all code is same. Also client code is not touched.
` struct os_mbuf *txom; txom = ble_hs_mbuf_from_flat(ctxt->om->om_data, ctxt->om->om_len); //MODIFIED rc = ble_gatts_notify_custom(conn_handle, ble_spp_svc_gatt_read_val_handle,txom); if (rc == 0) { MODLOG_DFLT(INFO, "Notification sent successfully"); } else { MODLOG_DFLT(INFO, "Error in sending notification rc = %d", rc); } ` With this, am able to see that when client writes a data , it is received on server side. Server then issues notification and it is received on client side. Server log: ` I (2933) NimBLE: GAP procedure initiated: advertise;` Client log: ` I (1573) NimBLE: GAP procedure initiated: discovery;` |
Thank you for helping, |
Answers checklist.
General issue report
I have tested the server code on esp32s3 board and connected it to a mobile phone and data transfer takes place from both sides. I have flashed client code in one esp32s3 board and server code into another esp32s3 board, connection gets established between them and client sends data but it can't receive data. What could be the problem?
The text was updated successfully, but these errors were encountered: