Photon setup flashing cyan with a "quick red burst" (now orange burst) [Solved]

One thing in your output of particle keys doctor strikes me.

This file already exists, please specify a different file, or use the --force flag.

Since I don’t know of a way to feed the --force flag through CLI to open-SSL you may need to locate the 230025000e47343337373737_rsa_new.der file and remove it in order to get a fresh, valid key created.

And particle keys server should usually be used without any extra parameter.

And just in case we are all going down the wrong track, could you post a video of what your RGB LED is doing?

thanks for responding, i have tried running the keys doctor with the --force flag, same result. I also tried deleting the .der file, no change in result. I tried particle keys server with no extra parameter, no change in result

Here is a video of what the device is doing : https://www.youtube.com/watch?v=BMP230N-cLU

I also contacted particle support, they had linked me to this debug firmware: https://github.com/rickkas7/photon-clouddebug

the result i got from that is as follows:

C:\Users\ioannidisa>particle serial monitor
Opening serial monitor for com port: "COM6"
Serial monitor opened successfully:
configured credentials:
ssid=ICTIOT security=wpa2 cipher=1
available access points:
SSID=TGS Guest Wireless security=unsecured channel=1 rssi=-78
SSID=TGSWN security=wpa2 channel=1 rssi=-77
SSID=ICTIOT security=wpa2 channel=6 rssi=-12
SSID=TGS Guest Wireless security=unsecured channel=11 rssi=-52
SSID=TGSWN security=wpa2 channel=11 rssi=-49
connecting to WiFi
0000007011:INFO : virtual void ManagedNetworkInterface::connect(bool) (282):ready():false,connecting():false,listening():false
connected to WiFi!
localIP=192.168.1.100
subnetMask=255.255.255.0
gatewayIP=192.168.1.1
dnsServerIP=0.0.0.0 (often 0.0.0.0)
dhcpServerIP=0.0.0.0 (often 0.0.0.0)
ping gateway=1
ping addr 8.8.8.8=0
failed to get device.spark.io from DNS, try 1
failed to get device.spark.io from DNS, try 2
failed to get device.spark.io from DNS, try 3
device.spark.io=0.0.0.0
connecting to cloud
0000029882:INFO : void establish_cloud_connection() (214):Cloud: connecting
0000029882:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000029883:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_ServerAddress() = type:255,domain:,ip: 0.0.0.0, port: 0
0000044886:ERROR: int determine_connection_address(IPAddress&, uint16_t&, ServerAddress&, bool) (800):Cloud: unable to resolve IP for device.spark.io
0000044886:DEBUG: int spark_cloud_socket_connect() (864):socketed udp=0, sparkSocket=536895952, 1
0000044887:DEBUG: int spark_cloud_socket_connect() (874):connection attempt to 54.208.229.4:5683
0000045218:INFO : int spark_cloud_socket_connect() (891):connected to cloud 54.208.229.4:5683
0000045219:INFO : void establish_cloud_connection() (221):Cloud socket connected
0000045219:DEBUG: int Spark_Handshake(bool) (546):starting handshake announce=1
0000045532:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (792):Socket 0 receive bytes 40 of 40
0000045578:DEBUG: sock_result_t socket_send(sock_handle_t, const void*, socklen_t) (1002):Write 256 bytes to socket 536895952 result=0
0000045850:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (778):Socket 0 receive fail 19
0000045851:DEBUG: sock_result_t socket_receive(sock_handle_t, void*, socklen_t, system_tick_t) (824):socket_receive on 536895952 returned -19
0000045852:ERROR: int SparkProtocol::handshake() (108):Handshake: Unable to receive key -19
0000045852:WARN : void handle_cloud_connection(bool) (268):Cloud handshake failed, code=-19
0000046102:INFO : void cloud_disconnect(bool) (427):Cloud: disconnecting
0000046102:DEBUG: int spark_cloud_socket_disconnect() (912):Close Attempt
0000046102:DEBUG: sock_result_t socket_close(sock_handle_t) (939):socket closed 200061d0
0000046103:DEBUG: int spark_cloud_socket_disconnect() (914):socket_close()=success
0000046103:INFO : void cloud_disconnect(bool) (440):Cloud: disconnected
0000046852:INFO : void establish_cloud_connection() (214):Cloud: connecting
0000046852:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000046852:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_ServerAddress() = type:255,domain:,ip: 0.0.0.0, port: 0
0000061856:ERROR: int determine_connection_address(IPAddress&, uint16_t&, ServerAddress&, bool) (800):Cloud: unable to resolve IP for device.spark.io
0000061856:DEBUG: int spark_cloud_socket_connect() (864):socketed udp=0, sparkSocket=536895952, 1
0000061856:DEBUG: int spark_cloud_socket_connect() (874):connection attempt to 54.208.229.4:5683
0000062171:INFO : int spark_cloud_socket_connect() (891):connected to cloud 54.208.229.4:5683
0000062172:INFO : void establish_cloud_connection() (221):Cloud socket connected
0000062172:DEBUG: int Spark_Handshake(bool) (546):starting handshake announce=1
0000062492:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (792):Socket 0 receive bytes 40 of 40
0000062538:DEBUG: sock_result_t socket_send(sock_handle_t, const void*, socklen_t) (1002):Write 256 bytes to socket 536895952 result=0
0000062815:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (778):Socket 0 receive fail 19
0000062815:DEBUG: sock_result_t socket_receive(sock_handle_t, void*, socklen_t, system_tick_t) (824):socket_receive on 536895952 returned -19
0000062816:ERROR: int SparkProtocol::handshake() (108):Handshake: Unable to receive key -19
0000062816:WARN : void handle_cloud_connection(bool) (268):Cloud handshake failed, code=-19
0000063066:INFO : void cloud_disconnect(bool) (427):Cloud: disconnecting
0000063066:DEBUG: int spark_cloud_socket_disconnect() (912):Close Attempt
0000063066:DEBUG: sock_result_t socket_close(sock_handle_t) (939):socket closed 200061d0
0000063067:DEBUG: int spark_cloud_socket_disconnect() (914):socket_close()=success
0000063067:INFO : void cloud_disconnect(bool) (440):Cloud: disconnected
0000063816:INFO : void establish_cloud_connection() (214):Cloud: connecting
0000063816:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000063816:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_ServerAddress() = type:255,domain:,ip: 0.0.0.0, port: 0
0000078820:ERROR: int determine_connection_address(IPAddress&, uint16_t&, ServerAddress&, bool) (800):Cloud: unable to resolve IP for device.spark.io
0000078820:DEBUG: int spark_cloud_socket_connect() (864):socketed udp=0, sparkSocket=536895952, 1
0000078820:DEBUG: int spark_cloud_socket_connect() (874):connection attempt to 54.208.229.4:5683
0000079149:INFO : int spark_cloud_socket_connect() (891):connected to cloud 54.208.229.4:5683
0000079149:INFO : void establish_cloud_connection() (221):Cloud socket connected
0000079149:DEBUG: int Spark_Handshake(bool) (546):starting handshake announce=1
0000079453:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (792):Socket 0 receive bytes 40 of 40
0000079499:DEBUG: sock_result_t socket_send(sock_handle_t, const void*, socklen_t) (1002):Write 256 bytes to socket 536895952 result=0
0000079773:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (778):Socket 0 receive fail 19
0000079773:DEBUG: sock_result_t socket_receive(sock_handle_t, void*, socklen_t, system_tick_t) (824):socket_receive on 536895952 returned -19
0000079774:ERROR: int SparkProtocol::handshake() (108):Handshake: Unable to receive key -19
0000079774:WARN : void handle_cloud_connection(bool) (268):Cloud handshake failed, code=-19
0000080024:INFO : void cloud_disconnect(bool) (427):Cloud: disconnecting
0000080024:DEBUG: int spark_cloud_socket_disconnect() (912):Close Attempt
0000080024:DEBUG: sock_result_t socket_close(sock_handle_t) (939):socket closed 200061d0
0000080024:DEBUG: int spark_cloud_socket_disconnect() (914):socket_close()=success
0000080025:INFO : void cloud_disconnect(bool) (440):Cloud: disconnected
0000080774:INFO : void establish_cloud_connection() (214):Cloud: connecting
0000080774:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000080774:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_ServerAddress() = type:255,domain:,ip: 0.0.0.0, port: 0
0000095778:ERROR: int determine_connection_address(IPAddress&, uint16_t&, ServerAddress&, bool) (800):Cloud: unable to resolve IP for device.spark.io
0000095778:DEBUG: int spark_cloud_socket_connect() (864):socketed udp=0, sparkSocket=536895952, 1
0000095778:DEBUG: int spark_cloud_socket_connect() (874):connection attempt to 54.208.229.4:5683

