Are there any examples out there for a host application in C that is using AT commands via serial to the nRF9160 running the Serial LTE Modem for a MQTT TLS connection?

I'm currently working on a POC for the nRF9160 with an external host processor. I have the Serial LTE Modem example running on the nRF9160 and have the serial comms between the host and the nRF9160 working well with the AT commands so far. My issue is that I'm new to AT commands and cellular in general. So I've been piecing together a C program to run on our host processor running Debian for managing a MQTT connection to the cloud. Right now I'm able to get my system to connect to the Nordic test.mosquitto.com broker and sub/pub to the topics I've created. But my next step is to add TLS and then move it to our AWS cloud.

I was able to find a sequence for bringing up the LTE and MQTT connection via hit or miss trials of different sequences I saw in other examples using the nRFConnect Link Monitor and the IoT Introduction course for the nRF9160. But I'm not 100% certain I have the sequence correct. It works but I would love to have an example from the host side in C to make sure I haven't missed something that will become important once I start really getting into the functionality. I know there are examples out there for the nRF9160 that do everything I'm trying to do but the ones I've found are all intended to run solely on the nRF9160 without the host processor. So I'm guessing which AT command would take care of that functionality because the nRF9160 code uses the libraries pretty heavily.

With trying to add TLS to my system, I've run into a few questions in addition to my concerns with the basic LTE and MQTT functionality. From looking at the Serial LTE Modem code, it looks to be set up to handle the sockets. But do I need to issue the AT command to establish one via the host or does the Serial LTE Modem code know that sockets are needed and take care of it for me? Do I need to change any of the Serial LTE Modem configurations if I want the certs and keys handled by the nRF9160? If the host processor needs to setup the socket, does the socket come before the MQTT connection or after?

Any C code, documentation, or even just a nice sequence diagram with the AT commands would be a HUGE help!!! But I will take any help I can get. Slight smile

Using VSCode for both processors, 2.2.0 nRF Connect Tool chain, and Debian Buster or Bullseye.

Related