Photon cannot establish secure connection to the cloud (cannot claim device)

I’m trying to reclaim my very old Photon. Because I need to change the wifi, figured factory reset is the easiest way to go.

First thing I did was reflashing the original firmware (from this github) top of google result.

particle flash --usb system-part1-0.4.9-photon.bin
particle flash --usb system-part2-0.4.9-photon.bin

Then I run particle update it bumps to 2.3.0. However, whatever I do, I can’t claim it with the app.

A lot of re-flashing, trying a bunch of things, I came across adding the wifi via serial. I can see it connected to on my router GUI. Then I came across the cloud-debug, when I saw the problem.

My very last attempt is this (I believe it started clean):

  1. reflash everything photon from github releases 2.3.0, including the bootloader, until tinker.
  2. particle serial wifi to setup the wifi
  3. particle keys server and particle keys doctor [id]
  4. flash with cloud-debug for photon.
  5. particle serial monitor result (with a bunch of values redacted)
Serial monitor opened successfully:
> 0000015205 [app] INFO: Starting Tests!
0000015205 [app] INFO: Platform: Photon
0000015205 [app] INFO: Binary compiled for: 2.1.0
0000015205 [app] INFO: Cloud Debug Release 2.1.4
0000015205 [app] INFO: System version: 2.3.0
0000015206 [app] INFO: Device ID: 290028[redacted]373739
0000015206 [app] INFO: No Ethernet (not Gen 3)
0000015216 [app] INFO: Antenna: internal
0000015223 [app] INFO: IP Address Configuration: dynamic
0000015230 [app] INFO: Configured credentials:
0000015245 [app] INFO:   ssid=Trident security=wpa2 cipher=AES
0000015245 [app] INFO: Available access points:
0000015354 [app] INFO:   ssid=[redacted] security=wpa2 channel=1 rssi=-80
0000015584 [app] INFO:   ssid=[redacted] security=wpa2 channel=6 rssi=-73
0000015803 [app] INFO:   ssid=[redacted] security=wpa2 channel=11 rssi=-36
0000015982 [app] INFO:   ssid=Trident security=wpa2 channel=6 rssi=-81
0000015982 [app] INFO:   ssid=Trident security=wpa2 channel=6 rssi=-66
0000015982 [app] INFO:   ssid=Trident security=wpa2 channel=6 rssi=-67
0000015982 [app] INFO: Connecting to Wi-Fi
0000019468 [app] INFO: Connected to Wi-Fi in 00:03
0000019470 [app] INFO: MAC address:[redacted]
0000019472 [app] INFO: localIP: [redacted]
0000019473 [app] INFO: subnetMask: 255.255.255.0
0000019475 [app] INFO: gatewayIP: 192.168.5.1
0000019477 [app] INFO: dnsServerIP: 192.168.5.1 (often 0.0.0.0)
0000019479 [app] INFO: dhcpServerIP: 192.168.5.1 (often 0.0.0.0)
0000019480 [app] INFO: BSSID: b4:0f:3b:11:a9:99
0000019496 [app] INFO: ping gateway=1
0000019502 [app] INFO: ping dnsServerIP=1
0000019533 [app] INFO: ping addr 8.8.8.8=1
0000020095 [app] INFO: device.spark.io=3.233.10.160
0000020095 [wiring] TRACE: TCPClient socket=2000a610
0000020381 [app] INFO: connected to device server CoAP (testing connection only)
0000020382 [app] INFO: Connecting to the Particle cloud...
0000020468 [system] INFO: Cloud: connecting
0000020780 [system] INFO: Cloud socket connected
0000020782 [comm.protocol.handshake] INFO: Establish secure connection
0000021484 [comm.protocol.handshake] ERROR: Handshake failed: 26
0000021602 [system] WARN: Internet available, cloud not reachable
0000021602 [system] WARN: Cloud handshake failed, code=-220
0000021853 [system] INFO: Cloud: disconnecting
0000021855 [system] INFO: Cloud: disconnected
0000022555 [system] INFO: Cloud: connecting
0000022890 [system] INFO: Cloud socket connected
0000022890 [comm.protocol.handshake] INFO: Establish secure connection
0000023772 [comm.protocol.handshake] ERROR: Handshake failed: 26
0000023799 [system] WARN: Internet available, cloud not reachable
0000023799 [system] WARN: Cloud handshake failed, code=-220
0000024049 [system] INFO: Cloud: disconnecting
0000024051 [system] INFO: Cloud: disconnected
0000024851 [system] INFO: Cloud: connecting
0000025185 [system] INFO: Cloud socket connected
0000025185 [comm.protocol.handshake] INFO: Establish secure connection
0000025905 [comm.protocol.handshake] ERROR: Handshake failed: 26
0000026101 [system] WARN: Internet available, cloud not reachable
0000026101 [system] WARN: Cloud handshake failed, code=-220
0000026351 [system] INFO: Cloud: disconnecting
0000026353 [system] INFO: Cloud: disconnected
0000026953 [system] INFO: Cloud: connecting
0000027268 [system] INFO: Cloud socket connected
0000027268 [comm.protocol.handshake] INFO: Establish secure connection
0000027971 [comm.protocol.handshake] ERROR: Handshake failed: 26
0000028043 [system] WARN: Internet available, cloud not reachable
0000028043 [system] WARN: Cloud handshake failed, code=-220