The output continues to repeat itself at the end.

As it seems the DNS is failing.
Check the DNS addresses on your router.

I tried resetting the router to factory settings, as well as using other wireless networks such as a phones hotspot as well as an enterprise network …

Could it be that the device was ever set to WiFi.useStaticIP()?
This setting sticks and using other networks won’t be able to change anything for that.

That would be very unlikely as we have this same problem with our classroom set of about 16 photon boards and we havnt used the WiFi api. If this is the case that however, how would we go about reverting it?

When you mention class room, could it be that your network is using a captive portal?

What were the outputs when using other networks?
Can you clear the credentials of one board, only set the ones for your phone hotspot and post the output of that?

1 Like

@ScruffR

If one were to be brave (read: foolish) enough to put a few boards into this error cycle with a static ip, do you have any insight as to what a fix could be?

I’ve gone through almost all of the steps listed above, but am certain it’s from trying to set an ip. I can ping my board at the previously set static ip, but it seems to not be running any of the firmware on it. I’ve even tried stripping it back to nothing a serial print and delay in the draw loop to no avail.

Any help would be much appreciated!

You could flash this

SYSTEM_MODE(SEMI_AUTOMATIC)
STARTUP(WiFi.selectAntenna(ANT_INTERNAL))
void setup() {
  WiFi.on();
  WiFi.useDynamicIP();
  Particle.process();
  delay(500);
  Particle.process();
  WiFi.off();
  delay(5000);
  Particle.connect();
}

