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!

    Could you try changing this part of the prj.conf file to what I have attached below:

    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_STACK_SENTINEL=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_RING_BUFFER=y
    
    # Segger RTT
    CONFIG_USE_SEGGER_RTT=n
    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG_BACKEND_RTT=n
    CONFIG_LOG_BACKEND_UART=y

    Try testing some commands and running it a bit. This will give us some more information about why the commands are failing. 

    I realized on my end it was failing due to the SIM card being out of data, so I haven't actually been able to reproduce your issue yet. 

  • Hi Heidi

    That really worked! What I did was, in Toolchain Manager, I did "update SDK" for V1.3.1, and then updated the prj.conf for the SLM, open project in SES, and run the build, flashed BIN into nRF Feather board. 

    And then manually ran the AT commands: see the results below:

    I think the XSEND need to be AT#XSEND=1, "Test TCP", although 1 is default, we need to supply. I also tried closing connection, reopening and then sending JSON data. That also worked fine Slight smile

    Thank you so much for your help!! 

    *** Booting Zephyr OS build v2.3.0-rc1-ncs2  ***
    Ready
    [00:00:00.194,122] .[0m<inf> app: Serial LTE Modem.[0m
    AT+CFUN=1
    OK
    AT+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
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,4,29
    OK
    +CIND: "service",1
    +CIND: "roam",1
    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
    [00:01:54.448,425] .[0m<dbg> modem_info.modem_info_string_get: Device contains 1 IP addresses.[0m
    AT#XCONNECT="138.68.40.173",1700
    #XCONNECT: 1
    OK
    AT#XCONNECT?
    +XCONNECT: 1
    OK
    AT#XSEND=1, "Test TCP"
    #XSEND: 8
    OK
    AT#XSOCKET=0
    #XSOCKET: 0, closed
    OK
    AT#XSOCKET?
    #XSOCKET: 0
    OK
    AT#XSOCKET=1,1,0
    #XSOCKET: 1, 1, 0, 6
    OK
    AT#XSOCKET?
    #XSOCKET: 1, 6, 0
    OK
    AT#XBIND=1700
    OK
    [00:08:58.125,640] .[0m<dbg> modem_info.modem_info_string_get: Device contains 1 IP addresses.[0m
    AT#XCONNECT="138.68.40.173",1700
    #XCONNECT: 1
    OK
    AT#XCONNECT?
    +XCONNECT: 1
    OK
    AT#XSEND=2,"{dev_euid:123, msg:ok}"
    #XSEND: 22
    OK
    AT#XSEND=2,"{dev_euid:123, msg:ok}"
    #XSEND: 22
    OK
    AT#XSEND=1, "Test TCP"
    #XSEND: 8
    OK
    AT#XSOCKET=0
    #XSOCKET: 0, closed
    OK
    
    

Related