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

nrf9160 fails to connect to NB-IoT

Hello,

lately i've not been able to connect to NB-IoT network as i did before.

Long story short:

I'm working with nrf9160 since 3 months and i have been able to connect without any issues to NB-IoT national network. Lately (last month) i had always bigger problems trying to connect. At first it still connected sometimes, but now i'm not able to connect anymore. One month ago, after first problems arised i updated to modem firmware to 1.2.0 with no luck. For such reason, i opened THIS TICKET because i was getting getaddrinfo error -11. Apparently, using manual DNS setting i solved the problem...or so i thought...after few succesfull tries i had again the same error.

My setup:

NRF9160DK (modem firmware 1.2.0)

IBasis SIM (should roam in ROME, ITALY on NB-IoT NATIONAL NETWORK)

I'm running AT Client sample to make some tests and this is the log:

AT+CFUN?
+CFUN: 0
OK
AT+CGDCONT?
OK
AT+CFUN=1
OK
AT+CGDCONT?
OK
AT+CFUN?
+CFUN: 1
OK
AT+CGSN=1
+CGSN: "352656100036634"
OK
AT+CGMI
Nordic Semiconductor ASA
OK
AT+CGMM
nRF9160-SICA
OK
AT+CGMR
mfw_nrf9160_1.2.0
OK
AT+CEMODE?
+CEMODE: 0
OK
AT%XCBAND=?%XCBAND: (1,2,3,4,5,8,12,13,17,19,20,25,26,28,66)
OK
AT+CMEE?
+CMEE: 0
OK
AT+CMEE=1
OK
AT+CNEC?
+CNEC: 0
OK
AT+CNEC=24
OK
AT+CGEREP?
+CGEREP: 0,0
OK
AT+CGDCONT?
OK
AT+CGACT?
OK
AT+CGEREP=1
OK
AT+CIND=1,1,1
OK
AT+CEREG=2
OK
AT+CEREG?
+CEREG: 2,4,"FFFE","FFFFFFFF",9
OK
AT%CESQ=1
OK
AT+CESQ
+CESQ: 99,99,255,255,255,255
OK
AT%XSIM=1
OK
AT%XSIM?
%XSIM: 1
OK
AT+CPIN?
+CPIN: READY
OK
AT+CPINR="SIM PIN"
+CPINR: "SIM PIN",3
OK
AT+CIMI
204080813513852
OK
%CESQ: 68,3,23,3
+CEREG: 2,"7B88","04DCDD88",9
+CNEC_ESM: 38,0
+CNEC_EMM: 19
+CEREG: 2,"90EA","010F0971",9
+CNEC_EMM: 13
%CESQ: 255,0,255,0
+CEREG: 2,"FFFE","FFFFFFFF",9
%CESQ: 62,3,24,3
+CEREG: 2,"80F3","04987148",9
+CNEC_EMM: 15+CEREG: 4,"80F3","04987148",9
%CESQ: 255,0,255,0
+CEREG: 4,"FFFE","FFFFFFFF",9
%CESQ: 63,3,24,3
+CEREG: 4,"80F3","04987148",9
AT+CGDCONT?+CGDCONT: 0,"IP","","",0,0
OK+CEREG: 2,"7B88","04DCDD88",9
+CNEC_ESM: 38,0
+CNEC_EMM: 19
%CESQ: 68,3,24,3
+CEREG: 4,"80F3","04987148",9
%CESQ: 63,3,24,3
+CEREG: 2,"7B88","04DCDD88",9
%CESQ: 68,3,24,3
%CESQ: 68,3,29,4
+CNEC_ESM: 38,0
+CNEC_EMM: 19
+CEREG: 4,"80F3","04987148",9
%CESQ: 63,3,29,4
%CESQ: 63,3,24,3
+CEREG: 2,"7B88","04DCDD88",9
%CESQ: 68,3,24,3
%CESQ: 68,3,29,4
AT+COPS?
+COPS: 0
OK
AT+COPS=?
+COPS: (1,"","","22288",9),(1,"","","22210",9),(1,"","","22201",9)

This is the screenshot of my LTE Link Control panel:

Some final questions that could be useful to address this issue:

1) If i run AT+CGDCONT? command i get "+CGDCONT: 0,"IP","","",0,0". I expected something like "+CGDCONT: 0,"IP","ibasis.iot","",0,0. Is it normal?

2) In THIS page i noted that Vodafone has Modem firmware certification only for version 1.1.0. In the case i'm connecting to Vodafone NB-IoT network (not sure about it, didn't verify when it was working), could this be the issue?

