how to change Esim profile for nbiot fall back

Hi,

I'm using nrf9160custom board using sdk version 2.0.0
our Esim has 2 profiles one is for LTE and another one is for NB-IoT. Present i have tested tested LTE network and its working fine but i need to work on NB-IoT.

i have no idea how to do fallback for LTE to NB-IoT.

our Esim provider given fallback APDU command.

i have refered below document too but i don't have any how to send AT+CSIM command

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Faccess_uicc%2Faccess_uicc.html

Thank you

Parents
  • Hi,

    Which modem FW version are you using?

    Have you tried to just set the system modem to NB-IoT or LTE-M and NB-IoT, to see if the modem handles it automatically?

    You can find the documentation on how to send AT commands from the application here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrfxlib/nrf_modem/doc/at_interface.html

    Best regards,

    Didrik

  • Hi,

    Which modem FW version are you using?

    I'm using FW version 1.3.4 

    Have you tried to just set the system modem to NB-IoT or LTE-M and NB-IoT, to see if the modem handles it automatically?

    Before we using plastic sim card in that we have implemented he NB-IoT fallback and its working fine but now we are using ESIM instead of plastic sim .Now our ESIM have 2 profiles one is for LTE and another one is NB-IoT. 
    so if i need to using NB-IoT fallback first i have to change the profile. so how i can change the ESIM profile?

    our Esim providers proved APDU command for fallback. i have tried "AT+CSIMcommand for fallback but i don't either it changes or not. how i can i check either it change or not?

    if you need i can provide ESIM document for your reference.

    Thank you

  • Hi

    To begin with, it might be a good idea to just verify that you can attach to the NB-IoT network, by only enabling NB-IoT with AT%XSYSTEMMODE=0,1,0,0

    in my code its already configured when LTE not available its automatically changing to nb-iot

    please see the below logs 

    [00:07:39.458,343] <dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=0,1,0,0
    11:28:19.213 -> +CEREG: 2
    11:28:20.242 -> [00:08:13.738,037] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 2
    11:28:20.242 -> 
    11:28:20.242 -> [00:08:13.738,128] <err> lte_lc: Could not get tracking area code, error: -22
    11:28:20.242 -> [00:08:13.738,189] <err> lte_lc: Failed to parse notification (error -22): +CEREG: 2
    11:28:20.242 -> 
    11:28:38.644 -> %CESQ: 36,1,7,1
    11:28:38.644 -> +CEREG: 2,"C2F0","00273265",9
    11:28:38.644 -> LTE cell changed: Cell ID: 2568805, Tracking area: 49904
    11:28:39.622 -> [00:08:33.144,134] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 2,"C2F0","00273265",9
    11:28:39.622 -> 
    11:28:41.776 -> %CESQ: 34,1,0,0
    11:28:41.962 -> +CSCON: 1
    11:28:41.962 -> RRC mode: Connected
    11:28:42.149 -> %CESQ: 35,1,5,0
    11:28:42.149 -> +CEREG: 2,"C2F0","00273265",9,0,15
    11:28:42.196 -> +CSCON: 0
    11:28:42.196 -> RRC mode: Idle
    11:28:42.616 -> %CESQ: 255,0,255,0
    11:28:42.616 -> +CEREG: 2
    11:28:42.942 -> [00:08:36.482,147] <dbg> lte_lc.at_handler: +CSCON notification
    11:28:42.989 -> [00:08:36.700,225] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 2,"C2F0","00273265",9,0,15
    11:28:42.989 -> 
    11:28:42.989 -> [00:08:36.741,516] <dbg> lte_lc.at_handler: +CSCON notification
    11:28:42.989 -> [00:08:37.156,555] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 2
    11:28:42.989 -> 
    11:28:42.989 -> [00:08:37.156,646] <err> lte_lc: Could not get tracking area code, error: -22
    11:28:42.989 -> [00:08:37.156,707] <err> lte_lc: Failed to parse notification (error -22): +CEREG: 2
    11:28:42.989 -> 
    11:28:43.084 -> %CESQ: 37,1,8,1
    11:29:00.636 -> 
    

    Thank you

  • > AT+CSIM=14,80C2000009D3070202018110017D

    According AT+CSIM Docu, the length is "The number of hexadecimal characters.". So it's rather 28 than 14. And the value is a string using "". I guess, it should be

    AT+CSIM=28,"80C2000009D3070202018110017D"

  • Hi,

    AT+CSIM=28,"80C2000009D3070202018110017D"

    Thanks for the replay,

    i have tried this method in LTE link monitor

    when i send AT+CSIM=28,"80C2000009D3070202018110017D" below is the response logs  and LTE is show like in below 

    AT+CSIM=28,"80C2000009D3070202018110017D"
    +CSIM: 4,"980A"
    OK
    
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    %CESQ: 34,1,18,2
    +CGEV: ME PDN DEACT 0
    AT+CGDCONT?
    +CEREG: 0
    +CIND: "service",0
    +CIND: "roam",0+
    CGEV: ME DETACH
    OK
    AT+CGACT?
    OK
    +CEREG: 2,"05D7","019C4600",7
    AT+CESQ
    +CESQ: 99,99,255,255,17,35
    OK
    +CGEV: ME PDN ACT 0,0
    AT+CGDCONT?
    +CNEC_ESM: 50,0
    +CEREG: 5,"05D7","019C4600",7,,,"00000001","01011111"
    +CIND: "service",1
    +CIND: "roam",1
    +CGDCONT: 0,"IP","eapn1.net","100.108.4.22",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    OK
    +CNEC_ESM: 27,1

    when i send AT+CSIM=28,"80C2000009D3070202018110017C" below is the response logs  and LTE is showing Green.

    AT+CSIM=28,"80C2000009D3070202018110017C"
    +CSIM: 4,"9809"
    OK
    
    
    AT+CESQ
    +CESQ: 99,99,255,255,255,255
    OK
    %CESQ: 35,1,19,2
    +CGEV: ME PDN DEACT 0
    AT+CGDCONT?
    +CEREG: 0
    +CIND: "service",0
    +CIND: "roam",0
    +CGEV: ME DETACH
    OK
    AT+CGACT?
    OK
    +CEREG: 2,"05D7","019C4600",7
    +CGEV: ME PDN ACT 0,0
    AT+CGDCONT?
    +CNEC_ESM: 50,0
    +CEREG: 5,"05D7","019C4600",7,,,"00000001","01011111"
    +CIND: "service",1
    +CIND: "roam",1
    +CGDCONT: 0,"IP","eapn1.net","100.108.4.62",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    OK
    +CGEV: ME PDN ACT 1
    AT
    +CGDCONT?
    +CGDCONT: 0,"IP","eapn1.net","100.108.4.62",0,0
    +CGDCONT: 1,"IP","i-smsr.net","100.65.192.6",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    +CGACT: 1,1
    OK
    +CGEV: ME PDN DEACT 1
    +CNEC_ESM: 36,1
    AT+CGDCONT?
    +CGDCONT: 0,"IP","eapn1.net","100.108.4.62",0,0
    OK
    AT+CGACT?
    +CGACT: 0,1
    OK

    please check the both logs and let me know is profile switching happening or not for NB-IoT and LTE-M 

    Thank you

  • > +CEREG: 2,"05D7","019C4600",7

    AFAIK the "7" means LTE-M/CAT-M1. A "9" would be NB-IoT.

  • Hi,

    In that case E-sim not switching the profile right ?

    whats may the solution to switch the e-sim profile or need to send any command  for NB-IoT after switching the e-sim profile?

    Thank you

