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

nrf9160 (NRF9160-SICA-R) as modem for sending/receiving data by AT Commands

Hi DevZone! 

I would like to use nrf9160 for sending/receiving data by interfacing it with my microcontroller over UART and sending AT commands. I have a nrf9160 Feather board (check here) which is flashed with the latest modem firmware. I have tested it with CoolTerm (serial terminal app) and it responds with AT Commands. Now I am looking for example set of commands which can help in sending/receiving data over TCP, this will really help a lot! 

Requesting your help/ any pointer

Thanks 

Silas 

Parents Reply
  • Jared's tutorial contains everything you need! Make sure to follow his steps to modify the Serial LTE Modem sample and you should be good to go.

    But to answer your specific question (for you and other viewers), to get the .bin file that you, enable bootloader functionality by adding CONFIG_BOOTLOADER_MCUBOOT=y to the "prj.conf" file. 

    Then when you build the file you need (app_update.bin) will be located here:

    <build_folder>/zephyr/app_update.bin

    Best regards,

    Heidi

Children
  • Hi Jared & Heidi

    Thank you so much for your help! The SLM works for me now:)

    Now I am trying to send simple data to my Ubuntu server (on DigitalOcean). But not able to get through

    Here are the AT commands that I run in CoolTerm

    Ready
    AT+CFUN=1
    OK
    AT+CFUN?
    +CFUN: 1
    OK
    AT+CIND=1,0,1
    OK
    AT+CIND?
    +CIND: 1,0,1
    OK
    AT+CPIN?
    +CPIN: READY
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    AT+CEREG?
    +CEREG: 0,4,"FFFE","FFFFFFFF",7
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    +CIND: "service",1
    AT+CESQ
    +CESQ: 99,99,255,255,8,29
    OK
    AT+CEREG?
    +CEREG: 0,5,"0936","0C74150F",7
    OK
    AT+CGDCONT?
    +CGDCONT: 0,"IP","hologram","10.117.238.97",0,0
    OK
    AT#XSOCKET=1,1,0
    #XSOCKET: 1, 1, 0, 6
    OK
    AT#XBIND=1700
    OK
    at#xtcpconn="138.68.40.173",1700
    ERROR
    

    After turning on the nRF to full function, and waiting for sometime, it gets signal strength, but when trying to establish the connection, it gives error.  And on Hologram website, I see that the nRF did get connected, but no data sent.  What is going on? 

    Thanks

    Silas

     

  • Hi!

    #XTCPCONN is not an AT command, which is why it's returning an error. Try AT#XCONNECT="138.68.40.173",1700 instead. 

    Also AT#XSOCKET=1,1,0 closes a socket. Try AT#XSOCKET=0,1,0 to open a client socket or 0,1,1 to open a server socket. 

    Edit due to incorrect documentation: Also AT#XSOCKET=0,1,0 closes a socket. Try AT#XSOCKET=1,1,0 to open a client socket or 1,1,1 to open a server socket. 

  • HI Heidi

    I got the command #XTCPCONN from this excel (click here) which summarizes all commands. But that could be an older version. 

    Further for command AT#SOCKET,  I tried AT#XSOCKET=0,1,0  or  0,1,1  and it always returned error..

    Trying AT#XSOCKET=1,1,0 --> always worked (as you can see in the result attached). Further sending this command AT#XCONNECT? also returned +XCONNECT: 1 (which is connected)

    but finally it fails when tried to send some data using AT#XSEND="Test TCP"

    Would you please help Slight smile Thank you so much!

    Ready
    AT+CFUN=1
    OK
    AT+CIND=1,1,1
    OK
    AT+CIND?
    +CIND: 1,1,1
    OK
    AT+CPIN?
    +CPIN: READY
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    +CIND: "service",1
    +CIND: "roam",1
    AT+CESQ
    +CESQ: 99,99,255,255,12,33
    OK
    AT+CEREG?
    +CEREG: 0,5,"0936","0C74150F",7
    OK
    AT+CGDCONT?
    +CGDCONT: 0,"IP","hologram","10.117.238.97",0,0
    OK
    AT#XSOCKET=1,1,0
    #XSOCKET: 1, 1, 0, 6
    OK
    AT#XSOCKET?
    #XSOCKET: 1, 6, 0
    OK
    AT#XBIND=1700
    OK
    AT#XCONNECT="138.68.40.173",1700
    #XSOCKET: -116, closed
    ERROR
    AT#XSOCKET=1,1,0
    #XSOCKET: 1, 1, 0, 6
    OK
    AT#XSOCKET?
    #XSOCKET: 1, 6, 0
    OK
    AT#XBIND=1700
    OK
    AT#XCONNECT="138.68.40.173",1700
    #XCONNECT: 1
    OK
    AT#XCONNECT?
    +XCONNECT: 1
    OK
    AT#XSEND="Test TCP"
    ERROR
    AT#XSOCKET=0
    #XSOCKET: 0, closed
    OK
    AT#XSOCKET=0,1,0
    ERROR
    AT#XSOCKET=0,1,1
    ERROR
    

  • Should I try getting the latest SLM app code from the nRF Connect on GitHub?

  • Hi! Sorry about the late reply. I've been testing and seeing the same issues you are seeing, with no solution yet. 

    I've been testing the SLM application on the master branch of NCS with no luck so I don't think upgrading will help. 

    I know there have been some issues with the SLM application previously, so I will see if anybody has experienced this. 

    The comment I made earlier about the #SOCKET command was incorrect, by the way. The documentation is wrong, it's 1 to open and 0 to close. 

    Best regards,

    Heidi

Related