AWS OTA for larger file doesnot work after MbedTLS -27648 Error

Hi,
I have enabled OTA on LTE based solution and I am able to perform MQTT messaging with AWS.
I am also able to perfom the OTA , but for only lesser amount of size binaries.
I tried performing OTA for 11.5KB size LED blink binary and it worked well.

When i tried to perform OTA for Larger size binaries i.e of 236.3KB it downloads some 1024 size blocks i.e 55 blocks of 1024 size and then i received below error

[ERROR][[INFO ][MNET][lu] MQTT][lu] (MQTT Error -1005 while sending on 0x2000acdata.18) MQTT PUBLISH operation queued.
[prvRequestFileBlock_Mqtt] OK: $aws/things/LTE_Thing/streams/AFR_OTA-2ca24077-3

I believe this i received this from IotNetworkAfr_Send() in iot_netowk_freertos.c file’s
IotLogError( "Error %ld while sending data.", ( long int ) socketStatus );

After this it does not download in any trials and ultimately stops.

Below are the more logs for information.

[ERROR][[INFO ][MNET][lu] ErQTT][lu] (MQror -1005 whTT connectiile sending on 0x2000acdata.18) MQTT PUBLISH operation queued.[prvRequestFileBlock_Mqtt] OK: $aws/things/LTE_Thing/streams/AFR_OTA-2ca24077-3
ffa-46e8-9bfa-6783fa[prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [RequestTimer] New stat[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0
Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[ERROR][[INFO ][MNET][lu] ErQTT][lu] (MQror -1005 whTT connectiile sending on 0x2000acdata.18) MQTT PUBLISH operation queued.[prvRequestFileBlock_Mqtt] OK: $aws/things/LTE_Thing/streams/AFR_OTA-2ca24077-3
ffa-46e8-9bfa-6783fa[prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [RequestTimer] New stat[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0
Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[ERROR][[INFO ][MNET][lu] ErQTT][lu] (MQror -1005 whTT connectiile sending on 0x2000acdata.18) MQTT PUBLISH operation queued.[prvRequestFileBlock_Mqtt] OK: $aws/things/LTE_Thing/streams/AFR_OTA-2ca24077-3
ffa-46e8-9bfa-6783fa[prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [RequestTimer] New stat[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0
Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0 Dropped: 0
[ERROR][[INFO ][MNET][lu] ErQTT][lu] (MQror -1005 whTT connectiile sending on 0x2000acdata.18) MQTT PUBLISH operation queued.[prvRequestFileBlock_Mqtt] OK: $aws/things/LTE_Thing/streams/AFR_OTA-2ca24077-3
ffa-46e8-9bfa-6783fa[prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [RequestTimer] New stat[INFO ][DEMO][lu] State: WaitingForFileBlock Received: 17 Queued: 0 Processed: 0

Logs are bit messy.

The same source works for lesser image size. so how do i debug further ?

Any help would be greatly appreciable.

Thanks.

Hi,

Looks like the MQTT connection is dropped while downloading the firmware. We do have an auto suspend and resume feature in the OTA library and demo that can handle such case. It is available from the 202007.00 release, https://github.com/aws/amazon-freertos/blob/master/CHANGELOG.md#20200700-july-2020. Basically if we detect the MQTT connection is dropped, OTA agent will be suspended so it won’t keep trying and give up. And when the connection is restored, OTA agent will resume and continue to download from where it left. Can you share which version you’re running?

Thanks

Hi .
Thank for the reply , i did debug the issue and found that the communication USART buffer size if limited, this USART is needed to talk to LTE module from MCU.

This USART will also carrying data messages to pass to cloud so they were also limited and the issue

I made this size larger to 1023 bytes and it worked.

We can mark it as resolved.

Thanks.