Skip to content

BLE MTU size not being respected after pairing on ESP32-C6 #952

@JHedgesBartec

Description

@JHedgesBartec

Answers checklist

  • I have read the documentation ESP-AT Programming Guide and the issue is not addressed there.
  • I have used the latest released firmware or have updated my ESP-AT 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.

AT+GMR

AT+GMR
AT+GMR
AT version:4.2.0.0-dev(92a6ba3 - ESP32C6 - Jul 23 2025 02:44:51)
SDK version:v5.4.1-643-g8ad0d3d8f2-dirty
compile time(dc21313):Jul 24 2025 15:57:40
Bin version:v2.0.0.0(ESP32C6-4MB)

OK

ESP-AT Firmware Source

Master cloned from commit dc21313
With modifications to gatts_data and some AT features removed (non BLE)

Hardware Information

ESP32-C6-WROOM

Power Supply used

External 3.3V

What is the expected behavior?

After pairing data should be sent Server to Client and received OK if the data sent to MTU-3 chunks

What is the actual behavior?

Sending data Server to Client is failing due to saying data is larger than MTU size despite the MTU size being reported.
If the connection is re-established after pairing the larger MTU size can be used.

Probability of recurrence

100%

AT+SYSRAM?

Not available.

Steps to reproduce

Initialise ESP32 as BLE Server
Connect and initiate pairing from client to server
Send data to server, received OK
Send data to client using value greater than 20 but less than MTU, FAIL.

AT command port output

**** Pairing in the same connection ****
ESP-AT >> (00054281s) +BLECFGMTU:0,203
ESP-AT >> (00054430s) +BLECONN:0,"d4:54:8b:fd:6d:0c"
ESP-AT >> (00055688s) +BLECONNPARAM:0,12,12,12,0,960
ESP-AT >> (00056318s) +BLESECNTFYKEY:0,<omitted>
ESP-AT >> (00057427s) +BLECONNPARAM:0,48,48,48,0,960
ESP-AT >> (00067578s) +BLEAUTHCMPL:0,0
ESP-AT >> (00068228s) +BLECONNPARAM:0,12,12,12,0,960our_ota_addr=66:ad:43:ca:4c:40
ESP-AT >> (00068530s) +WRITE:2
ESP-AT >> (00068537s) 
ESP-AT >> (00070147s) +BLECONNPARAM:0,48,48,48,0,960
ESP-AT >> (00112481s) +WRITE:11
ESP-AT >> (00112488s) 
ESP-AT << (00112506s) AT+BLEGATTSIND=0,1,2,5
ESP-AT >> (00112603s) 
ESP-AT >> (00112611s) OK
ESP-AT << (00112630s) AT+BLEGATTSIND=0,1,2,118
ESP-AT >> (00112642s) 
ESP-AT >> (00112657s) ERROR
ESP-AT << (00112777s) AT+BLEGATTSIND=0,1,2,2
ESP-AT >> (00112903s) 
ESP-AT >> (00112910s) OK


**** Re-established connection ****
ESP-AT >> (00170291s) +BLECONN:0,"d4:54:8b:fd:6d:0c"
ESP-AT >> (00170590s) +BLEAUTHCMPL:0,0
ESP-AT >> (00170684s) +BLECFGMTU:0,203
ESP-AT >> (00171702s) +WRITE:2
ESP-AT >> (00171711s) 
ESP-AT >> (00175902s) +WRITE:11
ESP-AT >> (00175909s) 
ESP-AT << (00175921s) AT+BLEGATTSIND=0,1,2,5
ESP-AT >> (00176024s) 
ESP-AT >> (00176056s) OK
ESP-AT << (00176090s) AT+BLEGATTSIND=0,1,2,118
ESP-AT >> (00176204s) 
ESP-AT >> (00176213s) OK
ESP-AT << (00176225s) AT+BLEGATTSIND=0,1,2,2
ESP-AT >> (00176324s) 
ESP-AT >> (00176332s) OK

AT log port output

