Minimum requirements to use electron-cloud-manipulator?

We are looking at an edge case in our firmware that is somewhat like this one and are hoping to use the electron-cloud-manipulator project as @rickkas7 suggested in that (and this) thread to diagnose, but are stymied at the point where the Electron is supposed to connect to the electron-cloud-manipulator. @ahigginscassidy has followed the readme to get started and verified that the electron-cloud-manipulator’s UDP ports are open, yet the Electron itself never connects. Has anyone had success getting electron-cloud-manipulator to work with their Electrons? Note this is hosted on a Debian 9 “Stretch” cloud VM with 2 cores and 8Gb of memory (should be overkill for what is needed).

The resource requirements are minimal. I think I’ve run it on a 512K Linux VM.

You set the server using the command:

particle keys server --protocol udp --host 65.19.178.42 --port 5684 ec.pub.der

Replace 65.19.178.42 with your server IP of course.

To make sure the Electron is connecting to the right host and port, run cloud debug on the Electron before you switch back to your firmware:

2 Likes

Interesting regarding electron-clouddebug… OK we’ll look at that, thank you!

Hey Rickkas,

We’ve installed the ec.pub.der key, our FW version is 0.5.3 it looks like the electron-clouddebug isn’t compatible.
Does this mean the electron-cloud-manipulator is also not compatible?

I’m seeing the electron get a cell connection, but start flashing green, red, and cyan when connecting to the cloud.
I’ve seen a simple port test trigger a reaction in the cloud manipulator, but the electron always fails to authenticate with the cloud after installing ec.pub.der on it.

The cloud manipulator should work with 0.5.3, but I’ve never tested it.

There’s a 0.5.3 version of the electron-cloud-debug here:

Download the binary zip file, extract it, and follow the instructions in the readme.md for flashing the combined-electron.bin, which must be done with dfu-util.

I’m looking at the logs. It looks like the handshake keeps failing with the cloud manipulator.
I can now see the cloud sending bytes down (> 107) but the electron never gets past blinking Cyan (occasionally it blinks red and green when encountering an error).

Any pointers?

0000454582:INFO : void cloud_disconnect(bool) (440):Cloud: disconnected
0000486060:INFO : void establish_cloud_connection() (214):Cloud: connecting
0000486060:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000486060:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_Server,ip: 13.90.225.26, port: 5684
socketSocket(UDP)
   486.061 AT send      18 "AT+USOCR=17,5684\r\n"
   486.661 AT read  +   13 "\r\n+USOCR: 0\r\n"
   486.671 AT read OK    6 "\r\nOK\r\n"
Socket 0: handle 0 was created
0000486671:DEBUG: int spark_cloud_socket_connect() (864):socketed udp=1, sparkSocket=0, 1
0000486671:DEBUG: int spark_cloud_socket_connect() (874):connection attempt to 13.90.225.26:5684
0000486672:INFO : void establish_cloud_connection() (221):Cloud socket connected
0000486672:DEBUG: int Spark_Handshake(bool) (546):starting handshake announce=0
0000486674:DEBUG: int Spark_Send_UDP(const unsigned char*, uint32_t, void*) (267):send 107
socketSendTo(0,13.90.225.26,5684,,107)
   486.675 AT send      36 "AT+USOST=0,\"13.90.225.26\",5684,107\r\n"
   486.686 AT read  >    3 "\r\n@"
   486.736 AT send     107 "\x16\xfe\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00^\x01\x00\x00R\x00\x00\x00\x00\x00\x00\x00R\xfe\xfd\xeb\x00\xbfu\x9ey\xfe\x9d=X\xd0'\x8c\x15\xbc\x1d{\x18\xb4\xabFX\x10\xf1\"\x1e\x84\a\x9d~e\r\x00\x00\x00\x04\xc0\xae\x00\xff\x01\x00\x00$\x00\r\x00\x06\x00\x04\x04\x03\x03\x03\x00\n\x00\x04\x00\x02\x00\x17\x00\v\x00\x02\x01\x00\x00\x13\x00\x02\x01\x02\x00\x14\x00\x02\x01\x02"
   486.878 AT read  +   17 "\r\n+USOST: 0,107\r\n"
   486.888 AT read OK    6 "\r\nOK\r\n"
