Announcements

Ever wondered how you could shape the future in collaboration with others? Join us at OktoberTech Asia Pacific and get inspired. Click here to sign up FREE of charge.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6 Forum Discussions

BiM_4640481
Level 4
25 replies posted 25 sign-ins 10 replies posted
Level 4

Hello,

I am working on PSoC6 in MTB. My application uses AnyCloud_MqTT_Client and AnyCloud_OTA_HTTPS as reference. I am using MQTT to send data to AWS. Once I receive OTA command from AWS, ota begins. Two tasks are created: mqtt_client_task and ota_task. The design is in such a way that , once ota_task begins it suspends the mqtt_client_task. And after ota_task , I need to resume mqtt_task  and publish the ota status.

My question here is, is it mandatory to do the MQTT disconnect by calling cleanup(), for OTA to happen via HTTP?

Thanks,

Binsy M S

0 Likes
1 Solution
Rakshith
Moderator
Moderator 1000 replies posted 750 replies posted 500 replies posted
Moderator

Hi Binsy, 

WCM init should be initializing WiFi again. Can you please run the application in debug mode and check if the wcm_init function in the ota_task is getting executed as expected? Also, you could try attaching to running target after a hard fault occurs to see the call stack and check where the code is getting stuck. Can you please share the UART logs here? 

If possible, please share the entire project so that we can try and recreate the issue at our end.

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
3 Replies
Rakshith
Moderator
Moderator 1000 replies posted 750 replies posted 500 replies posted
Moderator

Hi Binsy, 

You should be able to run HTTP without disconnecting the MQTT connection. However, if you disconnect MQTT in your code you should be calling the cleanup function. This cleanup function deallocates the network buffer which is important.

Thanks and Regards,
Rakshith M B
0 Likes
BiM_4640481
Level 4
25 replies posted 25 sign-ins 10 replies posted
Level 4

Hello Rakshith,

Thanks for the response. 

I tried calling cleanup() function. But when this function is called,  and when control reaches OTA task , it is not able to connect to Wi-Fi and it hangs. So I commented out the cy_wcm_deinit() function call in cleanup() function and tried. With this OTA is able to work

Can you please tell me why the Wi-Fi in OTA is not able to connect to accesspoint though cy_wcm_init() is called in the function connect_to_wifi_ap() in ota_task?

Also I more thing noticed is, when i call cleanup()  ( commented out the cy_wcm_deinit() ) from mqtt_task the code hangs. Please give some inputs on this

Thanks,

Binsy M S

0 Likes
Rakshith
Moderator
Moderator 1000 replies posted 750 replies posted 500 replies posted
Moderator

Hi Binsy, 

WCM init should be initializing WiFi again. Can you please run the application in debug mode and check if the wcm_init function in the ota_task is getting executed as expected? Also, you could try attaching to running target after a hard fault occurs to see the call stack and check where the code is getting stuck. Can you please share the UART logs here? 

If possible, please share the entire project so that we can try and recreate the issue at our end.

Thanks and Regards,
Rakshith M B
0 Likes