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

nRF9160 HTTP client AT commands always returns +CME ERROR: 0

Hello,

I am trying to get my nRF9160 to connect to a https server via AT commands, but this is as far as I've been able to get.

In the end this will be used in a project where another micro is monitoring peripherals and doing a bunch of logging, then powering the modem power supply up, initializing via AT commands and uploading data logs via HTTPS POST using a security token to authorize the device server side. I know I could be using the modem micro for all of this, but the RTOS/Zephyr toolchain has been painful to work with.

Log:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2021-04-12T21:52:25.858Z INFO Application data folder: C:\Users\user\AppData\Roaming\nrfconnect\pc-nrfconnect-linkmonitor
2021-04-12T21:52:25.991Z DEBUG App pc-nrfconnect-linkmonitor v1.1.10 official
2021-04-12T21:52:25.991Z DEBUG App path: C:\Users\user\.nrfconnect-apps\node_modules\pc-nrfconnect-linkmonitor
2021-04-12T21:52:25.991Z DEBUG nRFConnect 3.6.1 is supported by the app (^3.6.0)
2021-04-12T21:52:25.992Z DEBUG nRFConnect path: C:\Users\user\AppData\Local\Programs\nrfconnect\resources\app.asar
2021-04-12T21:52:25.992Z DEBUG HomeDir: C:\Users\user
2021-04-12T21:52:25.992Z DEBUG TmpDir: C:\Users\user\AppData\Local\Temp
2021-04-12T21:52:26.017Z VERBOSE Could not fetch serial number for serial port at COM1
2021-04-12T21:52:34.311Z INFO Modem port is opened
2021-04-12T21:52:34.321Z DEBUG modem >> AT+CFUN?
2021-04-12T21:52:34.359Z DEBUG modem << +CFUN: 0
2021-04-12T21:52:34.368Z DEBUG modem << OK
2021-04-12T21:52:40.478Z DEBUG modem >> AT
2021-04-12T21:52:40.494Z DEBUG modem << OK
2021-04-12T21:52:43.110Z DEBUG modem >> AT+CFUN=1
2021-04-12T21:52:43.158Z DEBUG modem << OK
2021-04-12T21:52:47.848Z DEBUG modem >> AT+CFUN?
2021-04-12T21:52:47.858Z DEBUG modem << +CFUN: 1
2021-04-12T21:52:47.877Z DEBUG modem << OK
2021-04-12T21:52:47.883Z DEBUG modem >> AT+CGSN=1
2021-04-12T21:52:47.894Z DEBUG modem << +CGSN: "352656106114062"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

seems fine

Mostly right now, I turn the modem power on, then send:

Fullscreen
1
2
3
4
5
6
AT+CFUN=1
AT+CFUN?
AT+CGDCONT=1,"IP","m2m.telus.iot"
AT+CFUN?
AT+CFUN?
AT#XHTTPCCON=1,"google.ca",80
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks,

Kyle

Edit:
It appears the FW doesn't support the HTTPCCON command?? even though its in the documentation?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2021-04-12T22:34:30.215Z DEBUG modem >> AT#XCLAC
2021-04-12T22:34:30.226Z DEBUG modem << AT#XSLMVER
2021-04-12T22:34:30.228Z DEBUG modem << AT#XSLMUART
2021-04-12T22:34:30.232Z DEBUG modem << AT#XSLEEP
2021-04-12T22:34:30.234Z DEBUG modem << AT#XRESET
2021-04-12T22:34:30.234Z DEBUG modem << AT#XDATACTRL
2021-04-12T22:34:30.246Z DEBUG modem << AT#XTCPFILTER
2021-04-12T22:34:30.248Z DEBUG modem << AT#XTCPSVR
2021-04-12T22:34:30.249Z DEBUG modem << AT#XTCPCLI
2021-04-12T22:34:30.250Z DEBUG modem << AT#XTCPSEND
2021-04-12T22:34:30.252Z DEBUG modem << AT#XTCPRECV
2021-04-12T22:34:30.254Z DEBUG modem << AT#XUDPSVR
2021-04-12T22:34:30.255Z DEBUG modem << AT#XUDPCLI
2021-04-12T22:34:30.256Z DEBUG modem << AT#XUDPSEND
2021-04-12T22:34:30.257Z DEBUG modem << AT#XSOCKET
2021-04-12T22:34:30.258Z DEBUG modem << AT#XSOCKETOPT
2021-04-12T22:34:30.259Z DEBUG modem << AT#XBIND
2021-04-12T22:34:30.260Z DEBUG modem << AT#XCONNECT
2021-04-12T22:34:30.261Z DEBUG modem << AT#XLISTEN
2021-04-12T22:34:30.276Z DEBUG modem << AT#XACCEPT
2021-04-12T22:34:30.277Z DEBUG modem << AT#XSEND
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Trying 
img_app_bl/serial_lte_modem_2021-03-01_8e8c6089.hex

and 

img_app_bl/nrf9160dk_at_client_2021-03-01_8e8c6089.hex   << doesn't do anything different other than it no longer responds to AT#XCLAC

Edit2:

The FTP commands seem to be missing from both FW as well?

Edit3:

Part of good news, it does connect to the network and I can ping things, and use a normal TCP socket to manually request a non-SSL page, but this is not great because we want SSL and not have to build the HTTP layer.

Parents
  • Hi,

    HTTP support is disabled by default in the Serial LTE Modem application in NCS v1.5.0, and is therefore also disabled in the pre-compiled hex file.

    This was changed in this PR: https://github.com/nrfconnect/sdk-nrf/pull/4153

    So to enable HTTP, FTP, MQTT and GPS support, you must compile the application yourself with the relevant options enabled.

    Best regards,

    Didrik

  • Hello Didrik,

    Sorry for the delay, I ended up busy with another problem.

    That is a bit disappointing, not being able to just load the serial_lte_modem application and have access to all documented AT commands. I have not had a good time with the nRF9160 development compared to AVR or Pic thus far.

    The link you gave leads to a 404 page, I will be trying to recompile in the next couple days here. Can you please send me a link works so I can read changes that where made?

    Thanks,

    Kyle

    Edit: there was a comma at the end of the URL somehow

    Edit: I have tried to open the existing serial_lte_modem application, but I can't figiure out how to open it in the SEGGER IDE recommended in nRF connect.

  • Sorry for the faulty link, I have fixed it now.

    But you shouldn't necessarily apply the same changes. The PR changes the defaults, while it might be better for you to just change the applied configuration.

    The easiest way to do that is to uncomment lines 91, 92, 94 and 96 (or just the ones you want) in the prj.conf file.

    The easiest way to install and use the nRF Connect SDK is explained here:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.1/nrf/gs_assistant.html#toolchain-manager

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.1/nrf/gs_programming.html

    Note that when installing the SDK through the Toolchain Manager, you must open SES or the command line from the Toolchain Manager for the environment to be configured correctly.

    I've also attached a image with all the features enabled, compiled for the nRF9160 DK.

    slm_all_features_dk.hex

  • Hello Didrik,

    I will try that slm_all_features.hex file. That is the full feature version of "serial_lte_modem" I take it?

    Now that we are on the topic of building your own projects.

    Here is a video showing my problems when trying to compile myself: https://youtu.be/-u4lV7Ohl-s

    For the future it would be good if I can get it compiled on my own to keep things up to date.

    I would really like to be able to write code to run on the modem itself, rather than rely on an external microprocessor.

    Thanks,

    Kyle

  • Thanks for the video.

    I would recommend that you stick to the SDK versions you install with the Toolchain Manager (TM). That way, you can be sure that the provided tools works with the given SDK version, and it makes it easier for us to replicate any potential problems you have as the environments will be similar.

    If you want to download the code yourself (e.g. if you want to maintain your own fork of the SDK), you should still keep to the tagged releases, as the master branch sometimes require newer tools than what is provided by the TM, or it might not work at all.

    The reason why you couldn't find any HTTP related configs in the prj.conf is because you were using the master branch, which has the PR where all features are enabled by default merged. So in that version, you do not need to enable them yourself.

    Another point I want to clarify is that the check-boxes in the "Open NCS project" dialog box only selects which samples are shown in the drop down menu. The project will still include all the libraries it needs (and which are enabled in Kconfig, etc.).

    It also looked like you picked the wrong board. When you are using the modem, you must build your application as non-secure. To do that, you must choose the nrf9160dk_nrf9160ns board (notice the "ns" at the end). Although, if you didn't pick the non-secure version, you shouldn't have been able to open the project at all, so maybe I saw incorrectly, or missed something when you skipped forward.

    I haven't seen the build errors you got before, but my guess is that it is because you are using the master branch. If you check out the v1.5.0 tag and run west update, it should work (though you will have to enable HTTP support yourself). It could also be that you didn't use "build solution" as you did when you built the blinky sample, though I don't know enough about SES to say if what you did are supposed to work or not. I mostly use the command line myself.

  • So the version on the GIT repo is not 1.5.0(that I am running), no big deal, odd thing though. I had to manually select the applications DIR in the 1.5.0 SDK for it to show up in my list.

    Odd, I can open with or without "NS"

    Trying to compile now....

    AND THAT WORKED! I will probably make a video for others with a similar background to me for getting started with this dev kit.

    Thanks for the help, if I have any other issues I will let you know!

Reply
  • So the version on the GIT repo is not 1.5.0(that I am running), no big deal, odd thing though. I had to manually select the applications DIR in the 1.5.0 SDK for it to show up in my list.

    Odd, I can open with or without "NS"

    Trying to compile now....

    AND THAT WORKED! I will probably make a video for others with a similar background to me for getting started with this dev kit.

    Thanks for the help, if I have any other issues I will let you know!

Children
No Data