Reply Children
  • Your previous log from yesterday contains:

    > +CEREG: 2,"C2F0","00273265",9

    with that your device was connecting to NB-IoT.

    I don't know, how you setup your device. Therefore I don't know, what goes wrong or not nor what is required.

    My comment was mainly, that AT+CSIM has documentation and you didn't comply with that.

  • Hi sir,

    +CEREG: 2,"C2F0","00273265",9

    This logs i got from my  code in code i have already written NB-IoT fallback for physical sim but now i'm trying same thing for E-sim.
    But now i'm trying in LTE link monitor.

    After sending AT+CSIM  command how i can could whether e-sim profile changed or not.

    if it changed, i need to send AT%XSYSTEMMODE=0,1,0,0 to enable the NB-IoT ?

    for more clarity im send my fallback function when im using physical sim card please check it.

    static void lteConnect(void)
    {
        int err = NBIOT_ERROR_OK;
    
        if ((err = lte_lc_connect_async(lte_handler)) != NBIOT_ERROR_OK)
        {
            printk("Modem could not be configured, error: %d\n", err);
            err = NBIOT_ERROR_MODEM_CONFIG;
            errorHandler_process(err);
        }
    
        err = k_sem_take(&lte_connected_sem, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));
        if (err == -EAGAIN)
        {
            printk("LTE connection could not be established within timeout. "
                   "Schedule another attempt after sleeping\n");
    
            scheduleLTEReconnect(
                lte_reconnection_delay_s[atomic_get(&lte_reconnection_attempts)]);
    
            /*  get the current sytem mode from api and fallback */
            int error = NBIOT_ERROR_OK;
            error     = lte_lc_system_mode_get(&get_sys_mode_current);
            printk("Got mode %d \n", get_sys_mode_current);
            if (!error)
            {
                if (get_sys_mode_current == LTE_LC_SYSTEM_MODE_NBIOT)
                {
                    /* increment atomic variable to get the retry count of lte */
                    atomic_inc(&lte_try_count);
                    /*  Set the values in data structure to send to aws with fw
                     * info*/
                    sensor_config.nbt_try_count = atomic_get(&nbt_try_count);
                    sensor_config.lte_try_count = atomic_get(&lte_try_count);
                    // sprintf(sensor_config.nw_mode, "lte");
                    sensor_config.network_mode = NETWORK_MODE_LTE;
                    printk("Current mode is NB-IoT and changing it to LTE-CAT1 : "
                           "count of LTE-M: %d\n",
                           atomic_get(&lte_try_count));
                    /*  Set the fallback MODE to LTE */
                    int result = lte_lc_system_mode_set(LTE_LC_SYSTEM_MODE_LTEM);
                    if (!result)
                    {
                        printk("Set mode done\n");
                        /*  Sleep for a while just to give some time to change mode
                         Not given in Documantation but trial and error  */
                        k_msleep(5000);
                    }
                }
    
                else if (get_sys_mode_current == LTE_LC_SYSTEM_MODE_LTEM)
                {
                    /* increment atomic variable to get the retry count of lte */
                    atomic_inc(&nbt_try_count);
                    sensor_config.nbt_try_count = atomic_get(&nbt_try_count);
                    sensor_config.lte_try_count = atomic_get(&lte_try_count);
                    // sprintf(sensor_config.nw_mode, "nbt");
                    sensor_config.network_mode = NETWORK_MODE_LTE;
                    printk("Current mode is LTE-CAT1 and changing it to NB-IoT : "
                           "count of nbiot %d\n",
                           atomic_get(&nbt_try_count));
                    /*  Set the fallback MODE to NB-IoT */
                    int result = lte_lc_system_mode_set(LTE_LC_SYSTEM_MODE_NBIOT);
                    if (!result)
                    {
                        printk("Set mode done\n");
                        /*  Sleep for a while just to give some time to change mode
                        Not given in Documantation but trial and error  */
                        k_msleep(5000);
                    }
                }
            }
    
            /* Switch off modem until next reconnection attempt */
            modem_offline();
            return;
        }
    
        /* Setup Power Saving Mode */
        if ((err = setup_psm()) != NBIOT_ERROR_OK)
        {
            errorHandler_process(err);
        }
    
        return;
    }
    

    now i have added AT+CSIM command in this function to switch the profile which fall back is happening

    char nb_iot[] = "AT+CSIM=28,\"80C2000009D3070202018110017D\"";
    int err =at_cmd_write(nb_iot,NULL,0,NULL);
    printf("err:%d\n",err);

    but still its not connecting to NB-IoT . let me if need anything to add in code or need to add any configuration 

    Thank you

  • , could you take a modem trace, where you try to change the SIM profile and connect to NB-IoT?

  • Hi,

    we are using nrf9160 custom board can you guide how to take modem trace logs in custom board.

    In my board UART0 has UART to USB cable to see logs. how can i take modem trace using UART0?

    i have enabled "CONFIG_BSD_LIBRARY_TRACE_ENABLED=y" in prj.config

    below is my uart .dts

    &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	tx-pin = <29>;
    	rx-pin = <28>;
    };
    
    &uart1 {
    	status = "okay";
    	current-speed = <115200>;
    	tx-pin = <13>;
    	rx-pin = <14>;
    	rts-pin = <0xFFFFFFFF>;
    	cts-pin = <0xFFFFFFFF>;
    };

    char lte_m[] = "AT+CSIM=28,\"80C2000009D3070202018110017C\"";

    int err=at_cmd_write(lte_m,NULL,0,NULL);
    when i call this function im getting err=-8; may i know what it means?
     

    thank you

  • bhanu prakash said:
    i have enabled "CONFIG_BSD_LIBRARY_TRACE_ENABLED=y" in prj.config

    Note that for NCS v2.0.0, you should use CONFIG_NRF_MODEM_LIB_TRACE_ENABLED, not CONFIG_BSD_LIBRARY_TRACE_ENABLED.

    The trace backend is hardcoded to use UART1, so the easiest way to get the trace over UART is to just swap the pins between UART1 and UART0. That way, they trace will come over the correct pins, and you don't have to change anything else than the pin assignment in the device tree.

    bhanu prakash said:
    int err=at_cmd_write(lte_m,NULL,0,NULL);
    when i call this function im getting err=-8; may i know what it means?

    Which SDK version are you using?

    That function is deprecated, and had already been removed in NCS v2.0.0

Related