Part Number: CC3200MOD
Other Parts Discussed in Thread: UNIFLASH, CC3200
Hi Folks,
So close on getting FOTA to work. I'm using a cell module instead of WiFi, so I FTP the FOTA.bin file to the cell module User File Space (UFS) and then I read the file and create the mcuimg* file. All seems to work fine, except a reboot isn't being triggered with the new image flagged for test.
I can use Uniflash and confirm the file was create and about the right size.
Here is the code I use to create the flash file:
_i32 move_UFS_to_mcuimgA(void)
{
_u32 lMAX_FILE_SIZE = 65535l; //64 * 1024-1;
...
status = sl_extlib_FlcOpenFile("/sys/mcuimgA.bin", lMAX_FILE_SIZE, NULL, &lFileHandle_img, (_FS_FILE_PUBLIC_WRITE |_FS_FILE_OPEN_FLAG_COMMIT));
..
while (not_done)
{
connect_ptr = strstr(cCellRxData, "CONNECT ");
if (connect_ptr != NULL)
{
... // set i variable to first byte of FOTA image... temp_number is 1000 bytes or less if the last read
status = sl_extlib_FlcWriteFile(lFileHandle_img, file_offset, (unsigned char *) &connect_ptr[i], temp_number);
file_offset += temp_number;
if (temp_number < 1000)
{
not_done = 0;
}
} // connect_ptr != NULL
else
{
not_done = 0;
}
} // while not_done
...
status = sl_extlib_FlcCloseFile(lFileHandle_img, NULL, NULL , 0);
if (status < 0)
{
// something bad happened.
ret_val = status;
sl_Stop(SL_STOP_TIMEOUT);
return ret_val;
}
status = sl_extlib_FlcTest(FLC_TEST_RESET_MCU_WITH_APP);
if (status & FLC_TEST_RESET_MCU) /// THIS STATEMENT RETURNS FALSE
{
// Report("proc_ota_run_step: Rebooting...");
// Platform_Reset(); I can't find this function for CC3200, it might be a cc3220 specific function
sl_Stop(SL_STOP_TIMEOUT);
// ProcessRestartMcu(); // another cc3220 function for resetting?
PRCMMCUReset(true);
}
// IT GETS HERE BUT SHOULDN'T.
return ret_val;
}
Also, here is what I run when the software starts up: (I haven't had a chance to test with a successful FOTA file, but it seems to work if I load the image using uniflash, ie it doesn't break anything).
void check_FOTA_reboot(void)
{
status = sl_extlib_FlcCommit(FLC_COMMITED);
if (status == FLC_TEST_RESET_MCU)
{
reset_board();
}
}
Again thanks for any pointers. I have 30 hardware prototypes that I want to get into the field for beta testing, but need this working before I can do that.
thanks again,
Bob