Modem connecting to networks, but not getting a registered notification

Hi, 

I have been developing on the nRF9160 for a while now, and we have a product on the market that sends data over NB-IoT or LTE-M networks. I have recently been trying to add a new feature where the end user can test out their signal strength before they install the product, in case the need to use a better (and more expensive) antenna. Initially all was fine, but I was testing a number of things, like how it worked on each network, with and without PSM, etc. Essentially I made it so whenever this feature was triggered, it would turn off the modem, disable PSM, turn the modem on, record the signal strength every x seconds, then when all the data was collected, send in an MQTT message and power down the modem. At the end it would make sure that the next time it needed to use the modem, that it would initialise everything again, as it does when the modem is first powered up, or after it fails to connect. 

Whilst testing this I noticed that something I had done had made it so the first time it connects to a network, it always timed out. The timeout was something I implemented myself, to save battery. It basically just runs in a loop until the modem gets the LTE_LC_NW_REG_REGISTERED_ROAMING or LTE_LC_NW_REG_REGISTERED_HOME status, and lte mode as 7 or 9.

I could see from my debug printing that the modem was connected to a network, and getting valid levels of signal, but the registration was still set as LTE_LC_NW_REG_SEARCHING. I couldn't understand why this started happening, and why it only happened on the first attempt, so I reprogrammed that unit back to an older version of firmware, which I knew didn't have that problem - but the issue was still there. I went back to my first release version, and again it happened.

My next thought was something to do with the Sim card. so I used a different one (same brand), and it still happened, and another one that is locked to Vodafone with a different APN. Again it happened. Consistently the unit cannot register on the first attempt, and other units can, so I thought it had to be something in the modem flash that's gone wrong or something, so I use a version of the AT client program to talk to the modem via AT commands, and use the factory reset command to try get rid of the issue, but still no luck. I tried reprogamming the modem firmware, and using an older version of modem firmware, still happens. 

I eventually give up and just use a new unit to develop on, and this time implemented it in a slightly different way, making sure that the modem was definitely either in sleep mode or powered down when the signal check feature was started, incase something went wrong with two threads trying to talk to the modem at the same time or similar. All was going fine, until I found this new unit started doing the same thing!

Do you have any idea what could have triggered this?

Is there a way to completely reset the modem? (I used both AT%FACTORYRESET=0 and AT%FACTORYRESET=1 )

Is there a debug AT command that will list all settings that I can compare the two strange units and units that don't have this problem?

I am using SDK 1.6.1 and Modem FW 1.3.1. The exact code of what I have added in to create this feature is below (with debug stuff and our own non-modem related functions removed)

lte_lc_power_off();

lte_lc_psm_req(false);

lte_lc_power_on();

modem_info_init();

modem_info_rsrp_register(rsrp_callback);

k_timer_start(&signal_check_timer, K_SECONDS(period), K_SECONDS(period));
while(sig_check_time_period_complete < num_values_to_record)
{
	k_sleep(K_SECONDS(1));
}
k_timer_stop(&signal_check_timer);
sprintf(str, "[I] Signal Check Values - %u, %u, %u, %u, %u", CSQ_arr[0], CSQ_arr[1], CSQ_arr[2], CSQ_arr[3], CSQ_arr[4]);
printk(str);

//Do stuff with flash and NFC - 10-100ms

send_messages(0,1,0,1);   //MQTT message to our server with the signal check values

lte_lc_power_off();

modem_init_flag = false;    //Tells our modem thread to reinitialise modem stuff next time it runs

Thanks, 

Damien

  • Hello Damien,

    Just wanted to let you know that I will need some time to look into it.

    Best regards,

    Michal

  • UPDATE:

    Whilst doing building up a number of units and testing them, I found that there are a couple that also had this behavior on old application FW, so I believe the issue is nothing to do with what I adding into the application code. 

    I just used a modified version of the AT_Client FW to run some tests on the units that are exhibiting this behavior. Before I set AT+CFUN=1, I turned on registration notifications (AT+CEREG=1) and set the functionality to online - AT+CFUN=1. 

    Within a few seconds I got these responses:

    OK
    +CEREG: 2
    +CEREG: 5
    

    So the units themselves are actually registering to the network, but the code is not picking up on it. Further to this, in testing I manually changed the registration to to "Registered Roaming - 5", but when I tried to send data it always failed with a variety of errors, so I assumed it wasn't actually registered. I am wondering if there is just stuff that needs to be set in background libraries. 

    What could cause this to happen? I am thinking something like increasing heap/stack size may sort it, but not sure exactly. 

    Thanks, 

    Damien

  • Further Update:

    I used the UDP sample firmware when first creating my application code. So I just tried to use that with the 2 affected units. Both failed to register.

    I then downloaded SDK 2.2.0 and tried the same sample, and it registered immediately. 

    I still don't understand what's going on. When I debug and hit breakpoints on the AT_handler, I can see the responses coming in and it constantly gets a version of +CEREG: 2....

    I did notice that when I get a RCC: Connected notifaction I do have 

    evt->nw_reg_status = LTE_LC_NW_REG_REGISTERED_HOME
    But I get no registration notification. 
    The solution is to update everything to SDK 2.2.0, but I feel like that doesn't explain the problem, and I would like to find out in case something similar happens again. 
    Thanks, 
    Damien
  • Hello Damien,

    Thank you for the updates.

    Unfortunately I don't have any updates yet. I will have to consult my colleagues about those issues.

    Best regards,

    Michal

  • Okay thanks. 

    Just a note, I have spent the last few days trying to update the SDK in project and failing. I fell back to 2.0.0 and I can now build everything, but I have found almost nothing works in the same way. UART, SPI (SPI_NOR) and I2C are all not working. Is there any resource that actually spells out exactly what has changed in terms of the way drivers work from release to release? Everything I have found is very limited in terms of differences, and it's a real struggle to get through. 

    Thanks, 

    Damien

Related