MQTT keepalive offload

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

cross mob
Sharn_Lin
Level 2
Level 2
10 sign-ins 5 questions asked 5 sign-ins

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
1 Solution
lock attach
Attachments are accessible only for community members.
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

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
lock attach
Attachments are accessible only for community members.
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

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

.