Flashing SparkCore OTA without using (bypassing) the reset and mode button

Hi,

We are developing a product, of which the SparkCore firmware sometimes needs to be upgraded OTA. Off course this should be possible without pressing the reset button and mode button.
Because in the future we have thousands of these products in the field, so this is the only way to do firmware upgrades.

Is there already a method to do an firmware upgrade (flash) without pressing those two buttons?

Regards.
Albert.

@elnavdo currently, you code/firmware is already downloaded over OTA. You don’t need to push any buttons to download new code.

All you need is:

  1. Core is connected to :spark: cloud (breathing cyan)

  2. Send new firmware using Spark IDE

Unless you are talking about updating factory reset firmware which is used only when you do the factory reset (mode + reset)

1 Like

Hi Kenneth,

Thanks for your information.
I’m not talking about the updating factory reset firmware. We want to flash our application firmware OTA. And that should be possible without using the mode + reset buttons.
What do you mean with “but cannot 100% tell if it is in the mode.” ? So there is already a workaround for it, that we can try?

Regards.
Albert.

@elnavdo The firmware can be flashed to the core OTA using the Spark IDE.

This has always been the way it worked and that’s why the core is so popular.

There’s no need for any buttons to be pressed to do so. Just the Spark core online and flash using the Spark IDE will work!

So i guess it is able to do as what you require?

Hi Kenneth,

I have spoken with my collegue, and he knows about this. But then you first have to install the tinker App.
But we want to flash the SparkCore with our application firmware already running on the SparkCore. So we want to use the Spark CLI and simple flash the SparkCore OTA with a newer revision of our application firmware.
And we don’t want to use the Spark IDE.

Regards.
Albert.

@elnavdo totally! that’s why Spark CLI created, partly :smiley:

I use that feature sometimes due to the debugging i do to catch some bugs.

  1. You don’t need the tinker App to do OTA. As long as the core is breathing cyan, OTA will work for sure

  2. Have you got Spark CLI working? If so, i can help you along with using it to flash OTA if you need :smiley:!


Maybe i should make things clearer:

  1. Let’s say you have a new Spark Core, you will use the Tinker App OR USB to program the Wifi Credentials

  2. Once the core connects to the Cloud, 'breathing cyan", you can now perform OTA already. Either using IDE or Spark CLI or DFU all would work.

Tinker only comes it when you need to initially send the Wifi credentials. However, USB works fine too.

Hi Kenneth,

That sounds fine. Yes, I have the Spark CLI working.

Regards.
Albert.

Let me know if you need help :smiley:

You guys are probably all way ahead of me in terms of skills and all. :stuck_out_tongue:

So with the SparkCore now running our application firmware, it’s possible to flash a newer revision of our application firmware OTA using the Spark CLI.

Yes. You can give it a try:

On Spark CLI:

  1. Check the core id

    spark cloud list (will show all the cores online)

  2. Flash your code

  • spark cloud flash core_id xxxxx.ino

or

  • spark cloud flash core_id xxxxx.bin

or

  • spark cloud flash coreid /yourdir/app/src

You will get a response from the CLI if it succeeded or fail

Also, you core will start to blink magenta when the flashing starts

Hi Kenneth,

It works. Great. I Ihave still one question. This yourcodefile.ino file you are talking about, what is that?
Because we do our build locally. We don’t use the SparkCloud environment. So we do the “make” command on our laptop locally and then flashing the created binary file to the SparkCore, over USB. But then you need to set your SparkCore in the flash mode using the reset button and mode button.
But now we can it also do via the Spark CLI and OTA. That’s great.

Many thanks for your help.

Regards.
Albert.

@elnavdo basically flashing over USB is in DFU-mode.

We can use the Cloud flash method which don’t require you to put the core in flash mode using the buttons

  1. .ino files are those you write in the Spark IDE. But not for your case since you do it locally

  2. Sounds like you create a .bin using the ‘make’ command? If yes, you can use spark cloud flash coreid your_file.bin

Try and see if it works!

Hi Kenneth,

Yes, you’re right. I did.

Thanks.

Regards.
Albert.

Glad it worked! Hope to see more about your project soon :smiley:

1 Like

One thing I might suggest doing is adding a version number variable (a la Spark.variable("version", &version, INT);). That way you can poll each :spark: to see what version number of your firmware it is running. It would be a failsafe in case a :spark: was accidentally skipped or offline during a mass push. You could build a monitoring script that polls each :spark: at a fixed interval and alerts you if one is not at the current version.

Hi Kenneth,

It’s a new product. And we are now working on it full speed. But when the time comes, you will hear.

Albert.

Hi @elnavdo,

We also have capabilities for rolling out automatic firmware updates for products based on the Spark Core, if you want to do fleet updates, etc. :slight_smile: Please feel free to email us at hello@spark.io if you have product / fleet management questions.

Thanks,
David

@Dave That sounds totally useful!

Is that gonna be available to the public too?

My project hasn’t moved to that stage but it’s nice to know that it’s possible already :smiley:

not sure yet how we’ll be delivering features like this (i.e. fleet management); this stuff is very early in development, but it is something we’re discussing within the team.

1 Like

If one of his 1,000 Spark Cores bricks, is there a way to force factory reset without having to push Mode / Reset buttons manually ?