Functioning with wifi and internet drops

Hello all,
I am still figuring things out with the spark core so forgive me if this has been solved, or there is a way to make this situation work. The closest I have found was “Can I Turn the CC3000 OFF?” located here . What I am looking to do may also be accomplished in code possibly, but I am not sure where to start.

If I 1. lose WiFi, or 2. lose connection to the cloud the core appears to stop processing the code/user loop. Sometimes I get auto-reset (CFOD) and then there is no WiFi available and the core sits. I seem to be able in code to check if I am connected to WiFi and check the connection to the cloud and can program around a no connection scenario. However, when the loop stops and/or resets I can’t program around that.

What I would like if possible…

  1. User/Code loop executes no matter what, period.
  2. If WiFi is available, latch on and get an ip address. If not try again later.
  3. If cloud is available connect to cloud. If not try again later.
  4. (nice to have, but not a connectivity issue) When a core is being flashed, instead of halting the execution fire off a method “finally” or “done” whatever you want to call it with a timeout. This way I can nicely save off any data to the EEPROM, save my state off with HTTP call, and change the states of the pins (set them low to turn off relays etc.) This would provide a graceful firmware update.

Is there some way to accomplish this? Or any chance these ideas could be incorporated in to the firmware?

Thanks again for everyone’s time.

1 Like
  1. We have plans to make it possible in June. I’ll have it on my list when we have discussion with the team

  2. This is pretty much a built in feature and the core will do it automatically

  3. Same as point 2.

  4. Sounds good and I would love to have this for my own firmware as well. The current setup is for general use cases and since our code is open source, feel free to modify it!

Some users might want, some users might not. It’s hard to strike a balance but if it’s really critical, we shall bake it into the default :slight_smile:

Thanks for your reply @kennethlimcp. I hope with the possibility of #1 in June it gets implemented since it seems like how most users expect the core to function. I don’t see much harm implementing #4 since if you don’t need that type of functionality you could just leave the function blank. I will have to pull down the code and see if I can figure out how to implement such functionality. How does the process work to get functionality baked in to the default? Is there some sort of voting?


Pull request and reviewed by the Skynet department.

Opps i mean :spark: HQ :smiley:

1 Like

My wifi has dropped out at night for 2 days in a row. Green light flashing. Signal strength is reasonable strong. Im about 7 meters away from a 3 antenna router. It will not recover unless I reset the spark. As a test, i turn router wifi off and on, and it recovers fine. Any tips? How can I tell the signal strength?
Is the external trigger going to help signal strength. (I have internal)
Can i ping the spark?

Yes you can ping the core via it’s IP address like a normal device.

Did you do a CC3000 patch before and reflashed firnware recently?

I know nothing about cc3000, and have just a simple bit of code on the core. It gets flashed each day.
How do I tell the ip / mac. I dont see it in my router, though I have a lot of IP’s

Find the device with mac address:

0x08 0x00 0x28 0x01 0xA8 0x1F

You can use this code to get the IP address:

I dont have that mac. Closest mac to that doesnt ping, thought the spark works.
So I will try serial console.
Ive never run console on spark before. I held down switch to get usb to work, installed drivers ok.
open com port and there is no traffic, and the spark code doesnt run.
Lot of things to know for new person to spark. Love it though.

Just match the 1st two hex. Every core has unique Mac Address but different hex behind.

You can consider a CC3000 patch :slight_smile:

can you give the url to this patch. I see lots of chats about it, but not specific instructions. Are there any negatives to the patch?

Not at all!

You will require dfu-util though.

can you give the url for the patch?

Opps sorry! Was already in the post but https caused it to work

Is it this link?
there are 135 replies. In a nut shell how do I turn cc3000 off?

1 Like

As for turning off the CC3000, I’ll let others pick up this question

@kiwibird1, you can put the CC3000 in standby using Spark.sleep(seconds) and it will wake after the specified time. You cannot actually turn the CC3000 off unless you put the Core into deep sleep. You can boot with WiFi disabled by including:

#include "spark_disable_wlan.h"
#include "spark_disable_cloud.h"

at the top of your code and then use WiFi.on()/ to control the wifi with your code. You can test for wifi connectivity using WiFi.status() which will return an WIFI_ON/WIFI_CONNECTING/WIFI_ON status that you can test and act on.

You could use a combination of these:

  • setup your code to start with wifi disabled
  • at the top of loop() and based on a timer (see below) do a WiFi.on() and timeout if it does not connect
  • if you timeout, do a to put the CC3000 in standby
  • (re)start a timer to wait x seconds or minutes before trying the WiFi.on() again



I will try the above. Looks like a great work around. Should I also do the patch to cc3000? If so how is this done?

Also,i cant get usb coms to work. I had blue light flashing, and com port comes up in device manager. My code stops running. If I reset the spark, the code runs but come port is gone.

You need to install Dfu-util and use the .bin file to flash

Alternatively, you can use the Spark-cli to flash the .bin patch file as well :slight_smile:

@kiwibird1 if you are going to upgrade the cc3000 firmware the instructions are found here: Please note I have lost my mac address on both cores that I updated. You should take a note of what your mac address is on your router or pull it off your core. If you do lose your mac address you can restore/set it following this post: It really is not a big deal if you lose your mac address and you can’t retrieve it since it is really layer 2 and not exposed on the internet if you are behind a router being NATed. Layer 3 the router’s mac is what is exposed…

The com ports working and not working seems to happen to me as well from time to time. I have found sometimes I just unplug the usb going to the core wait a little and connect and the com port is back. On windows you can verify when the port if available via device manager under com ports.

Best of luck!