Problems reflashing core

I am on Windows and am running into a bit of a problem flashing my cores.

My code collects data, logs it to the web, then stays awake for 5 seconds just for the purpose of being available to be flashed. (all totaled the core is awake about 35 seconds) Then goes into SLEEP_MODE_DEEP mode for a long duration.

Obviously the core needs to be awake to be flashed. What I had worked out was a simple python program that would read my logged data and calculate when to send a flash command via the command line and dfu-util, it was working great at first (30 or more times no problems) now I get 3 possible behaviors

the command being entered on the command line is (spark flash my_deviceID path_to_my_bin)

  1. response from the command - > (flash core said {“id”:“my_deviceID”,“status”:“Update started”})
    The core is flashed with new code and everything is great

  2. response from the command - > (flash core said {“id”:“my_deviceID”,“status”:“Update started”})
    The core seems to start the flashing process then hangs during it and eventually starts
    running again with the old code.

  3. response from the command -> ({“code”:“ECONNRESET”})
    The core seems to start the flashing process then hangs during it and eventually starts
    running again with the old code.

Clearly 2 & 3 are what is killing me. When I flashing via the cloud using the Spark Dev IDE it almost always works. Does anyone have any ideas what is different between the Spark Dev IDE and the dfu-util command line programs that would lead to the difference? Is there something I should be doing at the command line before issuing the spark flash command?

Any help would be most appreciated.

Sorry if I can’t offer any help on your particular problem, but since you mention dfu-util, do you have physical access to your Core to use dfu_util via USB?
If so you’d not need to wait for your Core to wake up, you’d just put it into yellow flashing “dfu mode” and use this as CLI command spark flash --usb path_to_your_bin.

1 Like

Currently I can reflash with the Spark Dev IDE (no problem) as I have physical control of the cores. What I am trying to work out is the reflashing via wifi out in the field.

Thanks for trying to help though.

1 Like