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:

Fullscreen
1
2
3
4
***** Booting Zephyr OS v1.14.99-ncs1 *****
Application started
LTE LC config ...
nrf_cloud_connect failed: 22
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
***** 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...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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:

    Fullscreen
    1
    2
    3
    4
    client_fd: 2
    bind err: 0
    sendto ret: 48
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    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.

  • You can try this sample, as it hard codes the IP address, and doesn't call getaddrinfo:

    https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/ftp/src/main.c

     

    Does this one work as intended? (it should print out the robots.txt file)

     

    Kind regards,

    Håkon

  • It doesn't either:

    Fullscreen
    1
    2
    FTP example
    connect err: 60
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    All i've changed is the network mode to NBIoT.

  • 60 resolves to ETIMEDOUT. Could you try to use the at_client and LTE Link Monitor, and post the log? Your return err codes leads towards low signal strength, and if you post the log when connecting over at_client, it should hold alot of debug info.

     

    Kind regards,

    Håkon

Reply
  • 60 resolves to ETIMEDOUT. Could you try to use the at_client and LTE Link Monitor, and post the log? Your return err codes leads towards low signal strength, and if you post the log when connecting over at_client, it should hold alot of debug info.

     

    Kind regards,

    Håkon

Children
  • Here's the log:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    2019-07-12T07:44:12.005Z DEBUG modem << ***** Booting Zephyr OS v1.14.99-ncs1 *****\x0D
    2019-07-12T07:44:12.009Z DEBUG modem << \x0A
    2019-07-12T07:44:12.012Z DEBUG modem << Flash region\x09\x09Domain\x09\x09Permissions\x0D
    2019-07-12T07:44:12.024Z DEBUG modem << \x0A
    2019-07-12T07:44:12.035Z DEBUG modem << 00 0x00000 0x08000 \x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.065Z DEBUG modem << 01 0x08000 0x10000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.069Z DEBUG modem << 02 0x10000 0x18000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.074Z DEBUG modem << 03 0x18000 0x20000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.079Z DEBUG modem << 04 0x20000 0x28000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.083Z DEBUG modem << 05 0x28000 0x30000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.085Z DEBUG modem << 06 0x30000 0x38000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.088Z DEBUG modem << 07 0x38000 0x40000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.090Z DEBUG modem << 08 0x40000 0x48000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.092Z DEBUG modem << 09 0x48000 0x50000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.097Z DEBUG modem << 10 0x50000 0x58000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.100Z DEBUG modem << 11 0x58000 0x60000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.117Z DEBUG modem << 12 0x60000 0x68000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.120Z DEBUG modem << 13 0x68000 0x70000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.126Z DEBUG modem << 14 0x70000 0x78000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.129Z DEBUG modem << 15 0x78000 0x80000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-12T07:44:12.133Z DEBUG modem << 16 0x80000 0x88000 \x09Non-Secure\x09rwxl\x0D\x0A
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi,

     

    Thank you for the log.

    Do you have a iBasis SIM card you can try with nb-iot to see if this works better?

    Have you contacted your current local carrier and asked about the issues you are seeing? DNS does not seem to be provided by the network, and I would also recommend asking if they have any restriction in TCP based traffic on NB-IoT.

     

    Kind regards,

    Håkon

  • No, I don't have the iBasis SIM. I'm trying to use different APN now. I'm able to do that manually in at_client and it does connect successfully:

    Fullscreen
    1
    2
    at+cgdcont?
    +CGDCONT: 0,"IP","test.nbiot","100.88.198.213",0,0
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    However, after restarting the module it just insists to use the old APN (aiut.nbiot), even when I didn't specify it. I guess the same is happening when loading a program and it connects to the network automatically (like the ftp you've sent me to test). Is there a way to stop it from connecting to the old APN?

  • Set the APN manually, then issue "AT+CFUN=0" to store it persistently.

    When you reboot, it should now have the APN that you set.

     

    Kind regards,

    Håkon

  • Well, it doesn't work. The APN is remembered after changing the mode to offline (4), but power off just resets it to the default one.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    at+cgdcont?
    +CGDCONT: 0,"IP","aiut.nbiot","10.12.0.2",0,0
    OK
    at+cfun=0
    OK
    AT+CFUN?
    +CFUN: 4
    OK
    at+cgdcont=0,"IP","test.nbiot",,,,0
    OK
    AT+CFUN=1
    OK
    at+cgdcont?
    +CGDCONT: 0,"IP","test.nbiot","100.120.208.204",0,0
    OK
    at+cgcontrdp=0
    +CGCONTRDP: 0,,"test.nbiot","","","213.158.199.1","213.158.199.5",,,,,1500
    OK
    at+cfun=4
    OK
    AT+CFUN?
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX