Skip to content
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

Closed
3 tasks done
Firmware-beginner opened this issue Sep 13, 2023 · 12 comments
Closed
3 tasks done
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@Firmware-beginner
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

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?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 13, 2023
@github-actions github-actions bot changed the title BLE Client (NimBLE) not receiving data from BLE Server (NimBLE) BLE Client (NimBLE) not receiving data from BLE Server (NimBLE) (IDFGH-11057) Sep 13, 2023
@rahult-github
Copy link
Collaborator

Hi @Firmware-beginner ,

Can you please give more information :

  1. What idf version / branch is being used .
  2. Which nimble example is being used ?
  3. Can you share a debug enabled log for your run ?

@Firmware-beginner
Copy link
Author

  1. ESP-IDF v5.1-4
  2. espressif/esp-idf/tree/master/examples/bluetooth/nimble/ble_spp
    /spp_client and spp_server example

I (593) NimBLE: Connection established
I (593) NimBLE:

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

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

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

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

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

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

I (1603) NimBLE: Service discovery complete; status=0 conn_handle=1

I (1603) NimBLE: GAP procedure initiated: discovery;
I (1603) NimBLE: own_addr_type=0 filter_policy=0 passive=1 limited=0 filter_duplicates=1
I (1613) NimBLE: duration=forever
I (1613) NimBLE:

I (3313) NimBLE: GATT procedure initiated: write;
I (3313) NimBLE: att_handle=12 len=1

I (3313) NimBLE_SPP_BLE_CENT: Write in uart task success!
I (6643) NimBLE: GATT procedure initiated: write;
I (6643) NimBLE: att_handle=12 len=1

I (6643) NimBLE_SPP_BLE_CENT: Write in uart task success!
I (9263) NimBLE: GATT procedure initiated: write;
I (9263) NimBLE: att_handle=12 len=2

@rahult-github
Copy link
Collaborator

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
Component Config --> Bluetooth --> NimBLE Options --> NimBLE Host log verbosity --> Debug Logs

@Firmware-beginner
Copy link
Author

Log of client:

I (1505) NimBLE: Connection established
D (1515) NimBLE: handle=1 our_ota_addr_type=0 our_ota_addr=f4:12:fa:81:4c:5e
D (1525) NimBLE: our_id_addr_type=0 our_id_addr=f4:12:fa:81:4c:5e
D (1525) NimBLE: peer_ota_addr_type=0 peer_ota_addr=34:85:18:8e:b6:a6
D (1535) NimBLE: peer_id_addr_type=0 peer_id_addr=34:85:18:8e:b6:a6
D (1535) NimBLE: conn_itvl=40 conn_latency=0 supervision_timeout=256 encrypted=0 authenticated=0 bonded=0
I (1545) NimBLE:

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 (1565) NimBLE: 0x01
D (1575) NimBLE: 0x00
D (1575) NimBLE: 0x0b
D (1575) NimBLE: 0x00
D (1575) NimBLE: 0x07
D (1575) NimBLE: 0x00
D (1585) NimBLE: 0x04
D (1585) NimBLE: 0x00
D (1585) NimBLE: 0x10
D (1585) NimBLE: 0x01
D (1595) NimBLE: 0x00
D (1595) NimBLE: 0xff
D (1595) NimBLE: 0xff
D (1595) NimBLE: 0x00
D (1605) NimBLE: 0x28
D (1605) NimBLE:

D (1605) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0016 len=2

D (1615) NimBLE: 0x16
D (1615) NimBLE: 0x20
D (1615) NimBLE: 0x02
D (1615) NimBLE: 0x01
D (1625) NimBLE: 0x00
D (1625) NimBLE:

D (1625) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (1635) NimBLE: subevent: 0x14
D (1635) NimBLE:

D (1635) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (1645) NimBLE: subevent: 0x4
D (1645) NimBLE:

D (1715) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=24 data=
D (1715) NimBLE: 0x14
D (1715) NimBLE: 0x00
D (1715) NimBLE: 0x04
D (1715) NimBLE: 0x00
D (1715) NimBLE: 0x11
D (1715) NimBLE: 0x06
D (1725) NimBLE: 0x01
D (1725) NimBLE: 0x00
D (1725) NimBLE: 0x05
D (1725) NimBLE: 0x00
D (1735) NimBLE: 0x00
D (1735) NimBLE: 0x18
D (1735) NimBLE: 0x06
D (1735) NimBLE: 0x00
D (1745) NimBLE: 0x09
D (1745) NimBLE: 0x00
D (1745) NimBLE: 0x01
D (1745) NimBLE: 0x18
D (1755) NimBLE: 0x0a
D (1755) NimBLE: 0x00
D (1755) NimBLE: 0xff
D (1755) NimBLE: 0xff
D (1765) NimBLE: 0xf0
D (1765) NimBLE: 0xab
D (1765) NimBLE:

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

D (1785) NimBLE: host tx hci data; handle=1 length=11

D (1785) NimBLE: ble_hs_hci_acl_tx():
D (1785) NimBLE: 0x01
D (1795) NimBLE: 0x00
D (1795) NimBLE: 0x0b
D (1795) NimBLE: 0x00
D (1795) NimBLE: 0x07
D (1805) NimBLE: 0x00
D (1805) NimBLE: 0x04
D (1805) NimBLE: 0x00
D (1805) NimBLE: 0x08
D (1815) NimBLE: 0x01
D (1815) NimBLE: 0x00
D (1815) NimBLE: 0x05
D (1815) NimBLE: 0x00
D (1825) NimBLE: 0x03
D (1825) NimBLE: 0x28
D (1825) NimBLE:

D (1915) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=20 data=
D (1915) NimBLE: 0x10
D (1915) NimBLE: 0x00
D (1915) NimBLE: 0x04
D (1915) NimBLE: 0x00
D (1915) NimBLE: 0x09
D (1915) NimBLE: 0x07
D (1925) NimBLE: 0x02
D (1925) NimBLE: 0x00
D (1925) NimBLE: 0x02
D (1925) NimBLE: 0x03
D (1935) NimBLE: 0x00
D (1935) NimBLE: 0x00
D (1935) NimBLE: 0x2a
D (1935) NimBLE: 0x04
D (1945) NimBLE: 0x00
D (1945) NimBLE: 0x02
D (1945) NimBLE: 0x05
D (1945) NimBLE: 0x00
D (1955) NimBLE: 0x01
D (1955) NimBLE: 0x2a
D (1955) NimBLE:

D (1955) NimBLE: host tx hci data; handle=1 length=11

D (1965) NimBLE: ble_hs_hci_acl_tx():
D (1965) NimBLE: 0x01
D (1965) NimBLE: 0x00
D (1975) NimBLE: 0x0b
D (1975) NimBLE: 0x00
D (1975) NimBLE: 0x07
D (1975) NimBLE: 0x00
D (1985) NimBLE: 0x04
D (1985) NimBLE: 0x00
D (1985) NimBLE: 0x08
D (1985) NimBLE: 0x05
D (1995) NimBLE: 0x00
D (1995) NimBLE: 0x05
D (1995) NimBLE: 0x00
D (1995) NimBLE: 0x03
D (2005) NimBLE: 0x28
D (2005) NimBLE:

D (2065) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (2065) NimBLE: 0x05
D (2065) NimBLE: 0x00
D (2065) NimBLE: 0x04
D (2065) NimBLE: 0x00
D (2065) NimBLE: 0x01
D (2065) NimBLE: 0x08
D (2075) NimBLE: 0x05
D (2075) NimBLE: 0x00
D (2075) NimBLE: 0x0a
D (2075) NimBLE:

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

D (2095) NimBLE: host tx hci data; handle=1 length=11

