Connecting nRF7002 to AWS IoT Core

Hi, I'm working on getting nRf7002 connected to AWS IoT Core and the process hasn't been so smooth, so I wanted to post and make sure I am on the right track (or if I'm not, get some guidance on the topic).

My development setup is as follows: nRF7002DK and 2.3.0 nRF Connect SDK/Toolchain, #include <net/aws_iot.h> library

What I've been able to do so far is connecting to a WiFi network and syncing the date time with NTP server. I am currently using the net/aws_iot library and trying to provision the aws certificates at runtime by specifying a header file with the aws private key and certificates. Unfortunately, I have been getting many build errors just by including the aws_iot.h file (haven't made any function calls yet), and it's been very confusing trying to resolve them.

It'd be great if I can get some help or suggestions from anyone with similar experience on this, any help is really appreciated! And sorry if this post seems like an easy-fix and I couldn't get it, I haven't found any examples of nrf7002 running the aws iot library on the internet yet. Thank you again for reading and helping!

Parents Reply Children
  • Hi Lalith, thank you for replying! Actually, I have been able to resolve the problem by another user's reply here:  Secure connection to AWS IoT over WiFi  So now the program builds and flashes to the nrf7002dk just fine. There were many pitfalls configuring the aws_iot library in prj.conf which I was not aware of. If I am have more questions, I will post them here for updates! Thank you again for replying.

  • Hi   can you share how you fixed some of these pitfalls in configuring your .prj file to work with AWS? I am currently in the same situation and am having a hard time getting my project to even compile.

  • Hi epietro, I did get the prj.conf sorted out thanks to Johannes from this post:  Secure connection to AWS IoT over WiFi , I did get an error saying my private key is bad when I try to connect to AWS... we have stepped away from aws_iot library for now but please let me know if you could use more help! And let me know if you make the connection work! It would be great if you can successfully load the AWS certificates

    -Eric

  • Thanks for the quick response  !

    I'm curious what you needed to include in your prj.conf file in order to get your project to compile?

    I can't even get my code to compile after adding the following lines for the AWS IoT library in the .config file:

    CONFIG_AWS_IOT=y
    CONFIG_AWS_IOT_CLIENT_ID_STATIC="silver-test"
    CONFIG_AWS_IOT_BROKER_HOST_NAME="example.endpoint.com"

    I tried following the linked ticket, configuring the additional settings as  mentioned, but wasn't successful. (prj.conf attached)

    If there is any obvious gotcha you can remember, I'd love to hear about it. Otherwise, I will keep digging away, no worries.
     
    Thanks again!
  • Hi Epietro, sorry for the late response, here are AWS_IOT-related configs I used (in addition to Johannes' suggestions), note that you can also load the certificate files manually with function calls, instead of from the config:

    # AWS Module
    # CONFIG_MQTT_CLEAN_SESSION=y
    # CONFIG_MQTT_LIB_TLS=y

    # CONFIG_MQTT_HELPER=y
    # CONFIG_MQTT_HELPER_NATIVE_TLS=y
    # CONFIG_MQTT_HELPER_SEC_TAG=10
    # CONFIG_MQTT_HELPER_CERTIFICATES_FILE="certificates.h"
    # CONFIG_TLS_CREDENTIAL_FILENAMES=y

    CONFIG_AWS_IOT=y
    CONFIG_AWS_IOT_SEC_TAG=24
    CONFIG_AWS_IOT_CLIENT_ID_APP=y
    CONFIG_AWS_IOT_BROKER_HOST_NAME_APP=y
    # CONFIG_AWS_IOT_PROVISION_CERTIFICATES=y
    # CONFIG_AWS_IOT_CERTIFICATES_FILE="certificates.h"
    CONFIG_AWS_IOT_CLIENT_ID_STATIC="aws_thing_name"
    CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT=1
    CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
    CONFIG_AWS_IOT_LAST_WILL=y
    CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
    CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y

    CONFIG_AWS_IOT_CONNECTION_POLL_THREAD=n
    CONFIG_AWS_IOT_SEND_TIMEOUT=n

     Hope this helps! I also have some AWS code uploaded in this ticket:  aws_iot mqtt_connect and client_connect failing (Check out Amanda's answer too, she provided a prj.conf in there and I will need to review it too)

    -Eric

Related