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

AT Commands from Application Space

I have my first custom nRF9160 prototype boards back and they seem to be working pretty well.

One question I do have is that I have been unable to find a clear concise description of how to send an AT command from within main.c in the application space.  I am using the AT_CLIENT sample, and I have it running and responding from both the LTE Link Monitor and from my terminal (I am on a Mac using OSX). All I want to do is make sure that the modem is turned on and active.  I’m never sure if the modem is turned on by default in the AT_CLIENT sample or if  when using nRF LTE Link Monitor, by reading CFUN (AT+CFUN?) it is actually turning the modem on. In order to turn the modem on from main.c is it as simple as setting:


CONFIG_AT_CMD=y
CONFIG_AT_NOTIF=y

in proj.conf  and then invoking

#include <modem/at_cmd.h>
#include <modem/at_notif.h>

at_cmd_write("AT+CFUN=21", NULL, 0, NULL)

in main.c?

I've looked through many posts in the forums and the online documentation but haven't found anything this fundamentally basic.


Thanks!

Related