So that was awesome, and totally brought the two devices back online. Just for the sake of curiosity, why do you disable the wifi with WiFi.off() before connecting?

And to continue this discussion about setting a static IP the right way, I’ll start a new thread?

Just to make sure the altered settings will be loaded next time when the module gets switched on (which implicitly happens with Particle.connect()) just like a reboot after a Windows update :wink:

@ScruffR Potentially have the same problem but trying to diagnose it remotely. I have 4 photons in a school environment with 3 of the 4 behaving fine and 1 now completely not wanting to cloud connect. It will connect to the wifi and there is a strong signal. Another device (which is online) is very close by and gets -50dB RSSI. Sounds like I will need to get the photon back to base or make a visit to site with a laptop and USB lead if it is the same staticIP issue. Is there anyway to remotely diagnose if this is the case or to get the photon out of staticIP without loading the sketch above?

I have spotted another issue or potential issue. There are several WAPs (8) all with the same name and using different channels . I have noticed that the signal strengths vary considerably over time. The stored credentials show the correct WAP, however, the channel value is 0? Is this equivalent to “Automatically Select Channel” or a sign of an issue?

If the device can't connect to the network (for whatever reason), there is no way to do anything remotely :wink:
If it can connect to WiFi but not to the cloud, it's obviously not an issue with static IP - otherwise you wouldn't successfully connect to WiFi.

