Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Boron LTE] Fix external SIM getting stuck in init #2263

Merged
merged 3 commits into from
Jan 13, 2021

Conversation

keeramis
Copy link
Contributor

@keeramis keeramis commented Jan 6, 2021

Problem

Boron LTEs get stuck in initialization with third party SIMs, due to AT+CIMI (IMSI lookup) error in certain cases.

Solution

In an attempt to set credentials during init, for any SIMs whose ICCIDs are not recognized, their IMSI is checked. Checking IMSI after setting UMNOPROF (mobile network operator profile) gives a CME ERROR: SIM failure or CME ERROR: SIM wrong if not added a delay. Currently when this happens, we already have a retry logic that should have worked but the impl exits with an error instead of retrying.

  1. Added delay so that we don't expect these failures
  2. Fixed retry logic

Callbox SIM
=========
0000060048 [ncp.at] TRACE: > AT+CIMI
0000060050 [ncp.at] TRACE: < +CME ERROR: SIM wrong
0000060152 [ncp.at] TRACE: > AT+CIMI
0000060157 [ncp.at] TRACE: < 001010123456789
0000060158 [ncp.at] TRACE: < OK


0000099347 [ncp.at] TRACE: > AT+CIMI
0000099350 [ncp.at] TRACE: < +CME ERROR: SIM failure
0000099457 [ncp.at] TRACE: > AT+CIMI
0000099459 [ncp.at] TRACE: < +CME ERROR: SIM wrong
0000099659 [ncp.at] TRACE: > AT+CIMI
0000099661 [ncp.at] TRACE: < 001010123456789
0000099662 [ncp.at] TRACE: < OK

ATT EXTERNAL SIM with unrecongnised iccid
====================================
0000115689 [ncp.at] TRACE: > AT+CIMI
0000115693 [ncp.at] TRACE: < +CME ERROR: SIM wrong
0000115799 [ncp.at] TRACE: > AT+CIMI
0000115801 [ncp.at] TRACE: < +CME ERROR: SIM wrong
0000116001 [ncp.at] TRACE: > AT+CIMI
0000119879 [ncp.at] TRACE: < 310030001491024
0000119879 [ncp.at] TRACE: < OK



Steps to Test

Please make sure to use an external third-party SIM that is not recognized by network config db so that it's IMSI is checked to set credentials. We should no longer get stuck.

  1. Run this app
  2. Two button presses - resets the umnoprof setting
  3. Three button presses - attempts particle connect and should work

Example App

#include "Particle.h"
SerialLogHandler logHandler(LOG_LEVEL_ALL);
Serial1LogHandler logHandler1(115200, LOG_LEVEL_ALL);
SYSTEM_MODE(SEMI_AUTOMATIC);
bool reset_umnoprof = false;
bool particle_connect = false;
void button_handler(system_event_t event, int clicks)
{
    if (event == button_final_click) {
        if (clicks == 2) {
            reset_umnoprof = true;
        } else if (clicks == 3) {
            particle_connect = true;
        }
    }
}
void setup() {
    System.on(button_final_click, button_handler);
    // Cellular.setActiveSim(EXTERNAL_SIM); // you might need this
    // Cellular.setActiveSim(INTERNAL_SIM);
    Cellular.on();
    delay(5s);
    Log.info("\r\n\r\nCellular On\r\n\r\n");
}
void loop() {
    if (reset_umnoprof) {
        Log.info("Reset UMNOPROF");
        reset_umnoprof = false;
        Cellular.command(60000, "AT+CFUN=0\r\n");
        Cellular.command(1000, "AT+UMNOPROF=0\r\n");
        Cellular.command(1000, "AT+UMNOPROF?\r\n");
        Cellular.command(1000, "AT+CFUN=15\r\n");
        Log.info("\r\n\r\nCold boot for a Factory Boot Experience!\r\n\r\n");
    }
    if (particle_connect) {
        Log.info("Calling Particle.connect");
        particle_connect = false;
        Particle.connect();
    }
}

References

ch70471


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • N/A Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
hal/network/ncp_client/sara/sara_ncp_client.cpp Outdated Show resolved Hide resolved
@avtolstoy avtolstoy added this to the 2.0.2 milestone Jan 12, 2021
diff --git hal/src/electron/modem/mdm_hal.cpp hal/src/electron/modem/mdm_hal.cpp
index cfb7959ed..f7cb88c91 100644
--- hal/src/electron/modem/mdm_hal.cpp
+++ hal/src/electron/modem/mdm_hal.cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra file :D

break;
}
} while (++imsiCount < 2);
int ret = checkImsiForNetConf();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: CHECK(checkImsiForNetConf())

@@ -938,6 +940,30 @@ int SaraNcpClient::waitReady(bool powerOn) {
return SYSTEM_ERROR_NONE;
}

int SaraNcpClient::checkImsiForNetConf() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Probably the opposite? netconf for IMSI?

const int r = CHECK_PARSER(resp.readResult());
CHECK_TRUE(r == AtResponse::OK, SYSTEM_ERROR_AT_NOT_OK);
netConf_ = networkConfigForImsi(buf, strlen(buf));
int ret = checkImsiForNetConf();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: CHECK(checkImsiForNetConf())

@keeramis keeramis merged commit 11968f7 into develop Jan 13, 2021
@keeramis keeramis deleted the ch70471/cimi_delay branch January 13, 2021 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants