Preserving Imp code across cold reboots

From your wiki:

Note that the imp does currently require a wifi connection on a cold boot to ensure the squirrel code is in sync with the server. This prevents code being written that would unrecoverably hang an imp.

I was wondering, if the reason you don’t keep the code on the Imp is to avoid bricking the module, why don’t you employ a Wifi sync attempt with a fallback to previously downloaded code?
Another option would be to give the user a possibility to “factory reset” the module, either by a certain circuit or by a particular blink up code.

P.S.: Loved the product! Can’t wait to receive my Imp! Keep up the awesome work!

Omri.

Power cycle has most of the features of “factory reset”. If you can change the code thru the IDE. Waking from deep sleep does not require a Wifi connection. So you get to choose which one you want!

Maybe I didn’t explain my self properly. I would like to preserve the code on the Imp even after a cold reboot.

@omri that will be there in time as Hugo one founders said in post a while back As to when this will be don’t know.

It will be in the next release, at least in experimental form. And the issues are exactly as Omri describes: it only re-uses the previous code on cold boot if the wifi connection attempt fails. We looked into requiring a dedicated factory reset pin, which would certainly be a more robust way of offering this facility, but some customers who wanted the feature want to use the existing IMP-002 module, and were already using all of its pins.

Peter

Will this include any amount of non-volatile (runtime) memory or will just the code be persisted?

@peter isn’t blink up reset an option?

Blink-up reset might sometimes be convenient, but it could never solve the whole problem. Once the Squirrel program is running, it can turn blinkup off, or even put the whole imp to sleep again. There’s even a chance (heaven forfend) of bugs or crashes in the imp firmware itself which the Squirrel could trigger. The only way to be sure, especially for IMP-002 modules that can’t just be removed and stuck in a “friendlier” impee, is to provide a window of opportunity for doing a Squirrel upgrade, before running any Squirrel at all.

Peter

@deldrid1 Over a cold boot, still just the code will be persisted. There is a task in the backlog for investigating offering persistent data storage to Squirrel, although the only available memory for that is NOR flash, which has a finite (but large-ish, ~10K) number of rewrite cycles. Again, we’d like to avoid even the possibility of people doing something daft and bricking their imps – though sometimes you do have to give people enough rope, in order to enable a desirable feature.

Peter

So if there is no wifi connectivity after a power cycle, no code can run on the imp? Am I understanding this correctly?

With the current release, that is the case - no code will run.

With the next release, code can run from a cold boot without wifi connectivity.

Thanks Hugo. For my product I definitely need some basic functionality from cold boot without wifi. With so many positive aspects of the imp, it would have been heartbreaking to write it off because of that. Can you give me a rough estimate on the date of the next release?

It’s already out with some customers for testing, I’d hope it will ship within the next couple of weeks.

Has this feature been released in the product? i.e. if I restart an imp from deep sleep and it cannot find WiFi, will it continue with last known program from flash? If so, how long roughly would it take before deciding it cannot find WiFi and hence running the last known code?

This feature is in release-27 and later, so yes it’s been released. The timeout is ten seconds.

Peter

Thanks!