I have an issue with integration of the AWS IoT in my source code. The example works for me. I've tried to copy&paste the example code to my project (I delete my main.c and use example code), but aws_iot_connect() resets the chip without any RTT output on the reason why the chip was reset.
I remember there was some nrfjprog command to read the reset reason, but I'm unable to find that command at the moment. Does someone know what command it is?
Also do you have some general ideas on why would aws_iot_connect() cause this behavior?
It is possible to use the general Cloud API to cover the difference of AWS/AZURE/NRF_Cloud, but just enabling CLOUD_API is not enough. You can refer to the nRF9160: Cloud client sample about…
The application codes should not work if you only paste the codes in main.c to your project. The AWS IoT example is a whole solution based on NCS, not just codes in main.c. I suggest you adapt your project into the sample instead.
You can find all nrfjprog commands from this page, just check which one you used before.
I don't understand why wouldn't it work? My project and the AWS IoT example use the same NCS. The only reason to fail would have to be related to Kconfig. I've made sure that the configuration in my project is the same as the one in the example though (parts relevant to the AWS IoT).
I've searched all over nrfjprog documentation, and I wasn't able to find the specific command that I've mentioned in the post. It would literally print out a string explaining the cause of last reset.
Ok, good to know your project is also based on NCS, what is the purpose of your project? Can you share a minimal sample of your codes that can recreate the issue?
Hi Charlie,So I am using nrf9160dk board, with ncs1.6.1. In the samples/nrf9160/aws_iot there is an example for aws_iot which works for me. I've copied over the same main file to my project, and I've adjusted the config but the aws_iot didn't work anymore. I've tested a bit, and found that it works when I set CONFIG_API_CLOUD=n. But I don't understand why this happens.
Is CONFIG_API_CLOUD defined by yourself? I did not find it from any official NCS document and codes.
My bad, the define is: CONFIG_CLOUD_API.
I do not know why you need to enable it before, but for AWS IoT usage, this is not necessary and should not be enabled.
As I've said it works when I disable this config, but here:https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/networking/aws_iot.htmlIt's clearly stated that AWS IoT can work with this config enabled.
I have another question (maybe I can open a ticket for it).
I have connected to the aws mqtt broker from the aws mqtt test client, mqtt.fx app and from my device.
I have subscribed with the device to all of the default shadow topics available via config. I have also subscribed to the two default custom topic(my-custom-topic/example(2)). When I publish from either of the three clients that I use, aws iot test client and mqtt.fx receive the message if they are subscribed to a specific topic. I was expecting same behavior for my nrf9160dk device - I expect "AWS_IOT_EVT_DATA_RECEIVED" event to happen whenever I publish to a topic that nrf9160dk is subscribed to.
However this event seems to happen randomly completely. (out of sync with my publishes)
Any idea on what could cause this?