NRF9160 - LTE-M takes a long time for first connection

Hi! We are currently testing our custom device using the nrf9160 modem. Our use case is for an ultralow power IoT device that connects to the Internet each 30 minutes to send some data and then goes back to sleep. We don’t use PSM, when the device goes back to sleep, we disconnect from the cloud and set the modem to flight mode. The device will be in a place with no coverage (a maritime container) for days or weeks, in which the device will be in “hibernation mode”, trying to connect to LTE-M each 4 hours.

We have seen that after the first connection, the device connects to the LTE-M network in less than 5 seconds but before that, the first connection takes a long time, around two minutes.

We are using the command AT+CGDCONT before every connection to set the APN hoping that it will decrease the time it takes for that first connection, but it doesn’t make a lot of difference. The device travels around the world, so we cannot lock the LTE-M bands nor the country.

Why does the first connection take a long time and the rest doesn’t? What are the best practices to reduce the time of that first connection? Are there any other AT commands that we can use to reduce that time?

Thank you and best regards

Parents
  • Hi,

    Yes, the initial connection with a new SIM card/in a new location might take a long time.

    One thing you can try, is to use the %XCOUNTRYDATA AT command to give the modem a bit more information about what bands it should search first in the given country.

    However, much of the cell and network selection procedure is controlled by the LTE spec., so there isn't much that can be done.

    Why does the first connection take a long time and the rest doesn’t?

    The modem will store information about the connected network (in flash if you disconenct with AT+CFUN=0), and use this information when re-connecting to the network.

    That way, it knows what network to search for, and where to find it, and it doesn't have to try other networks first.

    Best regards,

    Didrik

  • Hi! Thank you for your quick reply. Unfortunately, the devices travel all around the world so we cannot know in which country the device is in when it’s trying to connect. 

    Is there any other thing we can do to help the modem connect that first time?

    Best regards

  • What SIM card are you using?

    How effective the use of %XCOUNTRYDATA is depends a lot on what SIM card you are using, and what networks the SIM card tells the modem to search for.

    One thing you can check is the first 5 or 6 digits of the IMSI (or is it a multi-IMSI SIM?), which tells you the home network of the SIM card, i.e. the network that the SIM card most wants to be connected to. The first 3 digits are the MCC, which represents the country, while the next 2 (European standard) or 3 (North American standard) represents the operator.

    A modem trace will also help show what the modem is doing while it is searching.

  • Hi Didrik,

    I'm using a 1nce SIM card. The MCC is 901 which according to 1nce information is "Worldwide Shared Mobile Country Code" (see this link).

    Regarding the modem trace I'm not sure I understand the proccess. As far as I know I need 2 UART, one for the AT commands and another one for the trace. But our custom board only has one UART (UART0). Can I get the trace with only one UART?

    I've been trying different configurations to improve the connection time. It seems using the XBANDLOCK command and locking bands 3 and 20 (used here in Spain) the time improves a lot, from more than 1 min to less than 30 seconds. I thought XBANDLOCK command and XCOUNTRYDATA command did the same: lock the search to the given bands. Am I missing something?

    Best regards.

  • Eneko said:
    I've been trying different configurations to improve the connection time. It seems using the XBANDLOCK command and locking bands 3 and 20 (used here in Spain) the time improves a lot, from more than 1 min to less than 30 seconds. I thought XBANDLOCK command and XCOUNTRYDATA command did the same: lock the search to the given bands. Am I missing something?

    %XBANDLOCK limits what bands the nRF9160 will use. The fewer bands that are enabled, the fewer bands it will have to search through, and the faster a suitable network will be found.

    %XCOUNTRYDATA on the other, simply changes the priority in which the enabled bands are searched through. It doesn't restrict which bands can be used. However, much of the network search process is also controlled by the LTE specification, so e.g. in this case, where the home network of the SIM card is a "global" network, the modem will have to search for that network first. If the SIM card had had a different home network, you would probably have seen a bigger improvement.

    Eneko said:
    Regarding the modem trace I'm not sure I understand the proccess. As far as I know I need 2 UART, one for the AT commands and another one for the trace. But our custom board only has one UART (UART0). Can I get the trace with only one UART?

    You only need one UART to take a modem trace. With an extra one, the Cellular Monitor is able to send some At commands to make sure that some information is available in the trace (and so that the Cellular Monitor is able to read the information out of the trace), but it is not strictly necessary.

    One other detail to be aware of, is that unless you are using NCS v2.5.0 which just released, the UART modem trace backend is hardcoded to use UART1. It works with the other UART instances as well, you will just have to change the code manually. Or, you can change the pins, so that UART1 uses the pins you usually use for UART0.

    Another option is to capture the trace over RTT instead. That way, you don't need to make any changes to how you use the peripherals of the nRF9160.

    But, with the home network of the SIM card being a "global" network, I doubt a modem trace will give us much more information.

  • Hi Dridik,

    Thank you so much for the explanation. 

    I updated the modem firmware to v1.3.5 as the modem won't search for PLMN started with 901.

    See mfw_nrf9160_1.3.5_release_notes.txt:

    - Fix for higher priority PLMN search. Global PLMN IDs (start with digit 9) are no more
      automatically considered to be suitable for higher priority PLMN search and selection.

    I'm using an iBasis SIM for comparation. For emulate the first connection I'm switching both SIMs to see the time. The iBasis SIM takes less than 20s to make the first connection.

    But with 1nce SIM don't see any improvement. It takes the same time (around 1:20 min) to connect using automatic network selection (+COPS=0).

    The second connection (resetting the MCU) takes almost no time with both SIM cards.

    If I change to 1nce SIM after connecting using iBasis it takes again 1:20 mins even if it's connecting to the same PLMN used by iBasis SIM.

    Could this behaviour mean the modem is still trying to connect to the Global home network (901)?

    Thank you for your help.

    Best regards.

  • Hi Didrik,

    Have you been able to look at this?

    Best regards!