0000489678:DEBUG: int Spark_Send_UDP(const unsigned char*, uint32_t, void*) (267):send 107
socketSendTo(0,13.90.225.26,5684,,107)
   489.679 AT send      36 "AT+USOST=0,\"13.90.225.26\",5684,107\r\n"
   489.689 AT read  >    3 "\r\n@"
   489.739 AT send     107 "\x16\xfe\xfd\x00\x00\x00\x00\x00\x00\x00\x01\x00^\x01\x00\x00R\x00\x00\x00\x00\x00\x00\x00R\xfe\xfd\xeb\x00\xbfu\x9ey\xfe\x9d=X\xd0'\x8c\x15\xbc\x1d{\x18\xb4\xabFX\x10\xf1\"\x1e\x84\a\x9d~e\r\x00\x00\x00\x04\xc0\xae\x00\xff\x01\x00\x00$\x00\r\x00\x06\x00\x04\x04\x03\x03\x03\x00\n\x00\x04\x00\x02\x00\x17\x00\v\x00\x02\x01\x00\x00\x13\x00\x02\x01\x02\x00\x14\x00\x02\x01\x02"
   489.882 AT read  +   17 "\r\n+USOST: 0,107\r\n"
   489.892 AT read OK    6 "\r\nOK\r\n"
lib/mbedtls/library/ssl_tls.c:2334: handshake timeout
lib/mbedtls/library/ssl_tls.c:3939: mbedtls_ssl_fetch_input() returned -26624 (-0x6800)
lib/mbedtls/library/ssl_cli.c:1526: mbedtls_ssl_read_record() returned -26624 (-0x6800)
0000495893:DEBUG: virtual particle::protocol::ProtocolError particle::protocol::DTLSMessageChannel::establish() (386):handshake failed -6800
0000495894:WARN : int particle::protocol::Protocol::begin() (218):handshake failed with code 2
0000495894:WARN : void handle_cloud_connection(bool) (268):Cloud handshake failed, code=2
0000496144:INFO : void cloud_disconnect(bool) (427):Cloud: disconnecting
0000496144:DEBUG: int spark_cloud_socket_disconnect() (912):Close Attempt
socketClose(0)
   496.144 AT send      12 "AT+USOCL=0\r\n"
   496.415 AT read OK    6 "\r\nOK\r\n"
socketFree(0)
0000496415:DEBUG: int spark_cloud_socket_disconnect() (914):socket_close()=success
0000496415:INFO : void cloud_disconnect(bool) (440):Cloud: disconnected
0000527894:INFO : void establish_cloud_connection() (214):Cloud: connecting
0000527894:DEBUG: int spark_cloud_socket_connect() (834):sparkSocket Now =-1
0000527894:DEBUG: int spark_cloud_socket_connect() (853):HAL_FLASH_Read_Server,ip: 13.90.225.26, port: 5684
socketSocket(UDP)
   527.895 AT send      18 "AT+USOCR=17,5684\r\n"
   528.826 AT read  +   13 "\r\n+USOCR: 0\r\n"
   528.836 AT read OK    6 "\r\nOK\r\n"
Socket 0: handle 0 was created
0000528836:DEBUG: int spark_cloud_socket_connect() (864):socketed udp=1, sparkSocket=0, 1
0000528837:DEBUG: int spark_cloud_socket_connect() (874):connection attempt to 13.90.225.26:5684
0000528837:INFO : void establish_cloud_connection() (221):Cloud socket connected
0000528837:DEBUG: int Spark_Handshake(bool) (546):starting handshake announce=0
0000528840:DEBUG: int Spark_Send_UDP(const unsigned char*, uint32_t, void*) (267):send 107
socketSendTo(0,13.90.225.26,5684,,107)
   528.840 AT send      36 "AT+USOST=0,\"13.90.225.26\",5684,107\r\n"
   528.851 AT read  >    3 "\r\n@"
   528.901 AT send     107 "\x16\xfe\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00^\x01\x00\x00R\x00\x00\x00\x00\x00\x00\x00R\xfe\xfdi\xab\x97\x10`<\x1bx\xd3\xac\x902Qgv\xce\xe0*R\x89\x91\xd2\xc4\xe3*\v\x92\xe5\xa7EUX\x00\x00\x00\x04\xc0\xae\x00\xff\x01\x00\x00$\x00\r\x00\x06\x00\x04\x04\x03\x03\x03\x00\n\x00\x04\x00\x02\x00\x17\x00\v\x00\x02\x01\x00\x00\x13\x00\x02\x01\x02\x00\x14\x00\x02\x01\x02"
   529.043 AT read  +   17 "\r\n+USOST: 0,107\r\n"
   529.053 AT read OK    6 "\r\nOK\r\n"
