This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

S132 3.0 MTU exchange not completing

  1. I looked at examples and added identical code to my own app, specifically to a) set the gatt_enable_params.att_mtu to GATT_MTU_SIZE_DEFAULT, and b) to handle BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST in evt dispatch by doing an sd_ble_gatts_exchange_mtu_reply of that same size.

  2. I found that when testing my app, just after an incoming CONNECT succeeds, when I try to do an sd_ble_gatts_hvx, it is returning NRF_ERROR_INVALID_STATE.

  3. I found the doc of the new functionality of Configurable ATT_MTU on P.6 of the S132 migration document, which was great. I also saw this in the Usage section, which was also a relief because it explains the invalid state. This must mean that the exchange is currently still in progress. "HVx and service changed cannot run while a local client initiated ATT_MTU exchange is active. The SV calls sd_ble_gatts_hvx( ) and sd_ble_gatts_service_changed() will return NRF_ERROR_INVALID_STATE if a local client initiated ATT_MTU exchange is ongoing."

  4. I instrumented my app to use NRF_LOG to output all BLE messages to the serial console, and see the following:

a) BLE_GAP_EVT_CONNECTED (which has a good handle)

b) BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST (which I handle with the sd_ble_gatts_exchange_mtu_reply as I said above, and as in all the samples)

c) Nothing else. I never receive the BLE_GATTC_EVT_EXCHANGE_MTU_RSP which the doc would imply I should be receiving to indicate the end of the exchange.

  1. I read this doc, and anything else I could find, and I am stumped as to why the RSP isn't coming, and why I'm stuck in the middle of the MTU exchange. I don't even know who is originathing this request, so I can't look at the source code to see what is happening. infocenter.nordicsemi.com/index.jsp

I'm completely blocked in my conversion to SDKV12 at this point because of nonfunctional BT. Guidance would be greatly appreciated. Thank you.

  • Hi Ray,

    We haven't released any update for nRFToolbox or nRF Connect in the last few days. And I don't think it could do anything with the MTU exchange.

    When releasing the S132 v3.0 we did have IOP testing process that we tested with many phones and devices. There is of course a chance that updates of the iOS or some devices are not in the list of devices we have here can cause an issue.

    MTU exchange on iOS has always been there for long time maybe from iOS v6. It was handled automatically by the softdevice before, but now we allow larger MTU size than 23 and we give the application the option to choose which MTU size should be used.

    If you see the problem occurs again, please let me know.

  • Well, my app is still broken even though the sample is now working. Can you give me some idea of what conditions would cause the MTU reply not to be sent? I am dead in the water here in terms of using SDKV12 until I can get this worked out.

    Is the source code available somewhere that would let me inspect or at least debug the logic that would cause a failure to get the reply?

  • I should add, for whatever it's worth, that the problem exhibits itself in my app even if I just try to connect into it using the nRF Connect app.

  • Oh, I'm sorry I misread that everything suddenly worked today, including your app.

    You would need to make sure BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST actually arrived, and you put the MTU size to gatt_enable_params.att_mtu correctly. You should check all the return code when you call either softdevice_enable() or the sd_ble_gatts_exchange_mtu_reply() they should return success.

    My suggestion is to modify your app to a very simple one. Maybe just keep a dummy characteristic that you can use to send notification, just to check it MTU exchange finished or not. If you can make simple example that can reproduce the issue, you can send to use and we test here. If we can also reproduce the issue here, it will be fixed very quickly.

  • Ok thanks. I ran out of time today, but my priorities on this project will be:

    1. Ensure that my error checking is being done, as you say
    2. Try to get sniffer working, just to validate what is going on
    3. Simplify/isolate further. (Hard to do because this is a complex app that is both a controller and a peripheral role, but if necessary I will take out a machete and start hacking away.)

    Thanks for your perseverance.

Related