Where do I go from here?

Hey, I would try two things from your position:

1- use the restore tool to reflash your photon with tinker:

2- check that the wifi router does not transmit the same SSID in 2.4GHz and 5GHz. If it does, I would change the 2.4GHz SSID to something else, then would try claiming the device again.

Best

From the log:

0000015245 [app] INFO: ssid=Trident security=wpa2 cipher=AES
You have a what appears to be a valid Wi-Fi configuration

0000020095 [app] INFO: device.spark.io=3.233.10.160
You have working DNS. And that’s a valid server address.

0000020381 [app] INFO: connected to device server CoAP (testing connection only)
The Photon was able to make a TCP connection to 3.233.10.160. This is good.

0000021484 [comm.protocol.handshake] ERROR: Handshake failed: 26
0000021602 [system] WARN: Internet available, cloud not reachable
0000021602 [system] WARN: Cloud handshake failed, code=-220

The most common reason for this is a captive portal on your Wi-Fi that requires you agree to terms to use the Wi-Fi. The testing connection works because it’s actually for displaying the portal page, but the real connection will fail.

If that’s not the case:

  • Your local IP is 192.168.5.x, correct? Just making sure your subnet mask is properly matched.
  • It’s weird that the dnsServerIP and dhcpServerIP are displaying. That usually only happens if you have static IP addressing set. You don’t, because it says dynamic earlier in the log, but maybe the configuration is corrupted? Maybe try clearing credentials (hold down SETUP until LED blinks blue rapidly) and set them again using particle serial wifi.
  • You can get this behavior if there’s a custom device service set. You mentioned using particle keys server which will fix this, but maybe try again and copy and paste what it returned.
  • I suppose it could be some sort of firewall issue on your network.
1 Like

Your local IP is 192.168.5.x, correct?

Yes. localIP: 192.168.5.151

It’s weird that the dnsServerIP and dhcpServerIP are displaying. That usually only happens if you have static IP addressing set.

It is dynamic. I’m not sure what to say about the dns and dhcp server…

You can get this behavior if there’s a custom device service set. You mentioned using particle keys server which will fix this, but maybe try again and copy and paste what it returned.

$ particle usb dfu           
Done.
$ particle keys server
Okay!  New keys in place, your device will not restart.

This is super weird. Seems like I need to try different router? AFAIK, there’s nothing special configured on the router. I just choose trident because it’s the mesh network I’ll need to use where the Photon will finally stay for this project.