D (2095) NimBLE: ble_hs_hci_acl_tx():
D (2105) NimBLE: 0x01
D (2105) NimBLE: 0x00
D (2105) NimBLE: 0x0b
D (2115) NimBLE: 0x00
D (2115) NimBLE: 0x07
D (2115) NimBLE: 0x00
D (2115) NimBLE: 0x04
D (2115) NimBLE: 0x00
D (2125) NimBLE: 0x08
D (2125) NimBLE: 0x06
D (2125) NimBLE: 0x00
D (2125) NimBLE: 0x09
D (2135) NimBLE: 0x00
D (2135) NimBLE: 0x03
D (2135) NimBLE: 0x28
D (2135) NimBLE:

D (2215) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=13 data=
D (2215) NimBLE: 0x09
D (2215) NimBLE: 0x00
D (2215) NimBLE: 0x04
D (2215) NimBLE: 0x00
D (2215) NimBLE: 0x09
D (2225) NimBLE: 0x07
D (2225) NimBLE: 0x07
D (2225) NimBLE: 0x00
D (2225) NimBLE: 0x20
D (2225) NimBLE: 0x08
D (2235) NimBLE: 0x00
D (2235) NimBLE: 0x05
D (2235) NimBLE: 0x2a
D (2235) NimBLE:

D (2245) NimBLE: host tx hci data; handle=1 length=11

D (2245) NimBLE: ble_hs_hci_acl_tx():
D (2255) NimBLE: 0x01
D (2255) NimBLE: 0x00
D (2255) NimBLE: 0x0b
D (2255) NimBLE: 0x00
D (2265) NimBLE: 0x07
D (2265) NimBLE: 0x00
D (2265) NimBLE: 0x04
D (2265) NimBLE: 0x00
D (2275) NimBLE: 0x08
D (2275) NimBLE: 0x08
D (2275) NimBLE: 0x00
D (2275) NimBLE: 0x09
D (2275) NimBLE: 0x00
D (2285) NimBLE: 0x03
D (2285) NimBLE: 0x28
D (2285) NimBLE:

D (2365) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (2365) NimBLE: 0x05
D (2365) NimBLE: 0x00
D (2365) NimBLE: 0x04
D (2365) NimBLE: 0x00
D (2365) NimBLE: 0x01
D (2365) NimBLE: 0x08
D (2375) NimBLE: 0x08
D (2375) NimBLE: 0x00
D (2375) NimBLE: 0x0a
D (2375) NimBLE:

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

D (2395) NimBLE: host tx hci data; handle=1 length=11

D (2395) NimBLE: ble_hs_hci_acl_tx():
D (2405) NimBLE: 0x01
D (2405) NimBLE: 0x00
D (2405) NimBLE: 0x0b
D (2415) NimBLE: 0x00
D (2415) NimBLE: 0x07
D (2415) NimBLE: 0x00
D (2415) NimBLE: 0x04
D (2425) NimBLE: 0x00
D (2425) NimBLE: 0x08
D (2425) NimBLE: 0x0a
D (2425) NimBLE: 0x00
D (2435) NimBLE: 0xff
D (2435) NimBLE: 0xff
D (2435) NimBLE: 0x03
D (2435) NimBLE: 0x28
D (2435) NimBLE:

D (2515) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=13 data=
D (2515) NimBLE: 0x09
D (2515) NimBLE: 0x00
D (2515) NimBLE: 0x04
D (2515) NimBLE: 0x00
D (2515) NimBLE: 0x09
D (2515) NimBLE: 0x07
D (2525) NimBLE: 0x0b
D (2525) NimBLE: 0x00
D (2525) NimBLE: 0x1a
D (2525) NimBLE: 0x0c
D (2535) NimBLE: 0x00
D (2535) NimBLE: 0xf1
D (2535) NimBLE: 0xab
D (2535) NimBLE:

D (2545) NimBLE: host tx hci data; handle=1 length=11

D (2545) NimBLE: ble_hs_hci_acl_tx():
D (2555) NimBLE: 0x01
D (2555) NimBLE: 0x00
D (2555) NimBLE: 0x0b
D (2555) NimBLE: 0x00
D (2565) NimBLE: 0x07
D (2565) NimBLE: 0x00
D (2565) NimBLE: 0x04
D (2565) NimBLE: 0x00
D (2565) NimBLE: 0x08
D (2575) NimBLE: 0x0c
D (2575) NimBLE: 0x00
D (2575) NimBLE: 0xff
D (2575) NimBLE: 0xff
D (2585) NimBLE: 0x03
D (2585) NimBLE: 0x28
D (2585) NimBLE:

D (2665) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (2665) NimBLE: 0x05
D (2665) NimBLE: 0x00
D (2665) NimBLE: 0x04
D (2665) NimBLE: 0x00
D (2665) NimBLE: 0x01
D (2665) NimBLE: 0x08
D (2675) NimBLE: 0x0c
D (2675) NimBLE: 0x00
D (2675) NimBLE: 0x0a
D (2675) NimBLE:

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

D (2695) NimBLE: host tx hci data; handle=1 length=9

D (2695) NimBLE: ble_hs_hci_acl_tx():
D (2705) NimBLE: 0x01
D (2705) NimBLE: 0x00
D (2705) NimBLE: 0x09
D (2715) NimBLE: 0x00
D (2715) NimBLE: 0x05
D (2715) NimBLE: 0x00
D (2715) NimBLE: 0x04
D (2715) NimBLE: 0x00
D (2725) NimBLE: 0x04
D (2725) NimBLE: 0x09
D (2725) NimBLE: 0x00
D (2725) NimBLE: 0x09
D (2735) NimBLE: 0x00
D (2735) NimBLE:

D (2815) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=10 data=
D (2815) NimBLE: 0x06
D (2815) NimBLE: 0x00
D (2815) NimBLE: 0x04
D (2815) NimBLE: 0x00
D (2815) NimBLE: 0x05
D (2815) NimBLE: 0x01
D (2825) NimBLE: 0x09
D (2825) NimBLE: 0x00
D (2825) NimBLE: 0x02
D (2825) NimBLE: 0x29
D (2835) NimBLE:

I (2835) NimBLE: GATT procedure initiated: discover all descriptors;
I (2845) NimBLE: chr_val_handle=12 end_handle=65535

D (2845) NimBLE: host tx hci data; handle=1 length=9

D (2855) NimBLE: ble_hs_hci_acl_tx():
D (2855) NimBLE: 0x01
D (2855) NimBLE: 0x00
D (2865) NimBLE: 0x09
D (2865) NimBLE: 0x00
D (2865) NimBLE: 0x05
D (2865) NimBLE: 0x00
D (2875) NimBLE: 0x04
D (2875) NimBLE: 0x00
D (2875) NimBLE: 0x04
D (2875) NimBLE: 0x0d
D (2875) NimBLE: 0x00
D (2885) NimBLE: 0xff
D (2885) NimBLE: 0xff
D (2885) NimBLE:

D (2965) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=10 data=
D (2965) NimBLE: 0x06
D (2965) NimBLE: 0x00
D (2965) NimBLE: 0x04
D (2965) NimBLE: 0x00
D (2965) NimBLE: 0x05
D (2965) NimBLE: 0x01
D (2975) NimBLE: 0x0d
D (2975) NimBLE: 0x00
D (2975) NimBLE: 0x02
D (2975) NimBLE: 0x29
D (2985) NimBLE:

D (2985) NimBLE: host tx hci data; handle=1 length=9

D (2985) NimBLE: ble_hs_hci_acl_tx():
D (2995) NimBLE: 0x01
D (2995) NimBLE: 0x00
D (2995) NimBLE: 0x09
D (3005) NimBLE: 0x00
D (3005) NimBLE: 0x05
D (3005) NimBLE: 0x00
D (3005) NimBLE: 0x04
D (3005) NimBLE: 0x00
D (3015) NimBLE: 0x04
D (3015) NimBLE: 0x0e
D (3015) NimBLE: 0x00
D (3015) NimBLE: 0xff
D (3025) NimBLE: 0xff
D (3025) NimBLE:

