cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox AnyCloud SDK

New Contributor II

Is it possible to implement TCP keep alive offload feature on MQTT connection?

from the example of keepalive, it must setup offload configuration(cy_tko_ol_cfg_t) and remote ip then create TCP connection with socket_keepalive_enable value.

from the example of MQTT, it called IotMqtt_Connect() api to create connection directly, I am not find anything about TKO related setting can be set.

Thanks,

Sharn

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

If you're referring to AnyCloud-offload-TCP-Keepalive example, then this example employs the AnyCloud Low Power Assistant (LPA) middleware library which helps in developing low power wireless applications for the Cypress devices. The AnyCloud MQTT client doesn't employ the LPA library by default. You need to add that library via the Library Manager in the Modus ToolBox and make use of the offload functions provided in this library as attached in the snapshot.

For your reference, if you go through the offload keepalive example it calls a function "network_idle_task" which in turn calls the function "wait_net_suspend". This function suspends the LwIP network stack indefinitely which helps the RTOS to enter the IDLE state and then eventually into deep sleep power mode. The MCU will stay in deep sleep power mode until the network stack resumes. The network stack resumes when there is any Tx/Rx activity detected in between the path of WiFi driver and the network stack. So, this function is part of the LPA library defined in cy_lpa_wifi_ol_common.h. You can refer to the following link to see how this function is being used in a low power application-->

GitHub - cypresssemiconductorco/mtb-example-anycloud-wlan-lowpower: This code example demonstrates t...

Also, the low power offload packet assist filter implementation is provided in --> cy_lpa_wifi_tko_ol.c again part of LPA library. This library sets up the offload configurations cy_tko_ol_cfg and other WHD TCP keepalive offload APIs are provided in cy_whd_tko_api.c. So, I would recommend that if you want to use this functionality, you first go ahead and include the LPA library and then include the relevant functions provided in this library according to your implementation for MQTT application. I hope this helps!

Thanks

Aditi

.

View solution in original post

1 Reply
Moderator
Moderator

Hello,

If you're referring to AnyCloud-offload-TCP-Keepalive example, then this example employs the AnyCloud Low Power Assistant (LPA) middleware library which helps in developing low power wireless applications for the Cypress devices. The AnyCloud MQTT client doesn't employ the LPA library by default. You need to add that library via the Library Manager in the Modus ToolBox and make use of the offload functions provided in this library as attached in the snapshot.

For your reference, if you go through the offload keepalive example it calls a function "network_idle_task" which in turn calls the function "wait_net_suspend". This function suspends the LwIP network stack indefinitely which helps the RTOS to enter the IDLE state and then eventually into deep sleep power mode. The MCU will stay in deep sleep power mode until the network stack resumes. The network stack resumes when there is any Tx/Rx activity detected in between the path of WiFi driver and the network stack. So, this function is part of the LPA library defined in cy_lpa_wifi_ol_common.h. You can refer to the following link to see how this function is being used in a low power application-->

GitHub - cypresssemiconductorco/mtb-example-anycloud-wlan-lowpower: This code example demonstrates t...

Also, the low power offload packet assist filter implementation is provided in --> cy_lpa_wifi_tko_ol.c again part of LPA library. This library sets up the offload configurations cy_tko_ol_cfg and other WHD TCP keepalive offload APIs are provided in cy_whd_tko_api.c. So, I would recommend that if you want to use this functionality, you first go ahead and include the LPA library and then include the relevant functions provided in this library according to your implementation for MQTT application. I hope this helps!

Thanks

Aditi

.

View solution in original post