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 

  • 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

  • Ok That sounds pretty disappointing Disappointed

    Should I then use at_client application? We need to test either TCP or UDP for sending a few bytes of data successfully. That will help us going with nRF9160.  

    Thanks you so much!

Related