I’m having trouble getting a boron to connect to the cloud. Being at the development stage, there is a need to reprogram and try a code change. I’ve been using USB to do this, and when the new version starts, it needs to reconnect. Typically that gets into a scenario where the boron has multiple blinks of green, then a white blink, and back to the green blinking, and so on repeatedly. I don’t have hard evidence, but powering off, waiting some number of hours and retrying sometimes gets it back to working. I’ve seen a few isses in the community forum describing a similar LED pattern. Then I saw this in the documentation about Cellular:
You must not turn off and on cellular more than every 10 minutes (6 times per hour). Your SIM can be blocked by your mobile carrier for aggressive reconnection if you reconnect to cellular very frequently. If you are manually managing the cellular connection in case of connection failures, you should wait at least 5 minutes before stopping the connection attempt. When retrying on failure, you should implement a back-off scheme waiting 5 minutes, 10 minutes, 15 minutes, 20 minutes, 30 minutes, then 60 minutes between retries. Repeated failures to connect can also result in your SIM being blocked.
How is this done in software? My initial setup does Cellular.on(), Cellular.connect(), followed by Particle.connect() - with some Serial.printlnfs after each of these so I can watch progress. However, during the looping failure scenario described above, I see no Serial output, so it seems like the code does not have an opportunity to count / manage connection attempts.
Another thing I observe is that, if a connection is dropped after being established in the main loop, then setup() is again called - I can see this from the Serial output. What!? That can wipe out variables holding important data. So does that imply that variable initialization should be done outside of Setup()?
Note the console shows that the cellular connection is weak, like as low as 21% in some cases.