Hey everyone,
I'm doing an OTA transfer via BLE and I keep getting intermittent failures with the error:
esp_image: invalid segment length 0xfffffff
I've tried googling around but cannot seem to find any related solution.
Using ESP idf ver: v4.0-beta1-180-ga21eb04cc
The odd part to me is it fails 80% of the time after a full clean and build but other times it works just fine and I am able to perform an OTA update. Any help on trying to solve this would be appreciated
Cheers,
Gibson
OTA failure
-
- Posts: 58
- Joined: Wed Jul 17, 2019 11:45 pm
Re: OTA failure
After some more digging I believe it may be something to do with the bootloader? I'll continue digging see if I come up with something
Cheers,
Gibson
Cheers,
Gibson
-
- Posts: 58
- Joined: Wed Jul 17, 2019 11:45 pm
Re: OTA failure
Is anyone able to provide some support on this? It would be really appreciated.
Cheers,
Gibson
Cheers,
Gibson
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: OTA failure
Well, you'll have to at least provide a bit more info than what you're doing right now. Is your project source code online somewhere so people can have a look at it, for instance?
-
- Posts: 58
- Joined: Wed Jul 17, 2019 11:45 pm
Re: OTA failure
Hey Sprite,
Apologies I can't make the code public. But I can tell you that I now know that it occurs as a result of a disconnection coming mid way through a transaction over BLE with the Application we're interfacing with. We are not manually calling for a disconnect, but we are getting a disconnection event from our gatts handler. If you can think of anything that could potentially cause this, we're currently investigating a potential electrical issue that may cause a loss of current to the ESP32 (Could that cause the radio to turn off?) in addition to talking with the app creator.
Cheers,
Gibson
Apologies I can't make the code public. But I can tell you that I now know that it occurs as a result of a disconnection coming mid way through a transaction over BLE with the Application we're interfacing with. We are not manually calling for a disconnect, but we are getting a disconnection event from our gatts handler. If you can think of anything that could potentially cause this, we're currently investigating a potential electrical issue that may cause a loss of current to the ESP32 (Could that cause the radio to turn off?) in addition to talking with the app creator.
Cheers,
Gibson
Re: OTA failure
Hi Gibson,
Sorry for the confusing OTA error. Can confirm the root cause of "esp_image: invalid segment length 0xfffffff" is almost always a truncated image (the transfer completed before all bytes transferred). We have an open ticket internally to make this message more user friendly.
If it's possible to detect the truncation in your app (for example by sending the file length via the BLE connection and checking this many bytes are received) then this may help unnecessary verification failures, as well.
Regarding the BLE connection terminating, this could have a number of root causes but sounds like it may have been initiated by the other side of the connection? Obtaining a HCI dump from the app which shows the BLE packets which are sent/received from that side may be helpful. I'll check if the Bluetooth team has any suggestions as well.
Sorry for the confusing OTA error. Can confirm the root cause of "esp_image: invalid segment length 0xfffffff" is almost always a truncated image (the transfer completed before all bytes transferred). We have an open ticket internally to make this message more user friendly.
If it's possible to detect the truncation in your app (for example by sending the file length via the BLE connection and checking this many bytes are received) then this may help unnecessary verification failures, as well.
Regarding the BLE connection terminating, this could have a number of root causes but sounds like it may have been initiated by the other side of the connection? Obtaining a HCI dump from the app which shows the BLE packets which are sent/received from that side may be helpful. I'll check if the Bluetooth team has any suggestions as well.
Re: OTA failure
Bluetooth team says that BLE disconnects can happen for a number of reasons, so without logs it's not possible to debug further.
They agree with the suggestion of tracking the file length and number of transferred bytes as part of the OTA download protocol, and also suggest it may help to add a feature for resuming a download if it's disconnected and reconnected at the BLE protocol level.
Who is online
Users browsing this forum: Google [Bot] and 136 guests