Switching between UDP and TCP for cloud protocol on electron

We were having problems with one of our electrons and switched from UDP to TCP using “particle keys protocol tcp”, and all was fine. Then after some other changes we want to switch back, but after executing “particle keys protocol udp” the electron will connect to the cellular network, flash cyan for a short period, and then orange flashes 3 times.

Any idea how to get the electron back to UDP mode?

Ping @BDub

I think it probably is back in UDP mode after running particle keys protocol udp, but you can verify by checking whether DFU address 2977 in alt 1 is set to 0xff (the default of UDP) or 0x00 (TCP) — or simply by running particle keys address looking for either “tcp://” or “udp://” at the beginning of the output.

Either way, the typical fix for this kind of error would be particle keys doctor — it usually gets everything in the right state again. :smile:

Hope that gets you connected again — let us know either way!

Thanks for that, sorry about the long delay, been getting ready for our first customer install and it was easier to just put that Electron aside and come back to it later.

particle keys doctor didn’t seem to make it work again. Next time I give it a go, I’ll check the DFU address and post the result of that.

OK, I’ve flashed our firmware with debugging enabled and have got the following log

6.381 AT send 12 "AT+USOCR=6\r\n"
6.392 AT read + 13 "\r\n+USOCR: 0\r\n"
6.402 AT read OK 6 "\r\nOK\r\n"
Socket 0: handle 0 was created
0000006403:DEBUG: int Internet_Test() (663):socketed testSocket=0
0000006403:DEBUG: int Internet_Test() (685):Connect Attempt
6.403 AT send 25 "AT+USOCO=0,“”,53\r\n"
6.543 AT read OK 6 "\r\nOK\r\n"
0000006544:DEBUG: int Internet_Test() (687):socket_connect()=success
0000006544:DEBUG: int Internet_Test() (696):Close
6.544 AT send 12 "AT+USOCL=0\r\n"
6.815 AT read OK 6 "\r\nOK\r\n"
0000009816:INFO : void establish_cloud_connection() (213):cloud: connecting
0000009816:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000009818:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_ServerAddress() = type:255,domain:,ip:, port: 0
0000009818:WARN : void establish_cloud_connection() (224):Cloud socket connection failed: -1
0000009820:ERROR: void handle_cfod() (171):Resetting CC3000 due to 2 failed connect attempts
0000009820:DEBUG: int Internet_Test() (661):Internet test socket
9.819 AT send 12 "AT+USOCR=6\r\n"
9.831 AT read + 13 "\r\n+USOCR: 0\r\n"
9.841 AT read OK 6 "\r\nOK\r\n"
Socket 0: handle 0 was created
0000009842:DEBUG: int Internet_Test() (663):socketed testSocket=0
0000009844:DEBUG: int Internet_Test() (685):Connect Attempt
9.843 AT send 25 "AT+USOCO=0,“”,53\r\n"
9.953 AT read OK 6 "\r\nOK\r\n"
0000009954:DEBUG: int Internet_Test() (687):socket_connect()=success
0000009954:DEBUG: int Internet_Test() (696):Close
9.955 AT send 12 "AT+USOCL=0\r\n"
10.225 AT read OK 6 "\r\nOK\r\n"
0000010226:WARN : void manage_network_connection() (99):!! Resetting WLAN due to SPARK_WLAN_RESET

running the keys doctor does nothing, however if I change back to TCP, it works straight away!

Going to try and work out how to read that memory address with dfu-util now.

Checked the DFU address, and it is indeed being changed correctly, so the question is have I stumbled upon a bug, or has my device got corrupted somehow. If the latter, are there instructions anywhere for completely reflashing the entire device back to how it comes of out the factory (I have a programming shield too).

Unfortunately because I don’t have cellular coverage at home, I have to do this sitting in a cafe in town, so my time to work on it is sporadic at best.

@BDub, does that fact that the IP address is 0, the port is 0, and there is no domain coming out the flash indicate that the problem lies there…If so, how would I fix it?