3) If the log above there are 2 lines about error codes from ESM, EMM, in particular error 19 (Network Failure). Does it refer to a problem external to the board? Does it mean is a network-side problem?

Thank you,

Frax

  • Hi Francesco,
    Please try sending the following command (before turning on the modem (AT+CFUN=1)):

    AT%XEPCO=0
    
    also make sure you select the modem to connect to nb-iot
    AT%XSYSTEMMODE=0,1,0,0

    Selecting the modem to choose nb-iot

    The first command will tell the modem to use Legacy PCO instead of ePCO.

    2. If your product is going to be used on the Vodafone network you should use the Modem firmware that is certified for that network, as you see  mfw: 1.1.0 

    So you could try to downgrade to if my first suggestion does not work. (depending on which network you connect to)

    3. EMM cause #19 "ESM failure" -- > usually means that the UE (nrf91 in this case) is rejected from the attach request. There could be several reasons for this, but let's try the first suggestions and I suspect that at least one of the options will work out.

    .

    Br,
    martin l.

  • Hi Martin,

    thank you for the suggestions. I tried with your first one (AT%XEPCO=0  followed by AT%XSYSTEMMODE=0,1,0,0 before AT+CFUN=1) with "at_client" and it seems to work really well. Differently from before, even when my connection worked (2 month ago), the connection time greatly reduced from minutes to seconds.

    Unfortunately i am not able to obtain the same results with my code. Until now i was using the function lte_lc_init_and_connect(), but i'm thinking that this function overwrite my settings (PCO and System Mode). This is what i tried:

    //libs include
    
    
    //routine for modem comunication
    int atCmdTxRx(char* command, char* response_buf, int response_buf_len){
        //routine code here - this works, no need to check
    }
    
    static void modem_configure(void)
    {
      if (IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT)) {
        /* Do nothing, modem is already turned on
        * and connected.
        */
      } else {
        int err;
        char recv_buf[50];
        
        //Modem config as Martin suggested
        err = atCmdTxRx("AT%XEPCO=0", recv_buf, sizeof(recv_buf));
        if (err<0)
          printk("Error %d, PCO not set\n", err);
        err = atCmdTxRx("AT%XSYSTEMMODE=0,1,0,0", recv_buf, sizeof(recv_buf));
        if (err<0)
          printk("Error %d, NB-IoT mode not set\n", err);
    
        //Init network connection
        printk("LTE Link Connecting ...\n");
        u32_t lte_init_time= k_uptime_get_32();
        err = lte_lc_init_and_connect();
        //tried even "lte_lc_connect()" with no results as well
        __ASSERT(err == 0, "LTE link could not be established.");
        printk("LTE Link Connected!\n");
        lte_init_time =(k_uptime_get_32()-lte_init_time)/1000;
        printk("Time to connect: %d seconds\n", lte_init_time);
        }
    }

    As you can see i even tried lte_lc_connect(), skipping the initialization, with no results. I don't even see CEREG notification (even if i add AT+CEREG=5 command before the function). Is there a procedure to connect with the setup you suggested from code?

    Thank you

    Francesco

  • Hi Francesco,

    I am glad to hear that it worked.

    This can easily be done in you application as well when using the "LTE Link Controller" library as you are already using.

    You do not need to do that manual step you included before the lte_lc_connect() since you can just enable the lte_lc library to take care of it. (so you can remove those lines)

    In the Kconfig file to lte_link_control you can see all the configurations you can set.
    So to enable legacy PCO in your application, you can just add the following line in your prj.conf file:

    CONFIG_LTE_LEGACY_PCO_MODE=y

    And for the preferred LTE technology the modem should use (same as xsystemmode), This is also to be applied in your applications prj.conf file:

    CONFIG_LTE_NETWORK_MODE_NBIOT=y


    Then when you lte_lc_init_and_connect() the library will select and set this settings for you since you have enabled the configurations in prj.conf.

    More about how configurations work is explained in our tutorial.



    Best regards,
    Martin L.

  • Hi Martina,

    everything works like charm now! Wonderful! From 7-8 minutes on having an not stable (or no at all) connection to 6-15 seconds to connect! 

    I read the tutorial when i started some month ago but was not able to fully grasp how powerful it was. Now that i'm more capable i got how important it is.

    Thanks!

    Frax

  • Hi Fancesco,
    I am glad to hear that the solution worked out.


    Best regards,
    Martin L.

Related