D (3115) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (3115) NimBLE: 0x05
D (3115) NimBLE: 0x00
D (3115) NimBLE: 0x04
D (3115) NimBLE: 0x00
D (3115) NimBLE: 0x01
D (3115) NimBLE: 0x04
D (3125) NimBLE: 0x0e
D (3125) NimBLE: 0x00
D (3125) NimBLE: 0x0a
D (3125) NimBLE:

I (3135) NimBLE: Service discovery complete; status=0 conn_handle=1

I (3135) NimBLE: GAP procedure initiated: discovery;
I (3145) NimBLE: own_addr_type=0 filter_policy=0 passive=1 limited=0 filter_duplicates=1
I (3155) NimBLE: duration=forever
I (3155) NimBLE:

D (3155) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000b len=7

D (3165) NimBLE: 0x0b
D (3165) NimBLE: 0x20
D (3175) NimBLE: 0x07
D (3175) NimBLE: 0x00
D (3175) NimBLE: 0x30
D (3175) NimBLE: 0x00
D (3185) NimBLE: 0x30
D (3185) NimBLE: 0x00
D (3185) NimBLE: 0x00
D (3185) NimBLE: 0x00
D (3195) NimBLE:

D (3195) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000c len=2

D (3195) NimBLE: 0x0c
D (3205) NimBLE: 0x20
D (3205) NimBLE: 0x02
D (3205) NimBLE: 0x01
D (3205) NimBLE: 0x01
D (3215) NimBLE:

D (3235) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3235) NimBLE: subevent: 0x2
D (3235) NimBLE:

D (3235) NimBLE: flags=0x06

D (3235) NimBLE: uuids16(complete)=
D (3235) NimBLE: 0xabf0
D (3245) NimBLE:
D (3245) NimBLE:

D (3245) NimBLE: name(complete)=nimble-ble-spp-svr

D (3255) NimBLE: tx_pwr_lvl=9

D (3255) NimBLE: Device already connected
D (3255) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3265) NimBLE: subevent: 0x2
D (3265) NimBLE:

D (3265) NimBLE: uuids16(complete)=
D (3275) NimBLE: 0xfef3
D (3275) NimBLE:
D (3275) NimBLE:

D (3285) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3285) NimBLE: subevent: 0x2
D (3285) NimBLE:

D (3285) NimBLE: flags=0x1a

D (3295) NimBLE: tx_pwr_lvl=-11

D (3295) NimBLE: svc_data_uuid16=
D (3305) NimBLE: 0x2c
D (3305) NimBLE: :0xfe
D (3305) NimBLE: :0x00
D (3305) NimBLE: :0x40
D (3305) NimBLE: :0x30
D (3315) NimBLE: :0x82
D (3315) NimBLE: :0x25
D (3315) NimBLE: :0x00
D (3315) NimBLE: :0x11
D (3325) NimBLE: :0xb8
D (3325) NimBLE: :0x34
D (3325) NimBLE: :0x5a
D (3325) NimBLE: :0x5a
D (3335) NimBLE: :0x41
D (3335) NimBLE:

D (3335) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3345) NimBLE: subevent: 0x2
D (3345) NimBLE:

D (3345) NimBLE: mfg_data=
D (3345) NimBLE: 0x06
D (3355) NimBLE: :0x00
D (3355) NimBLE: :0x01
D (3355) NimBLE: :0x09
D (3355) NimBLE: :0x20
D (3365) NimBLE: :0x02
D (3365) NimBLE: :0x57
D (3365) NimBLE: :0x2d
D (3365) NimBLE: :0xc8
D (3375) NimBLE: :0xa9
D (3375) NimBLE: :0x36
D (3375) NimBLE: :0x45
D (3375) NimBLE: :0x9e
D (3385) NimBLE: :0xdd
D (3385) NimBLE: :0x21
D (3385) NimBLE: :0x66
D (3385) NimBLE: :0xf2
D (3395) NimBLE: :0x2c
D (3395) NimBLE: :0xac
D (3395) NimBLE: :0xd9
D (3395) NimBLE: :0x0d
D (3405) NimBLE: :0x62
D (3405) NimBLE: :0xcf
D (3405) NimBLE: :0xb3
D (3405) NimBLE: :0x60
D (3415) NimBLE: :0x2b
D (3415) NimBLE: :0xd0
D (3415) NimBLE: :0xdc
D (3415) NimBLE: :0x43
D (3425) NimBLE:

D (3425) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3425) NimBLE: subevent: 0x2
D (3435) NimBLE:

D (3435) NimBLE: mfg_data=
D (3435) NimBLE: 0x06
D (3435) NimBLE: :0x00
D (3445) NimBLE: :0x01
D (3445) NimBLE: :0x09
D (3445) NimBLE: :0x20
D (3445) NimBLE: :0x02
D (3455) NimBLE: :0x5c
D (3455) NimBLE: :0xd3
D (3455) NimBLE: :0xbe
D (3455) NimBLE: :0xa2
D (3465) NimBLE: :0x53
D (3465) NimBLE: :0xf2
D (3465) NimBLE: :0xd9
D (3465) NimBLE: :0xa9
D (3465) NimBLE: :0x7a
D (3475) NimBLE: :0x7c
D (3475) NimBLE: :0x91
D (3475) NimBLE: :0xb5
D (3475) NimBLE: :0xd0
D (3485) NimBLE: :0x95
D (3485) NimBLE: :0x1c
D (3485) NimBLE: :0x8d
D (3485) NimBLE: :0x5c
D (3495) NimBLE: :0x88
D (3495) NimBLE: :0x1e
D (3495) NimBLE: :0xcd
D (3495) NimBLE: :0xdc
D (3505) NimBLE: :0x99
D (3505) NimBLE: :0xab
D (3505) NimBLE:

D (3505) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3515) NimBLE: subevent: 0x2
D (3515) NimBLE:

D (3515) NimBLE: flags=0x1a

D (3525) NimBLE: tx_pwr_lvl=12

D (3525) NimBLE: mfg_data=
D (3525) NimBLE: 0x4c
D (3535) NimBLE: :0x00
D (3535) NimBLE: :0x10
D (3535) NimBLE: :0x06
D (3535) NimBLE: :0x31
D (3545) NimBLE: :0x1e
D (3545) NimBLE: :0x69
D (3545) NimBLE: :0xdd
D (3545) NimBLE: :0x1f
D (3555) NimBLE: :0x1e
D (3555) NimBLE:

D (3555) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3565) NimBLE: subevent: 0x2
D (3565) NimBLE:

D (3565) NimBLE: flags=0x1a

D (3565) NimBLE: tx_pwr_lvl=24

D (3575) NimBLE: mfg_data=
D (3575) NimBLE: 0x4c
D (3575) NimBLE: :0x00
D (3585) NimBLE: :0x10
D (3585) NimBLE: :0x05
D (3585) NimBLE: :0x01
D (3585) NimBLE: :0x18
D (3595) NimBLE: :0x3b
D (3595) NimBLE: :0x63
D (3595) NimBLE: :0x05
D (3595) NimBLE:

D (3605) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3605) NimBLE: subevent: 0x2
D (3605) NimBLE:

D (3615) NimBLE: flags=0x1a

D (3615) NimBLE: tx_pwr_lvl=8

D (3615) NimBLE: mfg_data=
D (3625) NimBLE: 0x4c
D (3625) NimBLE: :0x00
D (3625) NimBLE: :0x10
D (3625) NimBLE: :0x05
D (3635) NimBLE: :0x3e
D (3635) NimBLE: :0x1c
D (3635) NimBLE: :0x4b
D (3635) NimBLE: :0xeb
D (3635) NimBLE: :0x2f
D (3645) NimBLE:

