Other Parts Discussed in Thread: UNIFLASH,
Hi There!
We are facing an issue with the OTA download of the firmware binary image for the second time i.e. downloading /sys/mcuimg3.bin via OTA update.
Describing the issue a bit, the freshly flashed firmware i.e. /sys/mcuimg1.bin downloads the updated firmware /sys/mcuimg2.bin smoothly and runs the new firmware after rebooting fine. But when this new firmware attempts to download the updated firmware further, it fails in opening/creating the file /sys/mcuimg3.bin with an error _OpenStorageFile: error in pOpenFile, status=-3. and this corrupts the SFLASH file-system requiring us to format and flash it again, manually.
PS: For the sake of testing, we are using the same firmware image for all the updates i.e. all the mcuimg1, 2, and 3 are the same.
I would request you to refer my previous related thread for the same problem, though we were getting this error very rarely earlier but it was not solved. In our latest firmware, we have made a few changes but they are not related to the OTA logic, means the OTA logic is intact as of previous FW version where this error was rare but persistent. But now, with the new firmware this error is very frequent and we get it every time.
For your information, the changes in the new firmware are as below:
1. Earlier our device was reading the data from the daughter boards over SPI in polling mode, but now in the new firmware, we have modified it to read data and POST it based on a timer interrupt. The new firmware solves its purpose effectively and runs smoothly but also with the above error in the OTA which is unchanged.
I am attaching the terminal log of our device for both the success case followed by the failure case, please have a look and suggest us some work around for the issue.
1. Success with /sys/mcuimg2.bin
Available Updates : Device FirmWare
Starting OTA
sl_extLib_OtaRun: call OtaClient_ConnectServer OTA server=ota.orxa.io
OtaClient_ConnectServer: http_connect_server ota.orxa.io
sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=SE201804
OtaClient_UpdateCheck: call http_build_request /api/file/List_Folder
CdnDropbox_SendReqDir: uri=/api/file/List_Folder
metadata file=/SE201804/f20_sys_config.json, size=361
metadata file=/SE201804/f80_sys_mcuimgA.bin, size=146872
sl_extLib_OtaRun: OtaClient_UpdateCheck, numUpdates=2
pOtaApp->file_path: /SE201804/f80_sys_mcuimgA.bin
sl_extLib_OtaRun: OtaClient_GetNextUpdate: file=/SE201804/f80_sys_mcuimgA.bin, size=146872
OtaClient_ResourceMetadata: call http_build_request /api/file/get_temporary_link
OtaClient_ResourceMetadata: file flags=80,metadata flags=80
CdnDropbox_SendReqFileUrl: uri=/api/file/get_temporary_link
sl_extLib_OtaRun: ResourceMetadata CDN file URL = ota.orxa.io/.../SE201804`f80_sys_mcuimgA@bin
_ReadFileHeaders: domain=ota.orxa.io, file=/api/File/download/SE201804`f80_sys_mcuimgA@bin
_ReadFileHeaders: skip http headers
CdnClient_Run: Create/Open for write file /sys/mcuimgA.bin
_McuImageGetNewIndex: active image is 0, return new image 1
sl_extlib_FlcOpenFile: MCU imagename converted to /sys/mcuimg2.bin
CdnClient_Run: file opened
CdnClient_Run: Write size 1440 to file /sys/mcuimg2.bin total 0.
CdnClient_Run: Write size 1440 to file /sys/mcuimg2.bin total 1440.
CdnClient_Run: Write size 1440 to file /sys/mcuimg2.bin total 2880.
// removed for the sake of sanity!
CdnClient_Run: Write size 1440 to file /sys/mcuimg2.bin total 142560.
CdnClient_Run: Write size 1440 to file /sys/mcuimg2.bin total 144000.
CdnClient_Run: Write size 1432 to file /sys/mcuimg2.bin total 145440.
CdnClient_Run: End of file
CdnClient_Run: Downloading File Completed - Size=146872
sl_extLib_OtaRun: ---- Download file completed /sys/mcuimg2.bin
pOtaApp->file_path: sl_extLib_OtaRun: -------- end of updates
OtaRun returned : 2
sl_extlib_FlcTest: change image status to IMG_STATUS_TESTREADY
ReadBootInfo: ucActiveImg=0, ulImgStatus=0xabcddcba
WriteBootInfo: ucActiveImg=0, ulImgStatus=0x56788765
_OtaCleanToIdle: close OTA client and CDN client and back to IDLE
OTA: NEW IMAGE DOWNLOAD COMPLETE
ErorrLog.txt Size = 57 KB
Connection to server created successfully
HTTP Post to ota.orxa.io/api/DeviceStats/OTAStatus returned 200 OK!
Rebooting...
2. The device and reboots fine, followed by committing the new firmware and continues working.
ReadBootInfo: ucActiveImg=0, ulImgStatus=0x12344321
EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT? 1
OTA: PENDING COMMIT & WLAN OK ==> PERFORM COMMIT
ReadBootInfo: ucActiveImg=0, ulImgStatus=0x12344321
sl_extlib_FlcCommit: Booted in testing mode.
WriteBootInfo: ucActiveImg=1, ulImgStatus=0xabcddcba
Commit Success!
3. Failure logs with /sys/mcuimg3.bin:
OTA server info is set!
Available Updates : Device FirmWare
Starting OTA
sl_extLib_OtaRun: call OtaClient_ConnectServer OTA server=ota.orxa.io
OtaClient_ConnectServer: http_connect_server ota.orxa.io
sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=SE201804
OtaClient_UpdateCheck: call http_build_request /api/file/List_Folder
CdnDropbox_SendReqDir: uri=/api/file/List_Folder
metadata file=/SE201804/f20_sys_config.json, size=361
metadata file=/SE201804/f80_sys_mcuimgA.bin, size=146872
sl_extLib_OtaRun: OtaClient_UpdateCheck, numUpdates=2
pOtaApp->file_path: /SE201804/f80_sys_mcuimgA.bin
sl_extLib_OtaRun: OtaClient_GetNextUpdate: file=/SE201804/f80_sys_mcuimgA.bin, size=146872
OtaClient_ResourceMetadata: call http_build_request /api/file/get_temporary_link
OtaClient_ResourceMetadata: file flags=80,metadata flags=80
CdnDropbox_SendReqFileUrl: uri=/api/file/get_temporary_link
sl_extLib_OtaRun: ResourceMetadata CDN file URL = ota.orxa.io/.../SE201804`f80_sys_mcuimgA@bin
_ReadFileHeaders: domain=ota.orxa.io, file=/api/File/download/SE201804`f80_sys_mcuimgA@bin
_ReadFileHeaders: skip http headers
CdnClient_Run: Create/Open for write file /sys/mcuimgA.bin
_McuImageGetNewIndex: active image is 1, return new image 2
sl_extlib_FlcOpenFile: MCU imagename converted to /sys/mcuimg3.bin
_OpenStorageFile: error in pOpenFile, status=-3
CdnClient_Run ERROR: pCdnClient->pOpenFileCB
sl_extLib_OtaRun ERROR: Failed on CdnClient_Run
OtaRun returned : -7
OTA: Error -7 with OTA server!
Please help us resolving the issue
Thanks and regards.
Bhupendra Prajapati.
