Other Parts Discussed in Thread: CC3220SF
Hello Everyone,
I am trying to implement OTA in CC3220SF module. I am able to fetch the file from the server and upgrade OTA, But after file download is done my MQTT disconnects. I even tried to reconnect to Mqtt by doing mqtt_init and mqtt_start but nothing works and the MCU goes in a hanged state. The log file of OTA upgrade is attached. I get the following error after doing sl_stop.
00:04:07 INFO ../app/mqtt_client_cbs.c:180: Mqtt client disconnected!!
00:04:07 DEBUG ../app/event_queue.c:95: Emitted into APP Event Queue, Event = 6
00:04:07 DEBUG ../app/event_queue.c:146: Emitted into Mqtt Event Queue, Event = 12
00:04:07 ERROR ../app/mqtt_client_task.c:634: Could not PUSH to /topic/device/version/progress - Error: -7
please check the attached log for more information.
My function for "ota_test_and_reset_handler" is as follows:-
int32_t ota_test_and_reset_handler()
{
int32_t retVal;
log_info("OtaImageTestingAndReset: download done");
/* char *payload = (char *)malloc(512);
sprintf(payload, "{\"deviceId\": \"%16s\","
"\"state\": \"upgraded\", \"progress\": 100}",
aquaiConfig.deviceId);
// Push payload to mqtt queue
MqttEventPayload_t mqttEvt;
mqttEvt.event = PUBLISH_OTA_PROGRESS;
mqttEvt.msgPtr = payload;
mqttEvt.msgLen = strlen(payload);
event_queue_emit_mqtt(&mqttEvt);*/
mqtt_send(PUBLISH_OTA_PROGRESS, 128,
"{\"deviceId\": \"%16s\","
"\"state\": \"upgraded\", \"progress\": 100}",
gAppConfig.deviceId);
/* Sleep to ensure MQTT pushed data */
sleep(1);
log_info(
"OtaImageTestingAndReset: call sl_Stop to move the bundle to"
"testing state");
sl_Stop(SL_STOP_TIMEOUT);
log_info(
"OtaImageTestingAndReset: reset the platform to test the new"
"image...");
Platform_Reset();
/* if we reach here, the platform does not support self reset */
/* reset the NWP in order to test the new image */
log_info(
"OtaImageTestingAndReset: platform does not support self reset");
log_info(
"OtaImageTestingAndReset: reset the NWP to test the new image");
retVal = Network_IF_InitDriver(ROLE_STA);
//Mqtt_init();
//Mqtt_start();
/* The sl_Stop/Start will produce event APP_EVENT_STARTED */
return(retVal);
}
Can anyone help me resolve this issue?