Large MQTT OTA file transfer fails at block 1024

0

I am working on setting up the freeRTOS OTA example in MQTT mode, modified to transfer large files (> 10MB). I have modified pOtaInterfaces to write my files to SD using fseek() and fwrite(). On a smaller file, this works perfectly, and I receive a complete file. On large files, however, when the transfer gets to block 1024, I start to get Received a duplicate block and the block numbers seem to be muddled. It jumps from 1023 to 1025, then 1027, then 1056. It looks very much like something in the library is corrupting bit 10 of whatever system keeps track of the blocks. I suppose it is the bitmap system. At this point the transfer slows down hugely, and if I wait for it to complete, I have a corrupted file. Does anyone know this OTA bitmap system well enough to help me identify if there is indeed a bug in the SDK?

Andrew
asked a year ago436 views
1 Answer
1
Accepted Answer

Hi Andrew. Please check the value of OTA_MAX_BLOCK_BITMAP_SIZE in your project. I suspect it's 128. That means 128 bytes, or 1024 bits, to track the blocks. If so, you will need to increase this value to have enough bits for your number of blocks.

You should review all of these settings and tailor to your needs: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/fb4aece8c7ee4211b17ee48196222c04795b7a51/source/include/ota_private.h#L62-L70

More information here (although it doesn't cover the bitmap setting): https://www.freertos.org/Documentation/api-ref/ota-for-aws-iot-embedded-sdk/docs/doxygen/output/html/ota_config.html

As a side point, does your device include a HTTP client? With such a large file, your MQTT messaging costs will likely rival your job action costs. You may find HTTP file transfer to be more cost effective.

profile pictureAWS
EXPERT
Greg_B
answered a year ago
  • Ahhh OTA_MAX_BLOCK_BITMAP_SIZE was indeed the problem. There are so many config files tucked away in the library, which I had been avoiding because they are inside a git submodule. I see now there are many configuration settings within the library to adjust, thank you so much for your great answer! Re:HTTP no we do not have an HTTP client currently, and since we are using an external secure element for TLS, which is working well for MQTT, we have been leaning on MQTT to fulfill this download, as it is all implemented and working well. The AWS costs arn't a big concern.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions