I’ve been troubleshooting connection problems for a few hours on a Boron and though it may help others if I take some notes here of what I’ve been finding. Well, in truth, I’m posting this so I can find it again in a few months when I have forgotten it
The notes below pertain to an app that uses SYSTEM_MODE(SEMI_AUTOMATIC)
if you’re not using that: ignore.
Everything here was tested using a custom instrumented build of DeviceOS 1.3.0_alpha.1. If you’re using a different version of DeviceOS, expect something different!
Also, this is about a Boron that is supposed to be a gateway. Some of it probably applies to an Argon configured as a gateway as well. Some of it probably also applies to a pure mesh node. YMWV!
- if
Cellular.connect()
is called to bring up the cell connection and laterParticle.connect()
is called, the mesh is never enabled. That’s becauseCellular.connect
starts up networking but only enables the cell interface. Later,Particle.connect
sees that networking is enabled and doesn’t bother to enable other interfaces. So, if you callXXX.connect()
for some network, you have to call it also for the other networks you want enabled, don’t rely onParticle.connect
. However, if you just callParticle.connect
off the bat then all interfaces are enabled. That’s probably good in a way, but confusing/inconsistent. -
Mesh.connect()
activates the Mesh connection ifParticle.connect()
didn’t -
Mesh.on()
is a no-op. If you callMesh.off()
to save power, don’t callMesh.on()
to re-enable it. CallMesh.connect()
instead. Obvious, right? - The border router functionality is not enabled until the cloud can be contacted to query for permission, this happens in the NetworkManager. So if your GW comes up and can’t talk to particle’s servers but can connect to the internet it will not turn on the gateway feature, hence other mesh nodes won’t be able to connect to internet servers. If you don’t like that you probably could set
br_permitted
toBorderRouterPermission::YES
at line 124 ofsystem/src/system_network_manager.cpp
- Do not base decisions on
XX.connecting()
because that returns true if any interface is connecting or up. For example, after callingMesh.connect()
you will seeCellular.connecting()
returning true. I had code like
if (!Mesh.connecting()) Mesh.connect()
if (!Cellular.connecting()) Cellular.connect()
and one of these connect calls never happened due to this “feature”. - If you don’t call
Particle.connect()
your boron (or argon?) will not act as a border router (gateway). This means that connected mesh devices cannot talk to other servers on the Internet (or to Particle).
May your connections work!