Reply Children
  • Sorry for the late response.

    There might be other reasons for why the 1once SIM takes longer to connect to a network than just the time it takes to search for it.

    Could you take a modem trace, so we can look at what happens on the modem and SIM side?

  • Thanks.

    I have forwarded the trace to our modem team, so they can take a look at it.

    They typically answer quite quickly, so I should have an answer within a day or two.

  • Hi Didrik, any feedback from the modem team?

    Best regards.

  • Yes, and sorry for this taking a bit longer than expected. There were some additional details I had to check.

    First of all, the modem team pointed out that, in general, swapping the SIM cards does not simulate scenario where a new SIM card is used for the first time. Typically SIM card contains the last registered PLMN in EF_EPSLOCI file, so when such card is inserted to whatever device, the last registered PLMN will be searched first. In addition, factory reset would be needed for clearing the cell history modem has stored earlier.

    As for why the 1nce SIM card takes longer to connect to a network, this is what the modem team said:

    1nce log show that the SIM card does not contain EF_EPSLOCI file, thus the home network (HPLMN) must be searched first. The HPLMN was not found and the only preferred PLMN configured to the SIM card was not either found (262 01). The only option left for modem is to try to Attach to some random network with high quality signal (3 of them were found). At first modem tries to Attach to 214 01 and luckily the Attach succeeds immediately.

    They also commented on the use of %XCOUNTRYDATA:

    In general, for devices that travel a lot we recommend to use the %XCOUNTRYDATA which can be used for prioritizing certain bands and channels in certain countries. This is very useful if preferred networks for many different countries have been configured to the SIM card. So for example, 1nce SIM card had 262 01 configured as preferred network. If certain band had been configured with %XCOUNTRYDATA for MCC 262, that band would have been scanned first when in country with MCC 262 resulting typically much faster Attach. Unfortunately, 1nce card didn’t have more than one preferred network configured, so benefit of using %XCOUNTRYDATA would limited to country with MCC 262 only.

    Eneko said:
    I updated the modem firmware to v1.3.5 as the modem won't search for PLMN started with 901.

    Unfortunately, the fix introduced in mfw 1.3.5 doesn't impact the initial network search. However, it does mean that the modem will not search for the home network unless it is connected to a different global PLMN.

Related