I could not find anything about this in the docs or the forum:
When a cellular device turns on for the first time, and does not get online in e.g. 3-5 minutes, how can the reason be detected (to indicate it to the user)?
Is there a retry strategy maybe with cellular back-off already built in with Cellular.connect()?
It will retry continuously until you stop it. Every 10 minutes the modem will be power cycled to see if that helps.
There isn’t much propagated up that the user can see, other than being able to tell if the problem is connecting to cellular (blinking green), where Cellular.ready() is false. Or failure to connect to the cloud (blinking cyan) where Cellular.ready() is true and Particle.connected() is false.
There are a number of reasons you could be stuck in blinking green, but Device OS can’t always tell the reason, and even when it can, it’s currently not available to user firmware. It’s not a bad idea for a feature request.
AT+CREG can’t be used on Gen 3 devices including the B523. The reason is that AT+CREG returns a URC (unsolicited result code) and on Gen 3 devices, URCs are not returned on the callback to Celluar.command so the cellular helper function won’t work.
However, the results from the AT+CREG URC are stored in device diagnostics, so you don’t need to issue that command. The only caveat is that I’m not sure when the data is saved, so it may or may not be helpful for what you are looking to do. But it’s worth a try to see.
Here’s how to read the cellular global identity, which is the information from AT+CREG:
You’re right, the CREG response is only saved in internal structures, not the diagnostics.
Yes, the user firmware can install a log handler that monitors the system output. I would have recommended that, except I’m not sure that non-debug Device OS builds will have the output you need. If you are seeing the result in your USB serial log, then yes you can intercept it.
The other method I would probably lean toward is having two modes: normal connecting and troubleshooting. If normal connecting mode fails, then your firmware goes into troubleshooting mode where it can take over the modem and do things like tower scans and other intrusive debugging activities. This makes more sense if you have some sort of display to show the results, which is why this sort of thing is not built-in.
Good point. I plan to indicate “denied” and “no coverage” via LED. Also plan to have an offline device log in FRAM. From experience a single carrier per country is a significant problem for installers in the field.