OTA failure

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

OTA failure

Postby gibson12345 » Thu Dec 12, 2019 12:17 am

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

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: OTA failure

Postby gibson12345 » Thu Dec 12, 2019 4:41 am

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

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: OTA failure

Postby gibson12345 » Fri Dec 13, 2019 2:18 am

Is anyone able to provide some support on this? It would be really appreciated.

Cheers,
Gibson

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: OTA failure

Postby ESP_Sprite » Fri Dec 13, 2019 2:55 am

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?

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: OTA failure

Postby gibson12345 » Sun Dec 15, 2019 11:32 pm

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

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: OTA failure

Postby ESP_Angus » Tue Dec 17, 2019 10:37 pm

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.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: OTA failure

Postby ESP_Angus » Thu Dec 19, 2019 11:13 pm

ESP_Angus wrote:
Tue Dec 17, 2019 10:37 pm
I'll check if the Bluetooth team has any suggestions as well.
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