Skip to content

nordic: fix BLE MTU negotation #9441

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

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Jul 20, 2024

See #9440 for test programs.

Debugged by looking at packet traces with nRF sniffer and printing out SD BLE events. The symptoms were that the connection and discovery seemed fine, but the notification events, BLE_GATTC_EVT_HVX, never arrived at the event handler in Characteristic.c. After a few seconds the connection was broken.

MTU negotiation seemed fine, but someone reported something slightly similar in Nordic DevZone, and the suggested problem was that some negotiation had failed between the peers. I added nrf_check_error() to a few calls, and found they were failing. The details have to do with the permitted MTU values, and are in the code comments.

Tested on nRF central <-> ESP32-S3 peripheral, and also vetted that nrRF<-> nRF still works.

The original failures occurred because nRF preferred an MTU of size 512, and ESP preferred 256. There was no problem nRF-to-nRF because there, both sides chose 512.

I encountered at least one other issue I'll look at as well, which is not related to this particular problem.

I added debug code to print the evt names, which were otherwise painful to look up.

Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, didn't test

@dhalbert dhalbert merged commit 98982c6 into adafruit:main Jul 20, 2024
66 checks passed
@dhalbert dhalbert deleted the nordic-fix-mtu-negotiation branch July 22, 2024 12:39
@dhalbert
Copy link
Collaborator Author

dhalbert commented Jul 22, 2024

The fix was tested by @Erlend in discord and fixed their problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nordic: BLE not interoperating with some devices
2 participants