NordicSemiconductor/Android-nRF-Connect-Device-Manager

Payload (250 bytes) too long for MTU: 249

tonkarhu opened this issue · 9 comments

Problem I started to see today:

E/Uploader: Upload failed
    Payload (250 bytes) too long for MTU: 249
        at io.runtime.mcumgr.ble.McuMgrBleTransport.lambda$send$0$io-runtime-mcumgr-ble-McuMgrBleTransport(McuMgrBleTransport.java:356)
        at io.runtime.mcumgr.ble.McuMgrBleTransport$$ExternalSyntheticLambda3.onRequestCompleted(Unknown Source:13)
        at no.nordicsemi.android.ble.Request.lambda$notifySuccess$1$no-nordicsemi-android-ble-Request(Request.java:1239)
        at no.nordicsemi.android.ble.Request$$ExternalSyntheticLambda2.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.os.HandlerThread.run(HandlerThread.java:67)

I solved this by downgrading
no.nordicsemi.android:mcumgr-ble:1.5.0
to
no.nordicsemi.android:mcumgr-ble:1.4.1'

in my app and it works now.

My guess is that the "Ble library update":
"BLE library updated to version 2.6.0-alpha04 by @philips77" in @#84
has to do something with this issue.

The issue you're having is not related to BLE library.
The root cause seems to be this PR: #83

Could you say the offset at which you're getting this error? Is it at the beginning, or later during the upload?

Sometimes it fails after the first transfer sometimes after multiple transfers:

I/flutter: == Percentage: 16 % ==
I/System.out: == [1670399859403] bytes sent: 64496, image size: 388603 ==
I/flutter: == onUploadProgressChanged: {bytesSent: 64496, imageSize: 388603, timestamp: 1670399859403} ==
I/flutter: == Speed: 4.827731725697061 bytes/ms ==
I/flutter: == Time left: 67134.42635489511 ms ==
I/flutter: == Percentage: 17 % ==
I/System.out: == [1670399859505] bytes sent: 64944, image size: 388603 ==
I/flutter: == onUploadProgressChanged: {bytesSent: 64944, imageSize: 388603, timestamp: 1670399859505} ==
I/flutter: == Speed: 4.824409213281483 bytes/ms ==
I/flutter: == Time left: 67087.79991319445 ms ==
I/flutter: == Percentage: 17 % ==
W/System.err: Payload (251 bytes) too long for MTU: 249
W/System.err:     at io.runtime.mcumgr.ble.McuMgrBleTransport.lambda$send$0$McuMgrBleTransport(McuMgrBleTransport.java:356)
W/System.err:     at io.runtime.mcumgr.ble.-$$Lambda$McuMgrBleTransport$G9R9yrfNM-X8bvUSG0-6o8BwsHU.onRequestCompleted(Unknown Source:13)
W/System.err:     at no.nordicsemi.android.ble.Request.lambda$notifySuccess$1$Request(Request.java:1239)
W/System.err:     at no.nordicsemi.android.ble.-$$Lambda$Request$ep6TD_94xCe5LaEafH2PrarR3yc.run(Unknown Source:4)
W/System.err:     at android.os.Handler.handleCallback(Handler.java:938)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err:     at android.os.Looper.loopOnce(Looper.java:226)
W/System.err:     at android.os.Looper.loop(Looper.java:313)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8751)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
I/System.out: == Upgrade failed: Payload (251 bytes) too long for MTU: 249 ==
I/flutter: == onUpgradeFailed: {state: UPLOAD, error: Payload (251 bytes) too long for MTU: 249

What windowCapacity and memoryAlignment are you setting in the FirmwareUpgradeManager?

So far, I have only tested with WindowCapacity: 4 and memoryAlignment: 1

Good news, I manage to replicate the issue!

I just released 1.5.2 with this issue fixed. Thank you for finding the bug!

I have this issue after upgrading to 2.0.1. Is there something I'm missing?

Fixed again in 2.0.2