P1 is not able to connect to WiFi - Unable to receive key -19


#1

Hello,

In short it’s failing to connect to WiFi. I tried setting it in safe mode but the problem still persists. I am not sure what happened all of a sudden. It was working fine before. I flashed the same firmware on a different device and it works fine. My P1 is reporting the following log on the console when it boots up.

Any ideas to debug this?

0000021119 [system] INFO: Starting handshake: presense_announce=1
0000021121 [comm.sparkprotocol.handshake] INFO: Started: Receive nonce
0000021208 [comm.sparkprotocol.handshake] INFO: Encrypting handshake nonce
0000021280 [comm.sparkprotocol.handshake] INFO: Sending encrypted nonce
0000021283 [comm.sparkprotocol.handshake] INFO: Receive key
0000021386 [comm.sparkprotocol.handshake] ERROR: Unable to receive key -19
0000021386 [system] WARN: Cloud handshake failed, code=-19
0000021636 [system] INFO: Cloud: disconnecting
0000021637 [system] INFO: Cloud: disconnected
0000023437 [system] INFO: Cloud: connecting
0000023437 [system] WARN: Read Server Address = type:255,defaulting to device.spark.io
0000023451 [system] INFO: Resolved host device.spark.io to 107.22.156.56
0000023536 [system] INFO: connected to cloud 107.22.156.56:5683
0000023536 [system] INFO: Cloud socket connected
0000023536 [system] INFO: Starting handshake: presense_announce=1
0000023538 [comm.sparkprotocol.handshake] INFO: Started: Receive nonce
0000023623 [comm.sparkprotocol.handshake] INFO: Encrypting handshake nonce
0000023695 [comm.sparkprotocol.handshake] INFO: Sending encrypted nonce
0000023698 [comm.sparkprotocol.handshake] INFO: Receive key
0000023783 [comm.sparkprotocol.handshake] ERROR: Unable to receive key -19
0000023783 [system] WARN: Cloud handshake failed, code=-19
0000024034 [system] INFO: Cloud: disconnecting
0000024035 [system] INFO: Cloud: disconnected
0000025835 [system] INFO: Cloud: connecting
0000025835 [system] WARN: Read Server Address = type:255,defaulting to device.spark.io
0000025848 [system] INFO: Resolved host device.spark.io to 107.22.156.56
0000025937 [system] INFO: connected to cloud 107.22.156.56:5683
0000025939 [system] INFO: Cloud socket connected
0000025939 [system] INFO: Starting handshake: presense_announce=1
0000025939 [comm.sparkprotocol.handshake] INFO: Started: Receive nonce
0000026028 [comm.sparkprotocol.handshake] INFO: Encrypting handshake nonce
0000026102 [comm.sparkprotocol.handshake] INFO: Sending encrypted nonce
0000026104 [comm.sparkprotocol.handshake] INFO: Receive key
0000026220 [comm.sparkprotocol.handshake] ERROR: Unable to receive key -19
0000026220 [system] WARN: Cloud handshake failed, code=-19
0000026471 [system] INFO: Cloud: disconnecting
0000026472 [system] INFO: Cloud: disconnected
0000028272 [system] INFO: Cloud: connecting
0000028272 [system] WARN: Read Server Address = type:255,defaulting to device.spark.io
0000028279 [system] INFO: Resolved host device.spark.io to 107.22.156.56
0000028364 [system] INFO: connected to cloud 107.22.156.56:5683
0000028364 [system] INFO: Cloud socket connected
0000028364 [system] INFO: Starting handshake: presense_announce=1
0000028366 [comm.sparkprotocol.handshake] INFO: Started: Receive nonce
0000028449 [comm.sparkprotocol.handshake] INFO: Encrypting handshake nonce
0000028521 [comm.sparkprotocol.handshake] INFO: Sending encrypted nonce
0000028524 [comm.sparkprotocol.handshake] INFO: Receive key
0000028608 [comm.sparkprotocol.handshake] ERROR: Unable to receive key -19
0000028608 [system] WARN: Cloud handshake failed, code=-19
0000028858 [system] INFO: Cloud: disconnecting
0000028859 [system] INFO: Cloud: disconnected
0000030702 [system] INFO: Cloud: connecting
0000030702 [system] WARN: Read Server Address = type:255,defaulting to device.spark.io
0000030712 [system] INFO: Resolved host device.spark.io to 107.22.156.56
0000030801 [system] INFO: connected to cloud 107.22.156.56:5683
0000030801 [system] INFO: Cloud socket connected
0000030801 [system] INFO: Starting handshake: presense_announce=1
0000030803 [comm.sparkprotocol.handshake] INFO: Started: Receive nonce
0000030902 [comm.sparkprotocol.handshake] INFO: Encrypting handshake nonce
0000030974 [comm.sparkprotocol.handshake] INFO: Sending encrypted nonce
0000030977 [comm.sparkprotocol.handshake] INFO: Receive key

Thanks
Dheeraj


#2

is the P1 blinking cyan or green?


#3

Hi @dheerajdake,

So, if there was some issue that caused the local private key / flash to be corrupted, by say, a power issue, you might see this. I think we talked about it here:

Please make sure your power supply is operating as required, then:

You can generate a new key for the p1:

particle keys new --protocol rsa

You can then use your JTAG pins to copy the device.der key to address 34.

Make sure you send the key to the cloud to unlock the pinned key with:

particle keys send YOUR_DEVICE_ID device.pub.pem

There are some docs around this here: https://docs.particle.io/support/troubleshooting/key-management/photon/

Feel free to send me your external IP address, and your device_id, and I can check the logs as well to see if there is any other information there.

edit: it’s also possible the server key became corrupted somehow, so replacing that would also be a good thing to test.

Thanks,
David


Unable to handshake with cloud
#4

Hello @Dave,
I would be glad if all these problems are linked. I am interested in looking at the logs. I can send you the external IP address. Can you tell me you email id?

Thanks
Dheeraj


#5

Blinking green


#6

Hi @dheerajdake,

You can just private-message me on the forums if you like, your device-id isn’t particularly sensitive information.

edit: it looks like he was able to fix the key issue.

Thanks,
David