**** Pairing in the same connection ****
ESP-DEBUG >> (00054238s) I (51778) at-ble: advertise completed, reason=0
ESP-DEBUG >> (00054289s) I (51825) at-ble: mtu update event, conn_handle=0 cid=4 mtu=203
ESP-DEBUG >> (00054440s) I (51945) at-ble: connection established, status=0
ESP-DEBUG >> (00054448s) I (51946) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00054456s) I (51946) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00054467s) I (51952) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00054476s) I (51958) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00054488s) I (51964) at-ble: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=0 authenticated=0 bonded=0
ESP-DEBUG >> (00055012s) I (52544) at-ble: subscribe event, conn_handle=0 attr_handle=8 reason=1 prevn=0 curn=0 previ=0 curi=1
ESP-DEBUG >> (00055019s) E (52544) at-ble: get node by handle failed
ESP-DEBUG >> (00055698s) I (53204) at-ble: connection updated, status=0
ESP-DEBUG >> (00055709s) I (53205) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00055718s) I (53205) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00055733s) I (53211) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00055741s) I (53217) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00055756s) I (53223) at-ble: conn_itvl=12 conn_latency=0 supervision_timeout=960 encrypted=0 authenticated=0 bonded=0
ESP-DEBUG >> (00056327s) I (53862) at-ble: PASSKEY_ACTION_EVENT started
ESP-DEBUG >> (00057437s) I (54943) at-ble: connection updated, status=0
ESP-DEBUG >> (00057448s) I (54944) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00057486s) I (54944) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00057494s) I (54949) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00057506s) I (54956) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00057514s) I (54962) at-ble: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=0 authenticated=0 bonded=0
ESP-DEBUG >> (00067589s) I (65094) at-ble: encryption change event, status=0
ESP-DEBUG >> (00067599s) I (65094) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00067607s) I (65095) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00067624s) I (65100) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00067633s) I (65107) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00067650s) I (65113) at-ble: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=1 authenticated=1 bonded=1
ESP-DEBUG >> (00068239s) I (65744) at-ble: connection updated, status=0
ESP-DEBUG >> (00068246s) I (65745) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00068252s) I (65745) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00068265s) I (65751) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00068271s) I (65757) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00068288s) I (65763) at-ble: conn_itvl=12 conn_latency=0 supervision_timeout=960 encrypted=1 authenticated=1 bonded=1
ESP-DEBUG >> (00068551s) I (66074) at-ble: subscribe event, conn_handle=0 attr_handle=20 reason=1 prevn=0 curn=0 previ=0 curi=1
ESP-DEBUG >> (00070157s) I (67663) at-ble: connection updated, status=0
ESP-DEBUG >> (00070168s) I (67664) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00070176s) I (67664) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00070190s) I (67669) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00070198s) I (67676) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00070216s) I (67682) at-ble: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=1 authenticated=1 bonded=1
ESP-DEBUG >> (00112665s) E (110186) at-ble: value:118 > max_len:20

**** Re-established connection ****
ESP-DEBUG >> (00170088s) I (167626) at-ble: advertise completed, reason=0
ESP-DEBUG >> (00170302s) I (167805) at-ble: connection established, status=0
ESP-DEBUG >> (00170311s) I (167805) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00170319s) I (167806) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00170333s) I (167812) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00170341s) I (167818) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00170353s) I (167824) at-ble: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=0 authenticated=0 bonded=0
ESP-DEBUG >> (00170614s) I (168105) at-ble: encryption change event, status=0
ESP-DEBUG >> (00170620s) I (168105) at-ble: handle=0 our_ota_addr_type=0 our_ota_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00170627s) I (168106) at-ble: our_id_addr_type=0 our_id_addr=66:ad:43:ca:4c:40
ESP-DEBUG >> (00170638s) I (168112) at-ble: peer_ota_addr_type=0 peer_ota_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00170645s) I (168118) at-ble: peer_id_addr_type=0 peer_id_addr=0c:6d:fd:8b:54:d4
ESP-DEBUG >> (00170658s) I (168124) at-ble: conn_itvl=48 conn_latency=0 supervision_timeout=960 encrypted=1 authenticated=1 bonded=1
ESP-DEBUG >> (00170665s) I (168134) at-ble: subscribe event, conn_handle=0 attr_handle=8 reason=3 prevn=0 curn=0 previ=0 curi=1
ESP-DEBUG >> (00170677s) E (168143) at-ble: get node by handle failed
ESP-DEBUG >> (00170696s) I (168226) at-ble: mtu update event, conn_handle=0 cid=4 mtu=203 
ESP-DEBUG >> (00171723s) I (169245) at-ble: subscribe event, conn_handle=0 attr_handle=20 reason=1 prevn=0 curn=0 previ=0 curi=1

More Information.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions