It depends. If you have previously run your firmware that sets the APN and then enter safe mode, the APN will still be set. The setting will survive the reset button, firmware updates, System.reset and entering safe mode by buttons.
If you unplug all power and cold boot the Electron and enter safe mode, it will not have your APN setting and will likely fail.
Okay, so are you saying that the APN credentials get stored on the uBlox modem?
If so, what effect does cycling power on the Electron have on the APN from the modem's perspective?
Does Particle get the uBlox modem shipped with a list of factory-programmed APN combos in memory that match Particle MVNO credentials?
Surely the default Particle APN gets set at some point... so if not in the Particle firmware, then where?
I feel like this is a hard question to word... so let me expand further...
When using a 3rd party SIM card, the process is to use the STARTUP( ) macro to make sure that cellular_credentials_set() gets called before setup() runs.
When using a Particle SIM card, presumably the Particle firmware calls cellular_credentials_set() before setup() runs, correct?
If this is the case, then why doesn't the APN revert back to Particle credentials when safe mode is entered?
How do you cold boot an Electron directly into safe mode before the STARTUP( set_cellular_credentials() ) code fires?
Yes, but only in RAM, so it will be gone from the modem after a power cycle too.
AFAIK it's only one internationally valid APN and it's hardcoded in the firmware on the Electron, not in the modem.[quote="jaza_tom, post:3, topic:30798"]
so if not in the Particle firmware, then where?
[/quote]
Who said, not in firmware?
Because that happens at a time even prior STARTUP() would be run, but isn't run on a reset, but only on cold boot (different code paths in bootloader).
Hold SETUP/MODE and apply power, then let go as soon you see magenta
And your STARTUP() never fires when entering Safe Mode.
@ScruffR – is the best way to permanently change the APN information on the electron to change the default values here and then locally compile the electron’s firmware using these instructions?
I’ve done this, but I’d like to know if I missed any other places where the electron’s firmware sets the APN details to default sim. Is there anything else to change you know of?
Nope, that should be the only place, but why would you go these lengths?
What’s wrong with the standard way?
Will you always want to stick with this system version or have to repeat these changes each time a new system version gets released?
One thing to conside might be to propose to Particle to supply us with a Cellular.setCredentials() function that works similar to the WiFi version to store sticky credentials.
First, we plan to use another MVNO’s sim card because it is considerably less expensive than Particle’s offerings. Our largest cost for our product is cell data over the years the product is in the field, so we are optimizing on cost. The MVNO we are testing with has pricing that for its most expensive tier that is less than Particle’s lowest pricing tier.
Second, it seem irresponsible to have a device in the field that cannot be recovered. One primary method of recovery in this ecosystem is safe mode. So if I use a sim card that does not allow us the use of safe mode, that prevents us from using one of the primary methods of recovery.
I’m all for sticky credentials, but I think even if I had that option I would still edit the firmware to set the default option to be our MVNO’s credentials. That way I know that under all conditions the device will be prepared to connect back to the cell network that matches its SIM.
I see, but actually since the APN is written to the cellular modem which does not get reset when the controller gets reset, you will still be able to put the device in Safe Mode and use your APN as is now.
I’m not sure I follow. Here is a test I devised to see if changing default APN in the firmware was going to actually work as I imagine:
Electron has default 0.6.1 firmware, a third party sim and I run application code that sets the APN correctly for third party sim.
First, run my application code then put in safe mode. Does it connect to Particle cloud? YES, this works every time.
Second, power cycle the electron and put directly into safe mode. Does it connect to Particle cloud? NO, the device bypasses my APN settings and goes directly to Particle’s sim.
Then, if I recompile Particle firmware with default APN set to my APN, I can run both of the above tests and have the device connect to Particle cloud. This change basically solves the second scenario.
I know that in theory the second scenario should not happen, but I have 150 electrons in the field and this has happened to me three times in the last two months. Each time this happens, it requires someone to go out to the device and manually reset it. I also know that my devices should not be cycling into safe mode, but thats a different problem…
As long as your code can make it to the STARTUP() makro which transfers the APN setting to the Cellular module after a powercycle, the modem will keep this setting even if you reset the device.
Hence your second case can always be substituted by the first one by powering the device (without SETUP/MODE) pressed and then activating Safe Mode via RESET.
That will be consistent behaviour. Just document entering Safe Mode via RESET/MODE and don't even mention the alternative power/MODE way (as isn't in the Particle docs either).