0000531843:DEBUG: int Spark_Send_UDP(const unsigned char*, uint32_t, void*) (267):send 107
socketSendTo(0,13.90.225.26,5684,,107)
   531.843 AT send      36 "AT+USOST=0,\"13.90.225.26\",5684,107\r\n"
   531.854 AT read  >    3 "\r\n@"
   531.904 AT send     107 "\x16\xfe\xfd\x00\x00\x00\x00\x00\x00\x00\x01\x00^\x01\x00\x00R\x00\x00\x00\x00\x00\x00\x00R\xfe\xfdi\xab\x97\x10`<\x1bx\xd3\xac\x902Qgv\xce\xe0*R\x89\x91\xd2\xc4\xe3*\v\x92\xe5\xa7EUX\x00\x00\x00\x04\xc0\xae\x00\xff\x01\x00\x00$\x00\r\x00\x06\x00\x04\x04\x03\x03\x03\x00\n\x00\x04\x00\x02\x00\x17\x00\v\x00\x02\x01\x00\x00\x13\x00\x02\x01\x02\x00\x14\x00\x02\x01\x02"
   532.046 AT read  +   17 "\r\n+USOST: 0,107\r\n"
   532.056 AT read OK    6 "\r\nOK\r\n"
lib/mbedtls/library/ssl_tls.c:2334: handshake timeout
lib/mbedtls/library/ssl_tls.c:3939: mbedtls_ssl_fetch_input() returned -26624 (-0x6800)
lib/mbedtls/library/ssl_cli.c:1526: mbedtls_ssl_read_record() returned -26624 (-0x6800)
0000538057:DEBUG: virtual particle::protocol::ProtocolError particle::protocol::DTLSMessageChannel::establish() (386):handshake failed -6800
0000538058:WARN : int particle::protocol::Protocol::begin() (218):handshake failed with code 2
0000538058:WARN : void handle_cloud_connection(bool) (268):Cloud handshake failed, code=2
0000538309:INFO : void cloud_disconnect(bool) (427):Cloud: disconnecting
0000538309:DEBUG: int spark_cloud_socket_disconnect() (912):Close Attempt
socketClose(0)
   538.309 AT send      12 "AT+USOCL=0\r\n"
   538.580 AT read OK    6 "\r\nOK\r\n"
socketFree(0)
0000538580:DEBUG: int spark_cloud_socket_disconnect() (914):socket_close()=success
0000538580:INFO : void cloud_disconnect(bool) (440):Cloud: disconnected

It looks like your server is not responding to the packets being sent to it.

The server should log incoming requests to the node.js console, so if you’re not seeing them, they’re being blocked. This could be because:

  • Firewall blocking port
  • VM not exporting port to public address
  • Multiple Ethernet interfaces and the server code is binding to the wrong one
  • ???

Assuming the address in the cloud debug log is correct, I’d look at the server side to see if something is preventing the packets from reaching the server.

1 Like

I can see “> 107” printed in the nodejs logs.
So something is getting through.

I understand that is data coming from the Electron -> Server?
Is there a way to pin the ports that the electron and server use to exchange data?

In that case, I think I know what the problem is. Change the DS_ADDR in the config.js file

'DS_ADDR':'107.20.71.170'

The address that was previously the default is no longer a device server.

2 Likes

That was it! I'm now in business.
Thanks so much for your help!

1 Like

Would it be possible to get a domain name for that? So that when/if the IP changes again the config isn’t invalidated?

Thanks @rickkas7 - both for this super project and the faster-than-getting-coffee troubleshooting today. Really awesome.

Yes, the DNS hostname would be 0.udp.particle.io (you can also use your specific device ID instead of 0, but zero works). However, the code needs to be modified to do a DNS lookup when DS_ADDR is read from the config file.