Hi @Dave, I have tried clearing WiFi profiles and redoing smart config from iPhone 4 several times, with no success. I also did a factory reset, same results - fast cyan flashing. When WiFi has been configured, it goes very quickly from blue, to flashing green, to fast cyan flashing … So I guess this means that firmware has gotten passed the WiFi router login and is struggling with the cloud connection?
Hmm, yes, fast cyan should indicate that the core is on your network, but it’s having trouble establishing a connection to the server. This could be because a router or firewall is blocking the connection, or it can be because keys on the core aren’t working. Unless you wiped your external flash memory recently, I’m guessing something on your network is blocking your core.
HI @Dave, the problem seems to have resolved itself. I enabled “Hot Spot” on my iPhone, and then configured the Spark Core using USB serial terminal. This worked and the core was able to connect to the cloud, and then it started flashing purple which I think is a firmware update. Then I erased WiFi passwords and setup the Spark Core on my home WiFi router using the iPhone app and everything works fine now.
@aamirjvm I have seen this kind of behavior with networks that have a ‘captive portal’, as an example; the Core attempts to connect to the Cloud and gets intercepted by something else, and tries to do the encrypted handshake with whatever thing got in the way, and just gets stuck. In my case I was able to recover by re-starting, and the captive portal let the Core through the second time. We should write some code to timeout and re-attempt if this happens.
@zach Yesterday night I arrived home and my core was flashing fast cyan, I guess for some reason it re-started and had a handshake problem. I was just curious and left it the whole night and in the morning it was the same, I’m guessing it’s not restarting or timing out, it would be a nice thing to add!
There is a difference between CFOD (slow) and CFOD (fast) right? I don’t get the typical slow CFOD… but I have seen the fast CFOD when I mess up things in my code, like allocate too much global memory.
@Iv4n@BDub The biggest memory usage is definitely in the RSA handshake. Darn that big number math. The price we pay for security. I don’t recall how much heap it claims max, but it’s the bulk of the ~10K claimed by . Here are some pointers to relevant code for anyone who feels like digging into memory usage improvements.
The only call to allocate heap (malloc) in the entire firmware is in TropicSSL’s mpi_grow:
This gets called in init_rsa_context_with_public_key when we send the initial message encrypted for the server:
It’s also called (init_rsa_context_with_private_key) when the Core is processing the encrypted reply from the server in set_key, both in decipher_aes_credentials and verify_signature:
As I write this I’m noticing that the description for mallopt in the newlib docs says:
… releasing it back to the system in free (the space is released by calling _sbrk_r with a negative argument)
We have a stub for _sbrk but not one for _sbrk_r, though this might all be delegated under the hood. If you know otherwise, by all means submit a PR.
As always, pull requests welcome. @satishgn has been working lately on trying to statically allocate a buffer for the RSA math and free it up afterward. Not there yet, but we’ve got our eyes on the prize.
I haven’t seen your core try to connect to the server in the last week or so. It’s possible it has a bad copy of the server public key. Can you re-flash that key and see if that helps? Grab dfu-util binaries from here: http://dfu-util.gnumonks.org/ or with brew / macports if you’re on a mac, and then:
grab this file https://s3.amazonaws.com/spark-website/cloud_public.der
dfu-util -d 1d50:607f -a 1 -s 0x00001000 -v -D cloud_public.der
Make sure you’re using dfu-util version 0.7, and not the earlier ones.
I think we haven’t seen @war1st’s core id pop up on the server side logs yet, so you’re right in that it seems unlikely that the private key is the problem. I’m guessing issues connecting to wifi at this point, or maybe that port is blocked on that network?
@kennethlimcp Ok,I upgraded firmware, now it really looks like core can’t connect to my router. It cycles fast cyan-fast green now. Basically my network consists of 2 routers - Apple Wi-Fi and Thomson TOW 770 (DOCSIS 3.0). The last one connects me to the Internet. @Dave Never thought about it,as I tried the Core with different networks and the result was always the same - fast blinking cyan.
Okay, that’s good to know! If you haven’t yet, can we try running the patch programmer? This is just like flashing new firmware, just after you flash you hold the Mode button for 3+ seconds until it starts flashing magenta.