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

Unable to change APN

After struggling quite a bit to get network traffic going on nRF9160 DK using NB-IoT, I've contacted our SIM card provider (Com4 in Norway). They are telling me we need to change the APN from the default "com4" to "iot.com4.net".

However, no matter how I try to save this new APN, it always seem to revert back to "com4" when connecting to the network. Can you see if I'm doing anything wrong?

I've tried to set CONFIG_LTE_PDP_CMD=y, and assign my specific parameters to CONFIG_LTE_PDP_CONTEXT, as described here:

https://devzone.nordicsemi.com/f/nordic-q-a/52077/what-is-the-optimal-way-to-configure-the-modem/211386

Result: You can see the APN being set (lte_lc: PDP Context: AT+CGDCONT=0,"IP","iot.com4.net"), I'm reading AT+CGDCONT? while modem is connecting and APN is set to "iot.com4.net", but when I retry the query right after being connected to the LTE network (Network registration status: 1) the AT+CGDCONT? tells me the APN is "com4" again:

***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****
[00:00:00.378,112] 
[0m<dbg> nrf9160_gps.init: MAGPIO set: AT%XMAGPIO=1,0,0,1,1,1574,1577
[0m
GF modified Asset tracker started
[00:00:00.390,228] 

[0m<dbg> nrf_cloud_transport.nct_client_id_get: client_id = nrf-352656100223414
[0m
[00:00:00.399,444] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: shadow_base_topic: $aws/things/nrf-352656100223414/shadow
[0m
[00:00:00.411,102] 
 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: accepted_topic: nrf-352656100223414/shadow/get/accepted
 
[0m


[00:00:00.422,607] 
 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: rejected_topic: $aws/things/nrf-352656100223414/shadow/get/rejected
 
[0m


[00:00:00.435,119] 
 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: update_delta_topic: $aws/things/nrf-352656100223414/shadow/update/delta
 
[0m


[00:00:00.447,998] 
 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: update_topic: $aws/things/nrf-352656100223414/shadow/update
 
[0m


[00:00:00.459,838] 
 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: shadow_get_topic: $aws/things/nrf-352656100223414/shadow/get
 
[0m


Connecting to LTE network. This may take several minutes.


[00:00:00.478,027] 
 
[0m<inf> lte_lc: Using legacy LTE PCO mode...
 
[0m


[00:00:00.484,832] 
 
[0m<inf> lte_lc: PDP Context: AT+CGDCONT=0,"IP","iot.com4.net"
 
[0m


[00:00:00.492,553] 
 
[0m<dbg> lte_lc.w_lte_lc_connect: Network mode: AT%XSYSTEMMODE=0,1,1,0
 
[0m


AT+CGDCONT?


+CGDCONT: 0,"IP","iot.com4.net","",0,0

OK


[00:00:58.821,868] 
 
[0m<dbg> lte_lc.at_handler: recv: +CEREG: 2,"0CEB","020AD91C",9,0,0,"11100000","11100000"


 
[0m


[00:00:58.832,305] 
 
[0m<dbg> lte_lc.parse_nw_reg_status: Network registration status: 2
 
[0m


[00:01:00.568,237] 
 
[0m<dbg> lte_lc.at_handler: recv: +CEREG: 1,"0CEB","020AD91C",9,,,"11100000","11100000"


 
[0m


[00:01:00.578,491] 
 
[0m<dbg> lte_lc.parse_nw_reg_status: Network registration status: 1
 
[0m


Connected to LTE network


[00:01:00.589,172] 
 
[0m<dbg> nrf_cloud_transport.nct_connect: IPv4 Address 50.16.164.33
 
[0m


AT+CGDCONT?


+CGDCONT: 0,"IP","com4","100.64.69.128",0,0


OK


mqtt_connect(): client_connect() returned error code -116


cloud_connect failed: -111


LTE link disconnect


Shutdown modem


***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****

I also tried another variant, checking out the v1.0.0 version of the ncs repository and trying the at_client sample. Results: First of all, the method (as described in https://devzone.nordicsemi.com/f/nordic-q-a/49581/nrf-9160-dk---asset-tracker-and-ntp-not-working-nrf_cloud_connect_failed-22/198307#198307) of first calling AT+CDGCONT=... and then AT+CFUN=0 folowed by a reset of the device does not seem to store anything. Also, setting the APN after booting but before starting the modem at first seems to work, but when the modem is connected it has reverted back to the old APN:

***** Booting Zephyr OS v1.14.99-ncs2 *****
The AT host sample started
AT
OK
AT+CGDCONT?
OK
AT+CGDCONT=0,"IP","iot.com4.net"
OK
AT+CGDCONT?
+CGDCONT: 0,"IP","iot.com4.net","",0,0
OK
AT+CFUN=0
OK
AT+CGDCONT?
OK
AT+CGDCONT=0,"IP","iot.com4.net"
OK
AT+CFUN?
+CFUN: 4
OK
AT+CFUN=1
OK
AT+CGDCONT?
+CGDCONT: 0,"IP","com4","100.64.4.238",0,0
OK

(I'm running modem FW "mfw_nrf9160_1.0.1")

No matter how I try to save this new APN, it always seem to revert back to "com4" when connecting to the network. Can you see if I'm doing anything wrong? Or do you have any other suggestions?

Thanks for your help.

Parents
  • Hi, 

    Since the APN has quotes in it, you need to explicitly set this as \":

    CONFIG_LTE_PDP_CONTEXT="1,\"IP\",\"test\""

    This will end up as:

    AT+CGDCONT?
    +CGDCONT: 0,"IPV4V6","telenor.iot","10.111.223.35 2A02:2121:0048:8B27:0000:001A:DCA1:2701",0,0
    +CGDCONT: 1,"IP","test","",0,0
    OK
     

    -Amanda H.

  • Hi,

    I have gotten a suggestion to try to use context ID (CID) 1 for the new APN, but now I don't know how to specify that the modem should use CID 1 in stead of CID 0. 

    Using the command AT+CGACT=1,1 only returns error messages, and I have tried both in online and flight mode (CFUN=4 and 1):

    The AT host sample started
    AT
    OK
    AT+CGDCONT=1,"IP","iot.com4.net"
    OK
    AT+CGDCONT=0,"IP","com4"
    OK
    AT+CGACT=1,1
    ERROR
    AT+CGACT=0,0
    ERROR
    AT+CFUN=1
    OK
    AT+CGACT=1,1
    ERROR
    AT+CGDCONT?
    +CGDCONT: 0,"IP","com4","100.64.93.245",0,0
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    

    How do I specify that the modem should use context ID 1?

    Thank you for your help.

  • Hi.

    According to our modem team, you will not be able to activate a second APN until you are attached to the network.

    Also, you to make sure, have you remembered to change to NB-IoT mode?

    What is the result of AT%XMONITOR?

    Best regards,

    Didrik

Reply Children
  • Hi and thanks for the suggestions.

    When trying to activate a second APN after being attached to the network ("AT+CGACT=1,1"), I receive an error "ERROR" and error code "+CNEC_ESM: 65,1". According to 3GPP TS 24.301 Table 9.9.4.4.1 for EPS session management errors codes, error code 65 means "Maximum number of EPS bearers reached".

    I double checked the device is in NB-IoT mode (as shown in the log below), and AT%XMONITOR seems to return sensible values as far as I can tell (shown in log below).

    I'm not quite sure what to make of the "Maximum number of EPS bearers reached" error (I've tried searching for it), so more help would be great.

    To summarize so far: I am able to connect to the cellular network and I am even assigned an IP address on CID 0 with APN "com4". However, data traffic won't work and when I speak to the network provider (Com4 in Norway) they tell me I need to use APN "iot.com4.net". However there is a limitation in the nRF9160 so I'm not able to replace CID 0 but have to create an additional CID 1 with the different APN. However when trying to activate CID 1 an error is returned (as mentioned above).

    Is this a limitation in the nRF9160 or a limitation with the network provider? Or are they just not compatible (yet)? Are there other things I can try?

    Log from AT Client:

    ***** Booting Zephyr OS v1.14.99-ncs2 *****
    The AT host sample started
    AT
    OK
    AT%XSYSTEMMODE?
    %XSYSTEMMODE: 0,1,1,0
    OK
    AT+CFUN?
    +CFUN: 4
    
    OK
    AT+CGDCONT=1,"IP","iot.com4.net"
    OK
    AT+CGDCONT?
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    AT+CFUN=1
    OK
    AT+CFUN?
    +CFUN: 1
    OK
    AT+CGSN=1
    +CGSN: "352656100223414"
    OK
    AT+CGMI
    Nordic Semiconductor ASA
    OK
    AT+CGMM
    nRF9160-SICA
    OK
    AT+CGMR
    mfw_nrf9160_1.0.1
    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?
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    AT+CGACT?
    +CGACT: 1,0
    OK
    AT+CGEREP=1
    OK
    AT+CIND=1,1,1
    OK
    
    AT+CEREG=2
    OK
    AT+CEREG?
    +CEREG: 2,"0CEB","0202791C",9
    +CEREG: 2,2,"0CEB","0202791C",9
    OK
    AT%CESQ=1
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,255,59
    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
    242090000457851
    OK
    +CGEV: ME PDN ACT 0,0
    +CNEC_ESM: 50,0
    +CEREG: 1,"0CEB","0202791C",9
    +CIND: "service",1
    AT+CGDCONT?
    +CGDCONT: 0,"IP","com4","100.64.66.80",0,0
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    
    AT+COPS=3,2
    OK
    AT+CGACT?
    +CGACT: 0,1
    +CGACT: 1,0
    OK
    AT+COPS?
    +COPS: 0,2,"24202",9
    OK
    AT%XCBAND
    %XCBAND: 20
    OK
    AT+CGDCONT?
    +CGDCONT: 0,"IP","com4","100.64.66.80",0,0
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    +CGACT: 1,0
    OK
    AT+CFUN?
    +CFUN: 1
    OK
    AT+CGSN=1
    +CGSN: "352656100223414"
    OK
    AT+CGMI
    Nordic Semiconductor ASA
    OK
    AT+CGMM
    nRF9160-SICA
    OK
    AT+CGMR
    mfw_nrf9160_1.0.1
    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: 1
    OK
    AT+CNEC?
    +CNEC: 24
    OK
    AT+CGEREP?
    +CGEREP: 1,0
    OK
    AT+CIND=1,1,1
    OK
    AT+CEREG=2
    OK
    
    AT+CEREG?
    +CEREG: 2,1,"0CEB","0202791C",9
    OK
    AT+COPS=3,2
    OK
    AT+COPS?
    +COPS: 0,2,"24202",9
    OK
    AT%XCBAND
    %XCBAND: 20
    OK
    
    AT+CGDCONT?
    +CGDCONT: 0,"IP","com4","100.64.66.80",0,0
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    +CGACT: 1,0
    OK
    AT%CESQ=1
    OK
    AT+CESQ
    +CESQ: 99,99,255,255,255,59
    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
    242090000457851
    OK
    AT+CGACT=1,1
    ERROR
    +CNEC_ESM: 65,1
    
    AT%XMONITOR
    %XMONITOR: 1,"Telia","Telia","24202","0CEB",9,20,"0202791C",31,6254,59,29,"","11100000","11100000"
    OK
    AT+CGDCONT?
    +CGDCONT: 0,"IP","com4","100.64.66.80",0,0
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    AT+CGACT=1,1
    ERROR
    AT+CGACT=0,0
    ERROR
    AT+CGDCONT?
    +CGDCONT: 0,"IP","com4","100.64.66.80",0,0
    +CGDCONT: 1,"IP","iot.com4.net","",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    +CGACT: 1,0
    OK
    
    

    Kind regards,

    Terje

  • Hi.

    I am out of ideas at the moment but have requested help from our modem team.

    They will probably want a modem trace to help identify what is going on.

    Can you take a modem trace where you override the default APN (CGDCONT=0, ...) before turning on the modem (similar to your first log from the at_client), and upload the trace together with the application log?

    If you want to, you can also do the same where you are using a different PDN context.

    If you do not know how to take a modem trace, you can follow this guide: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect

    Best regards,

    Didrik

  • Hi,

    Thank you for your support.

    I have now been in contact with the network provider, and they have changed my SIM/subsription settings for it to work on NB-IoT. And now I am able to get an IP address "automagically" for the correct APN when connecting to the network! So the error message was related to carrier configuration/limitations.

    I am a bit annoyed that my network provider did not told me this needed to be done for it to work on NB-IoT before when I contacted them... But anyway, it now looks promising.

    I will test tomorrow if network traffic now finally works.

  • Success! I Network traffic now works.

    The problem turned out to be the network provider not having configured my SIM card/subscription to allow it to use NB-IoT. And also not telling me about this the first time I contacted them...

    After this configuration change with the network provider, the correct APN is automatically used for context CID 0. I tested however with CID 1 also, and activating CID 1 and deactivating CID 0 now also works.

    My conclusion: Error message "+CNEC_ESM: 65,1" - "Maximum number of EPS bearers reached" - indicated a problem with the cellular subscription configuration.

    Thank you for your help.

    Kind regards,

    Terje

Related