D (3645) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3645) NimBLE: subevent: 0x2
D (3655) NimBLE:

D (3655) NimBLE: flags=0x05

D (3655) NimBLE: uuids16(complete)=
D (3665) NimBLE: 0xfe95
D (3665) NimBLE:
D (3665) NimBLE: 0xb167
D (3665) NimBLE:
D (3675) NimBLE: 0xfee7
D (3675) NimBLE:
D (3675) NimBLE:

D (3675) NimBLE: mfg_data=
D (3685) NimBLE: 0x49
D (3685) NimBLE: :0x06
D (3685) NimBLE: :0x02
D (3685) NimBLE: :0x02
D (3695) NimBLE: :0x00
D (3695) NimBLE: :0x00
D (3695) NimBLE: :0x9c
D (3695) NimBLE: :0xf6
D (3705) NimBLE: :0xdd
D (3705) NimBLE: :0x37
D (3705) NimBLE: :0xda
D (3705) NimBLE: :0xc9
D (3715) NimBLE:

D (3715) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3715) NimBLE: subevent: 0x2
D (3725) NimBLE:

D (3725) NimBLE: flags=0x06

D (3725) NimBLE: mfg_data=
D (3725) NimBLE: 0x57
D (3735) NimBLE: :0x01
D (3735) NimBLE: :0x00
D (3735) NimBLE: :0x59
D (3735) NimBLE: :0x95
D (3745) NimBLE: :0x18
D (3745) NimBLE: :0xb6
D (3745) NimBLE: :0x8e
D (3745) NimBLE: :0xd6
D (3755) NimBLE: :0xe7
D (3755) NimBLE: :0xc9
D (3755) NimBLE: :0xaa
D (3755) NimBLE: :0x31
D (3765) NimBLE: :0x5a
D (3765) NimBLE: :0x1f
D (3765) NimBLE: :0x50
D (3765) NimBLE: :0xf6
D (3775) NimBLE: :0x88
D (3775) NimBLE: :0x17
D (3775) NimBLE: :0x02
D (3775) NimBLE: :0xf1
D (3785) NimBLE: :0x87
D (3785) NimBLE: :0xb1
D (3785) NimBLE: :0x87
D (3785) NimBLE: :0x2c
D (3795) NimBLE: :0xcf
D (3795) NimBLE:

D (3795) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3795) NimBLE: subevent: 0x2
D (3805) NimBLE:

D (3805) NimBLE: flags=0x04

D (3805) NimBLE: svc_data_uuid16=
D (3815) NimBLE: 0x02
D (3815) NimBLE: :0x38
D (3815) NimBLE: :0xd8
D (3815) NimBLE: :0x8a
D (3825) NimBLE: :0xdc
D (3825) NimBLE: :0x99
D (3825) NimBLE: :0x23
D (3825) NimBLE: :0x46
D (3835) NimBLE:

D (3835) NimBLE: mfg_data=
D (3835) NimBLE: 0x7d
D (3835) NimBLE: :0x02
D (3845) NimBLE: :0x01
D (3845) NimBLE: :0x03
D (3845) NimBLE: :0x00
D (3845) NimBLE: :0xff
D (3855) NimBLE: :0xcc
D (3855) NimBLE:

D (3855) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3865) NimBLE: subevent: 0x2
D (3865) NimBLE:

D (3865) NimBLE: uuids16(complete)=
D (3875) NimBLE: 0xfef3
D (3875) NimBLE:
D (3875) NimBLE:

D (3885) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (3885) NimBLE: subevent: 0x2
D (3885) NimBLE:

D (3885) NimBLE: flags=0x06

D (3895) NimBLE: uuids128(incomplete)=
D (3895) NimBLE: abbaff00-e56a-484c-b832-8b17cf6cbfe8
D (3905) NimBLE:
D (3905) NimBLE:

D (3905) NimBLE: svc_data_uuid16=
D (3905) NimBLE: 0x0a
D (3915) NimBLE: :0x18
D (3915) NimBLE: :0x30
D (3915) NimBLE: :0x04
D (3915) NimBLE: :0xd0
D (3925) NimBLE: :0xe1
D (3925) NimBLE: :0x01
D (3925) NimBLE:

D (4085) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (4085) NimBLE: subevent: 0x2
D (4085) NimBLE:

D (4085) NimBLE: flags=0x06

D (4085) NimBLE: name(complete)=NinjaCalling

D (4095) NimBLE: svc_data_uuid16=
D (4095) NimBLE: 0xea
D (4095) NimBLE: :0xfe
D (4095) NimBLE: :0x47
D (4105) NimBLE: :0x4f
D (4105) NimBLE: :0x4b
D (4105) NimBLE: :0x04
D (4105) NimBLE: :0x01
D (4115) NimBLE: :0x00
D (4115) NimBLE: :0x90
D (4115) NimBLE:

D (4165) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (4165) NimBLE: subevent: 0x2
D (4165) NimBLE:

D (4165) NimBLE: mfg_data=
D (4175) NimBLE: 0x4c
D (4175) NimBLE: :0x00
D (4175) NimBLE: :0x12
D (4175) NimBLE: :0x02
D (4185) NimBLE: :0x00
D (4185) NimBLE: :0x01
D (4185) NimBLE:

D (4305) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (4305) NimBLE: subevent: 0x2
D (4305) NimBLE:

D (4305) NimBLE: mfg_data=
D (4305) NimBLE: 0x4c
D (4315) NimBLE: :0x00
D (4315) NimBLE: :0x12
D (4315) NimBLE: :0x02
D (4315) NimBLE: :0x00
D (4325) NimBLE: :0x02
D (4325) NimBLE:

D (5055) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (5055) NimBLE: subevent: 0x2
D (5055) NimBLE:

D (5055) NimBLE: mfg_data=
D (5065) NimBLE: 0x4c
D (5065) NimBLE: :0x00
D (5065) NimBLE: :0x12
D (5065) NimBLE: :0x19
D (5065) NimBLE: :0x00
D (5075) NimBLE: :0x86
D (5075) NimBLE: :0xf2
D (5075) NimBLE: :0xfe
D (5075) NimBLE: :0x58
D (5085) NimBLE: :0x10
D (5085) NimBLE: :0xb5
D (5085) NimBLE: :0x2c
D (5085) NimBLE: :0x1c
D (5095) NimBLE: :0x76
D (5095) NimBLE: :0x12
D (5095) NimBLE: :0xd4
D (5095) NimBLE: :0x27
D (5105) NimBLE: :0xfd
D (5105) NimBLE: :0xec
D (5105) NimBLE: :0x53
D (5105) NimBLE: :0x1b
D (5115) NimBLE: :0x86
D (5115) NimBLE: :0xd8
D (5115) NimBLE: :0x01
D (5115) NimBLE: :0xa4
D (5125) NimBLE: :0xa9
D (5125) NimBLE: :0x3a
D (5125) NimBLE: :0x01
D (5125) NimBLE: :0x00
D (5135) NimBLE:

D (6285) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (6285) NimBLE: subevent: 0x2
D (6285) NimBLE:

D (6285) NimBLE: mfg_data=
D (6285) NimBLE: 0x4c
D (6295) NimBLE: :0x00
D (6295) NimBLE: :0x12
D (6295) NimBLE: :0x02
D (6295) NimBLE: :0x00
D (6305) NimBLE: :0x01
D (6305) NimBLE:

D (6725) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (6725) NimBLE: subevent: 0x2
D (6725) NimBLE:

D (6725) NimBLE: mfg_data=
D (6725) NimBLE: 0x4c
D (6725) NimBLE: :0x00
D (6725) NimBLE: :0x12
D (6735) NimBLE: :0x02
D (6735) NimBLE: :0x00
D (6735) NimBLE: :0x03
D (6735) NimBLE:

