I am developing with OS 1.3.0-rc.1 and have the argon in SEMI_AUTOMATIC mode. To test the BLE UART communications I’ve setup some functions to be called when certain commands are received. The problem I am currently having is within the Particle.connect() or originates from here.
The order of events that works then fails are:
- Flash with CLI tinker
- Send wifi credentials over serial. Unit connects to the cloud.
- Flash my code on from the workbench.
- Send command to Particle.connect() with wifi credentials. Unit connects to the cloud
- Push the reset button on the Argon. Then send the connect command again. Unit connects to the cloud.
- Unplug the argon from the power supply (usb).
- Plug back in Argon and send the same connect command. This time the unit gets stuck. The last message I see print out on my serial is:
0000015402 [app] WARN: Network on
0000016410 [app] WARN: Setup started
0000017418 [app] WARN: Setup ended after 99 ms
0000017605 [net.ifapi] INFO: Netif wl3 link UP
0000017605 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000017756 [hal] INFO: DNS server list changed
0000017757 [hal] INFO: DNS server list changed
0000017759 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000017818 [system.nm] INFO: Checking gateway status with the device cloud
0000017820 [system] INFO: Cloud: connecting
0000017823 [system] INFO: Read Server Address = type:1,domain:$id.udp-mesh.particle.io
0000017824 [system] ERROR: Failed to load session data from persistent storage
0000017825 [system] INFO: Discarding session data
0000018161 [system] INFO: Cloud socket=0, connecting to 3.81.24.94#5684
0000018162 [system] INFO: Cloud socket connected
0000018163 [system] INFO: Starting handshake: presense_announce=0
0000018164 [comm.protocol.handshake] INFO: Establish secure connection
0000018428 [app] WARN: Network connecting
Local Time - 946663218
0000018462 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
When it connects successfully the restoreStatus=0
I’m not sure what the tinker app does each time it connects to either reset the session or…?
Here is my code that is called from the ble command:
Particle.publish("spark/device/session/end", "", PRIVATE);
Particle.disconnect();
delay(100);
//Connect to the network and then to the Particle cloud
WiFi.on();
WiFi.setCredentials("wifiNetowrkname", "BigPassword");
delay(100);
WiFi.connect(WIFI_CONNECT_SKIP_LISTEN);
delay(100);
WiFi.listen(false);
Serial.println(" ---------- **** no listen");
delay(100);
if(WiFi.ready()){
Particle.process();
Serial.println(" ---------- **** wifi.ready()");
}
Particle.connect();
Serial.println(" ---------- **** Particle connect()");
delay(1000);
if(Particle.connected()){
bleSerial.println("connected");
Particle.process();
}