This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

mqtt_simple connect to AWS

I have an AWS account and I am comfortable with the AWS IOT operation in general. I have used it in the past. I am trying to get the sample mqtt_simple to connect to AWS IOT and be able to send packets and receive packets to the nRF9160dk board.

 I am not sure how to set up mqtt_simple parameters? I have created a thing and certificates. I have named the thing "nrf-IMEI" as recommended so it has the board ID in it. All I want to do is to be able to publish a packet to a topic on my AWS account and receive a packet from a topic in my AWS account. I have done this several times in the past with other systems so I am comfortable with AWS IOT operations and formats. I just do not understand how to get mqtt_simple to publish from my board to AWS and subscribe to messages from AWS.

Is this the correct program to use. It seems like all the pieces are there I just do not know how to use them.

I appreciate any help you can give, This is an essential requirement of our production system. right now we are using the pre-production system with a modified version of asset_tracker to send sensor data to the nRF Connect site. We need to be able to send sensor data to our AWS site.

Parents
  • Martin

    The problem of not connecting was the SIM cards were full on both boards. I am loading and trying things a hundred times a day and I forgot to check the SIM cards. That still lives the original problem that it connects to AWS and crashes as soon as I do the first publish. I still need any insight you have into solving that  problem.

  • Hi Timothy,
    The issue is most likely that cJSON_Init() never gets called.
    If it's not called malloc/free from newlib will then be used, and this causes issues since malloc/free gets mixed up with k_malloc/k_free.

    So if you call cJSON_init() someplace in your code it should work.

  • Jan

    any update on this? is it supported and if so do you understand why I am crashing? If not can you tell me when it is supported and I will continue to work with V1.2.0 until it is supported.

  • Hi, 

    Yusuke, only nRF Cloud backend is officially supported and tested in NCS releases. I'm not aware of timeline for official AWS IoT support. I would expect it to work, however. 

    Timothy, it looks like the client token object in received jobs message is empty. You could use debugger to check if that's the reason for crash.

    I'm out of office the next few weeks, so I will unfortunately not be able to follow up much at this time. Hopefully Martin can pick it up or forward it to someone who can. If not, I will pick it up when I'm back. 

    Best regards, 

    Jan Tore 

  • Can anyone tell where to look for the client token object in received jobs. How do I tell if jobs are empty and if so why are they empty? is that fatal? If they are empty who is supposed to put data in them? I appreciate any help you can give. I am sure it is something simple I have not added or set correctly. It does send the Flip data JSON packet so a lot has to be working for that to go to my AWS account.

  • There is another problem with the V1.2.0 asset_tracker for AWS that is a show stopper. The Asset_tracker connects to AWS and sends the FLIP, device info, RSRP, and status information to our AWS site, This runs without a problem forever on any single board. We have seen no problem running for days at a time. I recently got a second board working and a colleague got a board working. We are all running the same code. When any one of the boards starts up and connects to AWS and tries to publish the other boards see a POLLHUP which resets the boards. These boards will then in turn reach the same connection point and reset the other boards. It is a death spiral.

    How can two or more AWS connections be able to disconnect the MQTT connection on different boards no matter if they are located in different states. The only common denominator is the AWS account. All boards are connecting to the same AWS account which is a requirement since lambda functions on that account are putting all the data from the various boards into dynamodb tables.  any thing I could do to fix this problem would be appreciated.

  • I forgot to mention that my two boards have two different sets of certificates.

Reply Children
No Data
Related