OTA demo - Error while accessing buffer

My hardware has TI CC3135 wifi module and STM32L496 as the host controller. I have successfully integrated the CC3135 wifi SDK and AWS SDK (201906.00 Major 06/17/2019).

While running the OTA update demo, i am getting the below error.

Kindly help me out in debugging the issue

Looking at the code it seems this is the only place that prints out that message: https://github.com/aws/amazon-freertos/blob/master/libraries/freertos_plus/aws/ota/src/http/aws_iot_ota_http.c#L306

…so the call to prvOTAEventBufferGet() must have failed here: https://github.com/aws/amazon-freertos/blob/master/libraries/freertos_plus/aws/ota/src/http/aws_iot_ota_http.c#L301

…then looking at the definition of that function I see that it can fail in two ways - first it does not manage to obtain the semaphore and then from the log appears to retry (which would not be a fatal error), or it has exhausted the maximum number of available buffers set by otaconfigMAX_NUM_OTA_DATA_BUFFERS. In any case this does not seem to be a fatal error.

Did your OTA complete?

Yes it is completed but took very long time to complete(5-10mins), also received so many duplicate data blocks.

Same OTA demo i tried with STM32 iot kit( B-L475E-IOT01A), it doesn’t get these error message and completed with in 40 seconds.

My hardware has TI CC3135 wifi and STM32L496 MCU, is there something i have to check to verify my porting is correct?

i have debugged and found that prvOTAPubMessageGet() is called from the Subscription callback when buffer is being used by prvIngestDataBlock() [xPublishBuffers[ulIndex].pxPubData.bBufferUsed is true.]

My understanding is while the processing of current received data block is in progress, next data block is received immediately. I think this is the cause, this problem is not appearing with the STM32 iot kit( B-L475E-IOT01A),

Is otaconfigMAX_NUM_OTA_DATA_BUFFERS set to the same thing on both systems?

yes it is set to 1 on both systems

sorry, it is set to 2 on both systems

Hello Rudresh,

It seems the data blocks are received at much faster rate than they are written on the flash and not enough buffers are available. Can you please share what is the value of otaconfigMAX_NUM_BLOCKS_REQUEST ? You can try running by reducing this to number of buffers available i.e otaconfigMAX_NUM_OTA_DATA_BUFFERS .

Please let me know if this works. You can also refer to description about the OTA configurations at https://freertos.org/Documentation/api-ref/ota/ota_config.html

i am using AWS Free RTOS version 201906.00 Major 06/17/2019, where otaconfigMAX_NUM_BLOCKS_REQUEST is not used.

Refer the below picture

But in latest version(202007.00) OTA_CBOR_Encode_GetStreamRequestMessage() is called with otaconfigMAX_NUM_BLOCKS_REQUEST ,

Do you have any plan to move to the 202007.00 release ? We can use the flow control feature by configuring otaconfigMAX_NUM_BLOCKS_REQUEST. On release 201906.00 this feature is not available so otaconfigMAX_NUM_OTA_DATA_BUFFERS have to be increased.

I planned to use the latest version(202007) where i got in to one issue which is not solved, i had created separate thread for it in this forum

i am curious that for this 201906.00 , how the ota demo is working correctly for the STM32 iot kit( B-L475E-IOT01A).

Since i could not solve the issue with 202007, i had to work with this version 201906.00

For that issue I do not have access to the repository you mentioned to reproduce and debug it. Can you provide a call stack for that issue?

I have fixed the buffer issue, TI driver uses a internal task to get the data which has a higher priority than _networkReceiveTask() present in AWS SDK,

After lowering the priority of TI driver task , code works correctly without any hiccups.

Thanks for the support, but still the issue with latest version is not solved i will try to provide the call stack as you asked