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

nRF 9160 DK - Asset Tracker (and NTP) not working (nrf_cloud_connect_failed: 22)

Hello!

I'm trying to make the asset_tracker sample working on the nRF9160 DK. The at_client worked just fine and I was able to connect to the base station (I'm using NBiOT). Now I'm planning to send/receive some data through UDP and first I wanted to try to connect to the nRF Cloud and then try some other sample programs, such as NTP. Here's the problem:

I changed the network mode in SES to NBIoT and it works as I checked it with %XSYSTEMMODE (it returns 0,1,0,0). But as soon as the system boots I'm getting an error:

***** Booting Zephyr OS v1.14.99-ncs1 *****
Application started
LTE LC config ...
nrf_cloud_connect failed: 22

and then it just reboots. With network set as default (LTE-M) it won't "fail" but won't connect either obviously. Now i've looked for a solution online but none of it worked (even custom .hex files targeted specifically at this problem). I've tried the AT%XEPCO=0 and AT%XBANDLOCK=1, "10010101" (this one doesn't work, returns an error).

Firmware: 1.0.0
Board v0.7.0
SES V4.16 Nordic Edition (64-bit)

I've had similar experience with other example programs trying to connect to the network. They work in LTE-M mode (trying to connect), but after changing it to NBIoT they're just crashing.

NTP for example:

***** Booting Zephyr OS v1.14.99-ncs1 *****
getaddrinfo err: 22

Exception occurred in Secure State
***** HARD FAULT *****
  Fault escalation (see below)
***** BUS FAULT *****
  Precise data bus error
  BFAR Address: 0x50008120
***** Hardware exception *****
Current thread ID = 0x20020134
Faulting instruction address = 0xe380
Fatal fault in ISR! Spinning...

Again, the at_client works fine as some of the other samples (like gps), so i believe the programming procedure isn't the problem. I'm guessing there's an additional configuration procedure needed which i don't know about.

merged.hex

Parents
  • Hi,

     

    Your problem is the dns resolution, as "getaddrinfo err: 22" indicates that your local carrier does not provide you with a DNS server.

    You can try to hardcode the IP address if you want, and in addition, I would recommend that you contact your carrier to let them know about this issue.

     

    Kind regards,

    Håkon

  • Hi,

    thank you for your response. I'm still trying to make the NTP sample work. At this moment I'm fine with providing an exact IP address . So i've changed the NTP_HOST domain name to IP address (tried many, 129.240.2.6 for example) and figured that it could work without any other changes, as I looked it up in udp_with_psm sample and it's done the same way there (just an IP address as an getaddrinfo function argument). Looks like it works:

    client_fd: 2
    bind err: 0
    
    sendto ret: 48

    and iirc the return value of sendto is supposed to represent octets sent. But there's no response from the NTP server.

    I've also tried sending it to our private server but without success (no packets received on server side).

    Making the asset_tracker work would be nice but i'm not sure how to make it work without the DNS server and it's not my priority.

  • Yes, i've tried many combinations but the old APN is still coming back:

    1. +CFUN = 0
    2. +CGDCONT=0,"IP","test.nbiot",,,,0
    3. +CFUN = 1
    4. <connect to the network>
    5. +CFUN = 0
    6. <RESET>

    1. +CFUN = 0
    2. +CGDCONT=0,"IP","test.nbiot",,,,0
    4. +CFUN = 0
    5. <RESET>

    None of these work.

  • Try to only set the APN, then issue cfun=0:

    1. AT+CGDCONT=...

    2. AT+CFUN=0

    3. Reset the board after "OK" has been printed.

     

    If it still does not work, add it to your firmware as a startup command.

  • Okay, the AT command method just didn't work, it still insisted on the old APN. I've managed to put it into the project configuration files and it worked, so the issue was about the wrong APN the whole time. Now everything works as expected, including NTP and FTP examples even through DNS, but the asset_tracker has some problems still - this time it's -111 error and honestly I don't care about it anymore. Now I'm looking forward to make the whole system compatible with our software that is using AT commands for IP traffic, so I tried to run the uart sample, but somehow even this one has some problems. I guess it's a topic for another question because I've extended this one to the extreme anyway.

    Thank you for your time.

  • Hi, I have a similar problem of not being able to change the APN. If you could provide details on how you managed to get it to work ("I've managed to put it into the project configuration files and it worked"), that would be great!

    Kind regards, Terje

  • Hi,

    at the time the APN  was disappearing after cutting off the power, but I was able to change it with +CGDCONT command. You need to turn off the module first (by AT command), because CID0 can't be changed otherwise. In order to make it default (I'm not sure if this is the correct way, but here's how I did it and it worked), I changed it in the config files:

    - initial project config - conf in the project folder:

    • CONFIG_LTE_NETWORK_MODE_NBIOT=y
    • CONFIG_LTE_PDP_CMD=y

    after building the project (it was overwritten after every change of the project config), in build_nrf9160_pca10090ns/zephyr/.config :

    • CONFIG_LTE_PDP_CONTEXT="0,\"IP\",\"test.nbiot\"".

    After building the project once again, it should be the default APN. Good luck.

Reply
  • Hi,

    at the time the APN  was disappearing after cutting off the power, but I was able to change it with +CGDCONT command. You need to turn off the module first (by AT command), because CID0 can't be changed otherwise. In order to make it default (I'm not sure if this is the correct way, but here's how I did it and it worked), I changed it in the config files:

    - initial project config - conf in the project folder:

    • CONFIG_LTE_NETWORK_MODE_NBIOT=y
    • CONFIG_LTE_PDP_CMD=y

    after building the project (it was overwritten after every change of the project config), in build_nrf9160_pca10090ns/zephyr/.config :

    • CONFIG_LTE_PDP_CONTEXT="0,\"IP\",\"test.nbiot\"".

    After building the project once again, it should be the default APN. Good luck.

Children
No Data
Related