Switching SIMs without flashing new firmware on Boron

The docs show us that to switch to internal/external SIM, we need to flash a new firmware. Is there any potential harm in switch between the internal and external SIM by simply a reset on the Boron 2g/3g?

I’ve tested this code:

void loop() {

}

void setup() {
	if(Cellular.getActiveSim() == INTERNAL_SIM) {
		Cellular.setActiveSim(EXTERNAL_SIM);
		Cellular.setCredentials("apn_here");
	} else if (Cellular.getActiveSim() == EXTERNAL_SIM) {
		Cellular.setActiveSim(INTERNAL_SIM);
		Cellular.clearCredentials();
	}
	// signal that the switch happened
	pinMode(D7, OUTPUT);
	digitalWrite(D7, HIGH);
}

And running particle identify shows that the SIMs have successfully switched. I also read

You must both call Cellular.setActiveSim(INTERNAL_SIM) and remove the external SIM card on the Boron LTE. Just deactiving the SIM in software won’t completely disable the external SIM and will cause connection failures.

This just applies to the Boron LTE, correct? Meaning I could switch between SIMs without taking the SIM out in the Boron 2g/3g without problems?

Thanks!

1 Like

I believe you should be able to switch between internal and external SIM on the Boron 2G/3G (but not Boron LTE) entirely in software.

The main thing is that you need to power down the modem completely when switching. You’ll probably want to use SYSTEM_MODE(SEMI_AUTOMATIC). After switching the active SIM and credentials, power down the modem using Cellular.off() for several seconds, then turn it back on.

1 Like

Thanks for the quick reply. When I turn on semi automatic mode, and call Cellular.on() after Cellular.off(), my Boron starts to breathe blue (not cyan). Is there something else I need to do?

You might need to call Particle.connect() as well.

1 Like

I’ve done both,

Cellular.setActiveSim(EXTERNAL_SIM);
Cellular.setCredentials("M2m005179.attz");
Cellular.off();
delay(5000);
Cellular.on();
Particle.connect();
waitUntil(Particle.connected);
Serial.println("Connected with External Sim");

The serial output never gets printed, and the device is breathing the listening mode blue colour

You may also need to add a Cellular.connect() before Particle.connect()
Breathing blue means “no network connection” but “cell module on”.

Usually Particle.connect() should do all the prerequisite steps, but that seems to be not the case with mesh devices as pointed out in this issue

Since there was no update/comment on that issue I’m not sure what Particle’s stand towards that currently is (other than the bug tag).