AWS IoT disconnects after sending a ping for MQTT Keep Alive

We've noticed that our devices disconnects from AWS MQTT after pinging for the keep alive. It's only if we call the aws_iot_ping() function from the library. If we let the device automatically ping based on the  CONFIG_MQTT_KEEPALIVE setting we don't see it disconnect.

The reason we're using the aws_iot_ping() function is we want to ping when we're already sending an uplink ahead of the normal keep alive timeout so the device doesn't have to wake up and ping separately. To save battery we want it to uplink data and ping.

It doesn't happen every time, but once every few times it pings.

toolchain v2.4.2

nrf9160

mfw 1.3.6

Logs:

[00:43:33.383,636] <inf> cloud: aws_iot_send() success
[00:43:33.402,282] <inf> cloud: aws_iot_ping() success
+CEREG: 5,"800D","07530B0F",7,,,"00001010","11000001"
[00:43:33.430,053] <inf> cloud: LTE cell changed: Cell ID: 122882831, Tracking area: 32781
[00:43:33.438,964] <inf> cloud: AWS_IOT_EVT_DISCONNECTED
[00:43:33.445,190] <wrn> cloud: aws_iot_connect() failed, err -119
[00:43:33.452,056] <inf> cloud: Next connection retry in 30 seconds
[00:43:33.459,564] <inf> cloud: AWS_IOT_EVT_DISCONNECTED
+CSCON: 1
[00:43:34.466,674] <inf> cloud: RRC mode: Connected
+CSCON: 0
[00:43:41.258,972] <inf> cloud: RRC mode: Idle
[00:44:01.757,476] <inf> cloud: uplink queue count 1
[00:44:03.458,892] <inf> cloud: Next connection retry in 30 seconds
[00:44:03.465,576] <inf> cloud: AWS_IOT_EVT_CONNECTING
+CSCON: 1
[00:44:04.233,825] <inf> cloud: RRC mode: Connected
[00:44:09.270,812] <inf> cloud: AWS_IOT_EVT_CONNECTED

Parents Reply Children
No Data
Related