D (9795) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (9795) NimBLE: subevent: 0x2
D (9795) NimBLE:

D (9795) NimBLE: flags=0x06

D (9805) NimBLE: name(complete)=FB BSW049

D (9805) NimBLE: svc_data_uuid16=
D (9805) NimBLE: 0xea
D (9815) NimBLE: :0xfe
D (9815) NimBLE: :0x48
D (9815) NimBLE: :0x46
D (9815) NimBLE: :0x52
D (9825) NimBLE: :0x04
D (9825) NimBLE: :0x01
D (9825) NimBLE: :0x00
D (9825) NimBLE: :0x91
D (9835) NimBLE:

I (10465) NimBLE: GATT procedure initiated: write;
I (10465) NimBLE: att_handle=12 len=1

D (10465) NimBLE: host tx hci data; handle=1 length=8

D (10465) NimBLE: ble_hs_hci_acl_tx():
D (10475) NimBLE: 0x01
D (10475) NimBLE: 0x00
D (10475) NimBLE: 0x08
D (10475) NimBLE: 0x00
D (10485) NimBLE: 0x04
D (10485) NimBLE: 0x00
D (10485) NimBLE: 0x04
D (10485) NimBLE: 0x00
D (10495) NimBLE: 0x12
D (10495) NimBLE: 0x0c
D (10495) NimBLE: 0x00
D (10495) NimBLE: 0x61
D (10505) NimBLE:

I (10505) NimBLE_SPP_BLE_CENT: Write in uart task success!
D (10565) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=5 data=
D (10565) NimBLE: 0x01
D (10565) NimBLE: 0x00
D (10565) NimBLE: 0x04
D (10565) NimBLE: 0x00
D (10565) NimBLE: 0x13
D (10575) NimBLE:

D (11105) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (11105) NimBLE: subevent: 0x2
D (11105) NimBLE:

D (11105) NimBLE: flags=0x1a

D (11105) NimBLE: tx_pwr_lvl=8

D (11105) NimBLE: mfg_data=
D (11115) NimBLE: 0x4c
D (11115) NimBLE: :0x00
D (11115) NimBLE: :0x10
D (11115) NimBLE: :0x05
D (11125) NimBLE: :0x3d
D (11125) NimBLE: :0x1c
D (11125) NimBLE: :0x13
D (11125) NimBLE: :0xb0
D (11135) NimBLE: :0x03
D (11135) NimBLE:

D (15595) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (15595) NimBLE: subevent: 0x2
D (15595) NimBLE:

D (15595) NimBLE: flags=0x02

D (15595) NimBLE: mfg_data=
D (15595) NimBLE: 0x75
D (15595) NimBLE: :0x00
D (15605) NimBLE: :0x02
D (15605) NimBLE: :0x18
D (15605) NimBLE: :0x31
D (15605) NimBLE: :0xa1
D (15615) NimBLE: :0xf6
D (15615) NimBLE: :0x6c
D (15615) NimBLE: :0x84
D (15615) NimBLE: :0xe5
D (15625) NimBLE: :0x82
D (15625) NimBLE: :0x86
D (15625) NimBLE: :0xef
D (15625) NimBLE: :0xc4
D (15635) NimBLE: :0x84
D (15635) NimBLE: :0xbd
D (15635) NimBLE: :0xb2
D (15635) NimBLE: :0xee
D (15645) NimBLE: :0xbd
D (15645) NimBLE: :0xe6
D (15645) NimBLE: :0xf4
D (15645) NimBLE: :0x65
D (15655) NimBLE: :0xe3
D (15655) NimBLE: :0x48
D (15655) NimBLE:

I (15705) NimBLE: GATT procedure initiated: write;
I (15705) NimBLE: att_handle=12 len=1

D (15705) NimBLE: host tx hci data; handle=1 length=8

D (15705) NimBLE: ble_hs_hci_acl_tx():
D (15715) NimBLE: 0x01
D (15715) NimBLE: 0x00
D (15715) NimBLE: 0x08
D (15715) NimBLE: 0x00
D (15725) NimBLE: 0x04
D (15725) NimBLE: 0x00
D (15725) NimBLE: 0x04
D (15725) NimBLE: 0x00
D (15735) NimBLE: 0x12
D (15735) NimBLE: 0x0c
D (15735) NimBLE: 0x00
D (15735) NimBLE: 0x61
D (15745) NimBLE:

I (15745) NimBLE_SPP_BLE_CENT: Write in uart task success!
D (15815) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=5 data=
D (15815) NimBLE: 0x01
D (15815) NimBLE: 0x00
D (15815) NimBLE: 0x04
D (15815) NimBLE: 0x00
D (15815) NimBLE: 0x13
D (15815) NimBLE:

D (18555) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (18555) NimBLE: subevent: 0x2
D (18555) NimBLE:

D (18555) NimBLE: uuids16(complete)=
D (18565) NimBLE: 0xfef3
D (18565) NimBLE:
D (18565) NimBLE:

D (19285) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (19285) NimBLE: subevent: 0x2
D (19285) NimBLE:

D (19285) NimBLE: mfg_data=
D (19295) NimBLE: 0x4c
D (19295) NimBLE: :0x00
D (19295) NimBLE: :0x12
D (19295) NimBLE: :0x02
D (19305) NimBLE: :0x00
D (19305) NimBLE: :0x01
D (19305) NimBLE:

D (20065) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (20075) NimBLE: subevent: 0x2
D (20075) NimBLE:

D (20075) NimBLE: flags=0x06

D (20075) NimBLE: uuids16(complete)=
D (20075) NimBLE: 0x0af0
D (20075) NimBLE:
D (20085) NimBLE:

D (20085) NimBLE: mfg_data=
D (20085) NimBLE: 0xf9
D (20085) NimBLE: :0x2d
D (20095) NimBLE: :0x37
D (20095) NimBLE: :0x0a
D (20095) NimBLE: :0x18
D (20095) NimBLE: :0xe2
D (20105) NimBLE:

I (47235) NimBLE: GATT procedure initiated: write;
I (47235) NimBLE: att_handle=12 len=1

D (47235) NimBLE: host tx hci data; handle=1 length=8

D (47235) NimBLE: ble_hs_hci_acl_tx():
D (47245) NimBLE: 0x01
D (47245) NimBLE: 0x00
D (47245) NimBLE: 0x08
D (47255) NimBLE: 0x00
D (47255) NimBLE: 0x04
D (47255) NimBLE: 0x00
D (47255) NimBLE: 0x04
D (47265) NimBLE: 0x00
D (47265) NimBLE: 0x12
D (47265) NimBLE: 0x0c
D (47265) NimBLE: 0x00
D (47275) NimBLE: 0x32
D (47275) NimBLE:

I (47275) NimBLE_SPP_BLE_CENT: Write in uart task success!
D (47365) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=5 data=
D (47365) NimBLE: 0x01
D (47365) NimBLE: 0x00
D (47365) NimBLE: 0x04
D (47365) NimBLE: 0x00
D (47365) NimBLE: 0x13
D (47375) NimBLE:

Log of server:

I (220570) NimBLE: connection established; status=0
I (220570) NimBLE: handle=1 our_ota_addr_type=0 our_ota_addr=
I (220570) NimBLE: 34:85:18:8e:b6:a6
I (220570) NimBLE: our_id_addr_type=0 our_id_addr=
I (220580) NimBLE: 34:85:18:8e:b6:a6
I (220580) NimBLE: peer_ota_addr_type=0 peer_ota_addr=
I (220590) NimBLE: f4:12:fa:81:4c:5e
I (220590) NimBLE: peer_id_addr_type=0 peer_id_addr=
I (220600) NimBLE: f4:12:fa:81:4c:5e
I (220600) NimBLE: conn_itvl=40 conn_latency=0 supervision_timeout=256 encrypte d=0 authenticated=0 bonded=0

I (220610) NimBLE:

I (220620) NimBLE: GAP procedure initiated: advertise;
I (220620) NimBLE: disc_mode=2
I (220630) NimBLE: adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_it vl_min=0 adv_itvl_max=0
I (220640) NimBLE:

I (229570) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
I (234820) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
I (266370) 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.

@rahult-github
Copy link
Collaborator

rahult-github commented Sep 13, 2023

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 ,

  1. in Gatt, client queries and server responds.
  2. When you use default application, does server get data ?
  3. It is now mentioned that you modified server side code to attempt something. Not sure what changes you have done. So please check if the changes you are attempting are valid or not ?

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
I (234820) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
I (266370) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c

@Firmware-beginner
Copy link
Author

  1. I have mentioned that I tested it by connecting mobile phone to esp board (server).
    Connection was established and I could send data from a mobile phone (application) and receive that data back on mobile.

@rahult-github
Copy link
Collaborator

As requested , please share server side debug enabled logs and the changes done on server side

@Firmware-beginner
Copy link
Author

I (26069) NimBLE: connection established; status=0
I (26069) NimBLE: handle=1 our_ota_addr_type=0 our_ota_addr=
I (26079) NimBLE: 34:85:18:8e:b6:a6
I (26079) NimBLE: our_id_addr_type=0 our_id_addr=
I (26089) NimBLE: 34:85:18:8e:b6:a6
I (26089) NimBLE: peer_ota_addr_type=0 peer_ota_addr=
I (26099) NimBLE: f4:12:fa:81:4c:5e
I (26099) NimBLE: peer_id_addr_type=0 peer_id_addr=
I (26109) NimBLE: f4:12:fa:81:4c:5e
I (26109) NimBLE: conn_itvl=40 conn_latency=0 supervision_timeout=256 encrypted=0 authenticated=0 bonded=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: 0x20
D (26139) NimBLE: 0x00
D (26139) NimBLE:

D (26139) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0008 len=32

D (26149) NimBLE: 0x08
D (26149) NimBLE: 0x20
D (26149) NimBLE: 0x20
D (26159) NimBLE: 0x1e
D (26159) NimBLE: 0x02
D (26159) NimBLE: 0x01
D (26159) NimBLE: 0x06
D (26169) NimBLE: 0x03
D (26169) NimBLE: 0x03
D (26169) NimBLE: 0xf0
D (26169) NimBLE: 0xab
D (26179) NimBLE: 0x13
D (26179) NimBLE: 0x09
D (26179) NimBLE: 0x6e
D (26179) NimBLE: 0x69
D (26189) NimBLE: 0x6d
D (26189) NimBLE: 0x62
D (26189) NimBLE: 0x6c
D (26189) NimBLE: 0x65
D (26199) NimBLE: 0x2d
D (26199) NimBLE: 0x62
D (26199) NimBLE: 0x6c
D (26199) NimBLE: 0x65
D (26209) NimBLE: 0x2d
D (26209) NimBLE: 0x73
D (26209) NimBLE: 0x70
D (26209) NimBLE: 0x70
D (26219) NimBLE: 0x2d
D (26219) NimBLE: 0x73
D (26219) NimBLE: 0x76
D (26219) NimBLE: 0x72
D (26229) NimBLE: 0x02
D (26229) NimBLE: 0x0a
D (26229) NimBLE: 0x09
D (26229) NimBLE: 0x3f
D (26239) NimBLE:

I (26239) NimBLE: GAP procedure initiated: advertise;
I (26249) NimBLE: disc_mode=2
I (26249) NimBLE: adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (26259) NimBLE:

D (26259) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0006 len=15

D (26269) NimBLE: 0x06
D (26269) NimBLE: 0x20
D (26269) NimBLE: 0x0f
D (26279) NimBLE: 0x30
D (26279) NimBLE: 0x00
D (26279) NimBLE: 0x60
D (26279) NimBLE: 0x00
D (26289) NimBLE: 0x00
D (26289) NimBLE: 0x00
D (26289) NimBLE: 0x00
D (26289) NimBLE: 0x00
D (26299) NimBLE: 0x00
D (26299) NimBLE: 0x00
D (26299) NimBLE: 0x00
D (26299) NimBLE: 0x00
D (26309) NimBLE: 0x00
D (26309) NimBLE: 0x07
D (26309) NimBLE: 0x00
D (26309) NimBLE:

D (26319) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x000a len=1

D (26319) NimBLE: 0x0a
D (26319) NimBLE: 0x20
D (26329) NimBLE: 0x01
D (26329) NimBLE: 0x01
D (26329) NimBLE:

D (26329) NimBLE: ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0016 len=2

D (26339) NimBLE: 0x16
D (26339) NimBLE: 0x20
D (26349) NimBLE: 0x02
D (26349) NimBLE: 0x01
D (26349) NimBLE: 0x00
D (26349) NimBLE:

D (26359) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (26359) NimBLE: subevent: 0x14
D (26359) NimBLE:

D (26369) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (26369) NimBLE: 0x07
D (26379) NimBLE: 0x00
D (26379) NimBLE: 0x04
D (26379) NimBLE: 0x00
D (26379) NimBLE: 0x10
D (26389) NimBLE: 0x01
D (26389) NimBLE: 0x00
D (26389) NimBLE: 0xff
D (26389) NimBLE: 0xff
D (26399) NimBLE: 0x00
D (26399) NimBLE: 0x28
D (26399) NimBLE:

D (26399) NimBLE: host tx hci data; handle=1 length=24

D (26409) NimBLE: ble_hs_hci_acl_tx():
D (26409) NimBLE: 0x01
D (26409) NimBLE: 0x00
D (26419) NimBLE: 0x18
D (26419) NimBLE: 0x00
D (26419) NimBLE: 0x14
D (26419) NimBLE: 0x00
D (26429) NimBLE: 0x04
D (26429) NimBLE: 0x00
D (26429) NimBLE: 0x11
D (26439) NimBLE: 0x06
D (26439) NimBLE: 0x01
D (26439) NimBLE: 0x00
D (26439) NimBLE: 0x05
D (26449) NimBLE: 0x00
D (26449) NimBLE: 0x00
D (26449) NimBLE: 0x18
D (26449) NimBLE: 0x06
D (26459) NimBLE: 0x00
D (26459) NimBLE: 0x09
D (26459) NimBLE: 0x00
D (26459) NimBLE: 0x01
D (26469) NimBLE: 0x18
D (26469) NimBLE: 0x0a
D (26469) NimBLE: 0x00
D (26469) NimBLE: 0xff
D (26479) NimBLE: 0xff
D (26479) NimBLE: 0xf0
D (26479) NimBLE: 0xab
D (26479) NimBLE:

D (26489) NimBLE: ble_hs_event_rx_hci_ev; opcode=0x3e
D (26489) NimBLE: subevent: 0x4
D (26489) NimBLE:

D (26689) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (26689) NimBLE: 0x07
D (26689) NimBLE: 0x00
D (26689) NimBLE: 0x04
D (26689) NimBLE: 0x00
D (26689) NimBLE: 0x08
D (26689) NimBLE: 0x01
D (26699) NimBLE: 0x00
D (26699) NimBLE: 0x05
D (26699) NimBLE: 0x00
D (26699) NimBLE: 0x03
D (26709) NimBLE: 0x28
D (26709) NimBLE:

D (26709) NimBLE: host tx hci data; handle=1 length=20

D (26719) NimBLE: ble_hs_hci_acl_tx():
D (26719) NimBLE: 0x01
D (26719) NimBLE: 0x00
D (26729) NimBLE: 0x14
D (26729) NimBLE: 0x00
D (26729) NimBLE: 0x10
D (26729) NimBLE: 0x00
D (26739) NimBLE: 0x04
D (26739) NimBLE: 0x00
D (26739) NimBLE: 0x09
D (26739) NimBLE: 0x07
D (26749) NimBLE: 0x02
D (26749) NimBLE: 0x00
D (26749) NimBLE: 0x02
D (26749) NimBLE: 0x03
D (26759) NimBLE: 0x00
D (26759) NimBLE: 0x00
D (26759) NimBLE: 0x2a
D (26759) NimBLE: 0x04
D (26769) NimBLE: 0x00
D (26769) NimBLE: 0x02
D (26769) NimBLE: 0x05
D (26769) NimBLE: 0x00
D (26779) NimBLE: 0x01
D (26779) NimBLE: 0x2a
D (26779) NimBLE:

D (26889) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (26889) NimBLE: 0x07
D (26889) NimBLE: 0x00
D (26889) NimBLE: 0x04
D (26889) NimBLE: 0x00
D (26889) NimBLE: 0x08
D (26889) NimBLE: 0x05
D (26899) NimBLE: 0x00
D (26899) NimBLE: 0x05
D (26899) NimBLE: 0x00
D (26899) NimBLE: 0x03
D (26909) NimBLE: 0x28
D (26909) NimBLE:

D (26909) NimBLE: host tx hci data; handle=1 length=9

D (26919) NimBLE: ble_hs_hci_acl_tx():
D (26919) NimBLE: 0x01
D (26919) NimBLE: 0x00
D (26929) NimBLE: 0x09
D (26929) NimBLE: 0x00
D (26929) NimBLE: 0x05
D (26929) NimBLE: 0x00
D (26939) NimBLE: 0x04
D (26939) NimBLE: 0x00
D (26939) NimBLE: 0x01
D (26939) NimBLE: 0x08
D (26949) NimBLE: 0x05
D (26949) NimBLE: 0x00
D (26949) NimBLE: 0x0a
D (26949) NimBLE:

D (27089) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (27089) NimBLE: 0x07
D (27089) NimBLE: 0x00
D (27089) NimBLE: 0x04
D (27089) NimBLE: 0x00
D (27089) NimBLE: 0x08
D (27089) NimBLE: 0x06
D (27099) NimBLE: 0x00
D (27099) NimBLE: 0x09
D (27099) NimBLE: 0x00
D (27099) NimBLE: 0x03
D (27109) NimBLE: 0x28
D (27109) NimBLE:

D (27109) NimBLE: host tx hci data; handle=1 length=13

D (27119) NimBLE: ble_hs_hci_acl_tx():
D (27119) NimBLE: 0x01
D (27119) NimBLE: 0x00
D (27129) NimBLE: 0x0d
D (27129) NimBLE: 0x00
D (27129) NimBLE: 0x09
D (27129) NimBLE: 0x00
D (27139) NimBLE: 0x04
D (27139) NimBLE: 0x00
D (27139) NimBLE: 0x09
D (27139) NimBLE: 0x07
D (27149) NimBLE: 0x07
D (27149) NimBLE: 0x00
D (27149) NimBLE: 0x20
D (27149) NimBLE: 0x08
D (27159) NimBLE: 0x00
D (27159) NimBLE: 0x05
D (27159) NimBLE: 0x2a
D (27159) NimBLE:

D (27289) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (27289) NimBLE: 0x07
D (27289) NimBLE: 0x00
D (27289) NimBLE: 0x04
D (27289) NimBLE: 0x00
D (27289) NimBLE: 0x08
D (27289) NimBLE: 0x08
D (27299) NimBLE: 0x00
D (27299) NimBLE: 0x09
D (27299) NimBLE: 0x00
D (27299) NimBLE: 0x03
D (27309) NimBLE: 0x28
D (27309) NimBLE:

D (27309) NimBLE: host tx hci data; handle=1 length=9

D (27319) NimBLE: ble_hs_hci_acl_tx():
D (27319) NimBLE: 0x01
D (27319) NimBLE: 0x00
D (27329) NimBLE: 0x09
D (27329) NimBLE: 0x00
D (27329) NimBLE: 0x05
D (27329) NimBLE: 0x00
D (27339) NimBLE: 0x04
D (27339) NimBLE: 0x00
D (27339) NimBLE: 0x01
D (27339) NimBLE: 0x08
D (27349) NimBLE: 0x08
D (27349) NimBLE: 0x00
D (27349) NimBLE: 0x0a
D (27349) NimBLE:

D (27489) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (27489) NimBLE: 0x07
D (27489) NimBLE: 0x00
D (27489) NimBLE: 0x04
D (27489) NimBLE: 0x00
D (27489) NimBLE: 0x08
D (27489) NimBLE: 0x0a
D (27499) NimBLE: 0x00
D (27499) NimBLE: 0xff
D (27499) NimBLE: 0xff
D (27499) NimBLE: 0x03
D (27509) NimBLE: 0x28
D (27509) NimBLE:

D (27509) NimBLE: host tx hci data; handle=1 length=13

D (27519) NimBLE: ble_hs_hci_acl_tx():
D (27519) NimBLE: 0x01
D (27519) NimBLE: 0x00
D (27529) NimBLE: 0x0d
D (27529) NimBLE: 0x00
D (27529) NimBLE: 0x09
D (27529) NimBLE: 0x00
D (27539) NimBLE: 0x04
D (27539) NimBLE: 0x00
D (27539) NimBLE: 0x09
D (27539) NimBLE: 0x07
D (27549) NimBLE: 0x0b
D (27549) NimBLE: 0x00
D (27549) NimBLE: 0x1a
D (27549) NimBLE: 0x0c
D (27559) NimBLE: 0x00
D (27559) NimBLE: 0xf1
D (27559) NimBLE: 0xab
D (27559) NimBLE:

D (27689) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=11 data=
D (27689) NimBLE: 0x07
D (27689) NimBLE: 0x00
D (27689) NimBLE: 0x04
D (27689) NimBLE: 0x00
D (27689) NimBLE: 0x08
D (27689) NimBLE: 0x0c
D (27699) NimBLE: 0x00
D (27699) NimBLE: 0xff
D (27699) NimBLE: 0xff
D (27699) NimBLE: 0x03
D (27709) NimBLE: 0x28
D (27709) NimBLE:

D (27709) NimBLE: host tx hci data; handle=1 length=9

D (27719) NimBLE: ble_hs_hci_acl_tx():
D (27719) NimBLE: 0x01
D (27719) NimBLE: 0x00
D (27729) NimBLE: 0x09
D (27729) NimBLE: 0x00
D (27729) NimBLE: 0x05
D (27729) NimBLE: 0x00
D (27739) NimBLE: 0x04
D (27739) NimBLE: 0x00
D (27739) NimBLE: 0x01
D (27739) NimBLE: 0x08
D (27749) NimBLE: 0x0c
D (27749) NimBLE: 0x00
D (27749) NimBLE: 0x0a
D (27749) NimBLE:

D (27889) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (27889) NimBLE: 0x05
D (27889) NimBLE: 0x00
D (27889) NimBLE: 0x04
D (27889) NimBLE: 0x00
D (27889) NimBLE: 0x04
D (27889) NimBLE: 0x09
D (27899) NimBLE: 0x00
D (27899) NimBLE: 0x09
D (27899) NimBLE: 0x00
D (27899) NimBLE:

D (27909) NimBLE: host tx hci data; handle=1 length=10

