I'm using nRF Connect SDK v2.0.x with a Thingy 91. I have established my own AWS account, created a thing with the suggested security policy, and produced certificates per the instructions at https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/networking/aws_iot.html. Using the instructions given at https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/aws_iot/README.html I have provisioned my thingy 91 and then correctly set the options in the sample's prj.conf to reflect my AWS endpoint and thing name. I compile and flash with no problems.
My application collects data from a sensor and sends it to my AWS endpoint. I require a Quality of Service of 1, so the firmware waits for an acknowledgment after returning from the aws_iot_send function. The app has successfully published. But lately between the time the aws_iot_send function returns successfully and AWS sends an ACK, an AWS_IOT_EVT_DISCONNECTED occurs. Because of the disconnect I never get an acknowledgement and my app fails.
This is a debug log of what is occurring:
I have a watch-dog timer around my publish code so if the publish code doesn't return within a specified time the app resets/reboots the thingy 91. That's why you see the Zephyr information at the end of the log.
This is the RAW output from the Trace Collector V2 preview of the transmit:
trace-2023-04-18T20-14-36_aws_disconnect_waiting_for_ack.bin
This is the prj.conf file for this app:
I need help trying to figure out why the AWS_IOT_EVT_DISCONNECTED is happening.
Could it be because the message ID's are different as shown in the following log file lines:
[00:01:15.009,552] <dbg> aws_iot: aws_iot_send: Using message ID 33081 set by the library
and
[00:01:15.866,821] <dbg> aws_iot: aws_iot_send: Using message ID 8195 set by the application ?
I don't see any place for me to set .message_id in the aws_iot_data structure that I send to aws_iot_send so the first log line about the library setting the message ID seems right. But why don't they both use the same ID then and how did the second log line get the idea that the application set the ID it used?
Any insight or advice would be greatly appreciated.