When you say, you've got the same problem, which one do you refer to - this thread has touched on several and the topic title is the prime focus of this thread and to cure it you'd need to use CLI to restore the keys (or update to 0.7.0-rc.1 which has a "self-cure" feature added for testing).

Having multiple APs with the same creds will render non-deterministic results, which AP the device will pick. But generally the device will not switch AP/channel as long the connection "works" even if there was a better AP to pick.

@ScruffR

This problem

As it seems the DNS is failing.
Check the DNS addresses on your router.

This device is just not cloud connecting. I thought the issue was it is trying and failing to get to DNS for device.spark.io and this was caused by it being set in static IP mode. Perhaps I have misunderstood this solution to DNS failing.

This site definitely demonstrates "non-deterministic results" behaviour with the 4 devices!

I will check out 0.7.1-rc.1 as the "self-cure" feature sounds useful but will need to wait until GA before I can deploy it.

Hi! I have this problem and I googled it . At the moment I am not very experienced as I have only had my photon for 2 days. Could you please explain how you execute these commands? is it in Windows command prompt or something of the sort? I cant access it via the internet as it fails to connect. Please could you clarify you post ! Thank You
Ed

where do you put it? @kennethlimcp

Put what to where?

The ‘key doctor’ commands should be used with the CLI which runs in the command prompt. The docs should tell you’re about this :slight_smile:

Hi

I am still having trouble with my photon, I think I got it right, but then I get an error nobody else gets :frowning:

! Please login - it appears your access token may have expired

The hole Terminal output: (the error in the bottom)
Also, it gives an error earlier, but then says ok and saves.

SebMBPro:~ sebastianhorup$ particle keys server /Users/sebastianhorup/Downloads/cloud_public.der 
Found DFU device 2b04:d006
spawning dfu-util -d 2b04:d006 -a 1 -i 0 -s 2082 -D /Users/sebastianhorup/Downloads/cloud_public-padded.der
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "DCT Flash   "
Downloading to address = 0x00000822, size = 512
Download	[=========================] 100%          512 bytes
Download done.
File downloaded successfully
Okay!  New keys in place, your device will not restart.
SebMBPro:~ sebastianhorup$ particle keys new photon
Found DFU device 2b04:d006
New Key Created!
SebMBPro:~ sebastianhorup$ particle keys load /Users/sebastianhorup/photon.der 
Found DFU device 2b04:d006
Found DFU device 2b04:d006
Unable to generate public key from the key downloaded from the device. This usually means you had a corrupt key on the device. Error:  { Error: Command failed: openssl rsa -in /Users/sebastianhorup/backup_rsa_photon.der -inform DER -pubout -out /Users/sebastianhorup/backup_rsa_photon.pub.pem
unable to load Private Key
63387:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/asn1/tasn_dec.c:1344:
63387:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/asn1/tasn_dec.c:848:
63387:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/asn1/tasn_dec.c:768:Field=version, Type=RSA
63387:error:0D09A00D:asn1 encoding routines:d2i_PrivateKey:ASN1 lib:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/asn1/d2i_pr.c:99:

at ChildProcess.exithandler (child_process.js:270:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'openssl rsa -in /Users/sebastianhorup/backup_rsa_photon.der -inform DER -pubout -out /Users/sebastianhorup/backup_rsa_photon.pub.pem' }
Saved!
spawning dfu-util -d 2b04:d006 -a 1 -i 0 -s 34 -D /Users/sebastianhorup/photon.der
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "DCT Flash   "
Downloading to address = 0x00000022, size = 608
Download	[=========================] 100%          608 bytes
Download done.
File downloaded successfully
Saved!
SebMBPro:~ sebastianhorup$ particle keys send 12341234123412341234 /Users/sebastianhorup/photon.pub.pem 
attempting to add a new public key for device 12341234123412341234

! Please login - it appears your access token may have expired

Error sending public key to server: Invalid token
SebMBPro:~ sebastianhorup$

It's a pretty obvious one though... try logging in again?