D (27909) NimBLE: ble_hs_hci_acl_tx():
D (27919) NimBLE: 0x01
D (27919) NimBLE: 0x00
D (27919) NimBLE: 0x0a
D (27919) NimBLE: 0x00
D (27929) NimBLE: 0x06
D (27929) NimBLE: 0x00
D (27929) NimBLE: 0x04
D (27929) NimBLE: 0x00
D (27939) NimBLE: 0x05
D (27939) NimBLE: 0x01
D (27939) NimBLE: 0x09
D (27939) NimBLE: 0x00
D (27949) NimBLE: 0x02
D (27949) NimBLE: 0x29
D (27949) NimBLE:

D (28089) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (28089) NimBLE: 0x05
D (28089) NimBLE: 0x00
D (28089) NimBLE: 0x04
D (28089) NimBLE: 0x00
D (28089) NimBLE: 0x04
D (28089) NimBLE: 0x0d
D (28099) NimBLE: 0x00
D (28099) NimBLE: 0xff
D (28099) NimBLE: 0xff
D (28099) NimBLE:

D (28109) NimBLE: host tx hci data; handle=1 length=10

D (28109) NimBLE: ble_hs_hci_acl_tx():
D (28119) NimBLE: 0x01
D (28119) NimBLE: 0x00
D (28119) NimBLE: 0x0a
D (28119) NimBLE: 0x00
D (28129) NimBLE: 0x06
D (28129) NimBLE: 0x00
D (28129) NimBLE: 0x04
D (28129) NimBLE: 0x00
D (28139) NimBLE: 0x05
D (28139) NimBLE: 0x01
D (28139) NimBLE: 0x0d
D (28139) NimBLE: 0x00
D (28149) NimBLE: 0x02
D (28149) NimBLE: 0x29
D (28149) NimBLE:

D (28339) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=9 data=
D (28339) NimBLE: 0x05
D (28339) NimBLE: 0x00
D (28339) NimBLE: 0x04
D (28339) NimBLE: 0x00
D (28339) NimBLE: 0x04
D (28339) NimBLE: 0x0e
D (28349) NimBLE: 0x00
D (28349) NimBLE: 0xff
D (28349) NimBLE: 0xff
D (28349) NimBLE:

D (28359) NimBLE: host tx hci data; handle=1 length=9

D (28359) NimBLE: ble_hs_hci_acl_tx():
D (28369) NimBLE: 0x01
D (28369) NimBLE: 0x00
D (28369) NimBLE: 0x09
D (28369) NimBLE: 0x00
D (28379) NimBLE: 0x05
D (28379) NimBLE: 0x00
D (28379) NimBLE: 0x04
D (28379) NimBLE: 0x00
D (28389) NimBLE: 0x01
D (28389) NimBLE: 0x04
D (28389) NimBLE: 0x0e
D (28389) NimBLE: 0x00
D (28399) NimBLE: 0x0a
D (28399) NimBLE:

D (39839) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=8 data=
D (39839) NimBLE: 0x04
D (39839) NimBLE: 0x00
D (39839) NimBLE: 0x04
D (39839) NimBLE: 0x00
D (39839) NimBLE: 0x12
D (39839) NimBLE: 0x0c
D (39849) NimBLE: 0x00
D (39849) NimBLE: 0x61
D (39849) NimBLE:

I (39849) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
D (39859) NimBLE: host tx hci data; handle=1 length=5

D (39869) NimBLE: ble_hs_hci_acl_tx():
D (39869) NimBLE: 0x01
D (39869) NimBLE: 0x00
D (39879) NimBLE: 0x05
D (39879) NimBLE: 0x00
D (39879) NimBLE: 0x01
D (39879) NimBLE: 0x00
D (39889) NimBLE: 0x04
D (39889) NimBLE: 0x00
D (39889) NimBLE: 0x13
D (39889) NimBLE:

D (59889) NimBLE: ble_hs_hci_evt_acl_process(): conn_handle=1 pb=2 len=8 data=
D (59889) NimBLE: 0x04
D (59889) NimBLE: 0x00
D (59889) NimBLE: 0x04
D (59889) NimBLE: 0x00
D (59889) NimBLE: 0x12
D (59889) NimBLE: 0x0c
D (59899) NimBLE: 0x00
D (59899) NimBLE: 0x61
D (59899) NimBLE:

I (59899) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
D (59909) NimBLE: host tx hci data; handle=1 length=5

D (59919) NimBLE: ble_hs_hci_acl_tx():
D (59919) NimBLE: 0x01
D (59919) NimBLE: 0x00
D (59929) NimBLE: 0x05
D (59929) NimBLE: 0x00
D (59929) NimBLE: 0x01
D (59929) NimBLE: 0x00
D (59939) NimBLE: 0x04
D (59939) NimBLE: 0x00
D (59939) NimBLE: 0x13
D (59939) NimBLE:

@rahult-github
Copy link
Collaborator

Can you please share the server side changes. It will help to reproduce issue locally and debug.

@Firmware-beginner
Copy link
Author

Hi @rahult-github

In Callback function for custom service (ble_svc_gatt_handler)
at case BLE_GATT_ACCESS_OP_WRITE_CHR:
trying to access received data and send it to connected client

/* Callback function for custom service */
static int ble_svc_gatt_handler(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg)
{
int rc = 0;

switch (ctxt->op) {
case BLE_GATT_ACCESS_OP_READ_CHR:
    MODLOG_DFLT(INFO, "Callback for read");		
    break;

case BLE_GATT_ACCESS_OP_WRITE_CHR:
    MODLOG_DFLT(INFO, "Data received in write event,conn_handle = %x,attr_handle = %x", conn_handle, attr_handle);

#if(1) /* BLE Loopback code /
for (int i = 0; i <= CONFIG_BT_NIMBLE_MAX_CONNECTIONS; i++) {
/
Check if client has subscribed to notifications */
if (conn_handle_subs[i]) {
struct os_mbuf *txom;
txom = ble_hs_mbuf_from_flat(ctxt->om->om_data, ctxt->om->om_len); //MODIFIED
rc = ble_gatts_notify_custom(i, 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);
}
}
}
#endif
break;

default:
    MODLOG_DFLT(INFO, "\nDefault Callback");
    break;
}
return 0;

}

@rahult-github
Copy link
Collaborator

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.

  1. There is a check for conn_handle_subs[i] value. This array gets updated when client "subscribes" to server for notifications. In original client code, we do not do any subscription. So this "if" condition will never be true.
  2. I see that the loop runs for max conn. Since example has only one connection , i replaced the value of i with conn_handle directly. So, the new code i used now is :

`

           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; 
I (2933) NimBLE: disc_mode=2
I (2943) NimBLE: adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (2953) NimBLE:

I (5383) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
I (5383) NimBLE: GATT procedure initiated: notify;
I (5383) NimBLE: att_handle=12

I (5393) NimBLE: Notification sent successfully
I (8583) NimBLE: Data received in write event,conn_handle = 1,attr_handle = c
I (8583) NimBLE: GATT procedure initiated: notify;
I (8583) NimBLE: att_handle=12

I (8593) NimBLE: Notification sent successfully

`

Client log:

`

I (1573) NimBLE: GAP procedure initiated: discovery; 
I (1573) NimBLE: own_addr_type=0 filter_policy=0 passive=1 limited=0 filter_duplicates=1
I (1583) NimBLE: duration=forever
I (1583) NimBLE:

I (3053) NimBLE: GATT procedure initiated: write;
I (3053) NimBLE: att_handle=12 len=1

I (3053) NimBLE_SPP_BLE_CENT: Write in uart task success!
I (3123) NimBLE: received notification; conn_handle=1 attr_handle=12 attr_len=1

I (6253) NimBLE: GATT procedure initiated: write;
I (6253) NimBLE: att_handle=12 len=1

I (6253) NimBLE_SPP_BLE_CENT: Write in uart task success!
I (6323) NimBLE: received notification; conn_handle=1 attr_handle=12 attr_len=1

`

@Firmware-beginner
Copy link
Author

Thank you for helping,
It works 👍

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new labels Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants