Hey,
I want to write a function that external switch will do a factory reset. For example: I will press on it for 30 seconds and the core will do a factory reset.
How can I do this? There is a function for factory reset?
Hey,
I want to write a function that external switch will do a factory reset. For example: I will press on it for 30 seconds and the core will do a factory reset.
How can I do this? There is a function for factory reset?
I think it’s possible but I need to find the code for it.
If you dig in the core-firmware repo, or maybe/more likely the bootloader, you can see the code for it.
Yes! You can trigger a factory reset, but you need the latest bootloader, the code snippet would be:
//FACTORY RESET
USE_SYSTEM_FLAGS = 1;
Factory_Reset_SysFlag = 0xAAAA;
Save_SystemFlags();
Delay(100);
USB_Cable_Config(DISABLE);
NVIC_SystemReset();
Make sure you have a black core with the latest bootloader, or load it using my replacing your bootloader guide here https://community.spark.io/t/st-link-programmer-shield-only-so-youve-decided-you-want-to-update-your-bootloader-and-everything/2355
Thanks!
David
First, thank you for your answer.
Second, what do you mean with “Make sure you have a black core with the latest bootloader”? If I won’t do the guide it will goes back to the “thinker code”?
If you have a black core, it has the latest bootloader which allows software programmed factory reset.
Otherwise, you can update the bootloader using the guide Dave mentioned
I tried to combine the code that Dave gave me with my program. All I get is a green led blinking for a Sec and then it’s back to the cyan color and connecting to the wifi. What am I doing wrong?
Hi @itayd100,
That code interacts with the bootloader. The Bootloader is another program running before your firmware runs on your core. You’ll need an ST-Link programmer, and a programmer shield, and to follow the tutorial guide I posted for updating your bootloader on your Core. Then you’ll be able to trigger a factory reset.
Thanks,
David
Thank you for the answer @Dave, I really appreciate it.
I understood it something connect to that and I have already ordered another Spark Core with programmer shield & ST-Link/v2. I have experience with the TI MSP430 debugging, hope it will be the same.
Thanks again and ill update after the process,
Itay
This seems like it belongs in a FAQ somewhere. The community boards seem to ephemeral. It’s great that it’s possible to do though.
Instructions for updating the bootloader are in the bootloader repo as well: https://github.com/spark/bootloader
This feature was added very recently for the last manufacturing run to help me with testing: https://github.com/spark/bootloader/commit/a842d717af5f888c3226d34c3a6f5bd2d93c01f4
Adding it to the main documentation would be great too! http://docs.spark.io/firmware/ – Every docs page now has an “Edit this page” link at the top if you want to add a section!
Thanks!
David
Ok, I got the programmer shield and the ST-LINK/V2 and started the “https://community.spark.io/t/st-link-programmer-shield-only-so-youve-decided-you-want-to-update-your-bootloader-and-everything/2355”
And I’m stuck…
The core is blinking yellow and the small blue led is is on.
I tried to follow the guide:
Unlock the core - ok.
Erase all - ok.
Burn the bootloader.bin to 0x08000000 - ok.
Now i tried to burn the cc3000-patch-programmer.bin to 0x08005000 - not sure if I succeed.
I stopped here.
What should I do? Do you have a YouTube video of the guide?
Do I need to burn the external flash too? How do I do it?
Thanks for the help,
Itay
I tried to do it again, step by step with the dfu-util. Everything is working!
I have another question: what is the command to do “just” system reset?
Thanks for the help
Hi @itayd100,
If you just want to reset the core, I think that command would be:
USB_Cable_Config(DISABLE);
NVIC_SystemReset();
Thanks,
David