I am able to flash the code to Spark Core from web IDE only once after a factory reset.
When I try flashing the same code for the second time, I see Red flashes, Blue flashes, burst of Cyan flashes followed by breathing Cyan on the Spark Core.
The web IDE says “Server has failed to process the request on time please try again”
Above behaviour is also noticed when I try to flash ‘Blink an Led’ sample code to the Spark Core.
@kennethlimcp, I observe the above mentioned behaviour even when I try to flash Spark Core with “BLINK AN LED” sample code (see below) provided by Spark.
int led = D0; // You'll need to wire an LED to this one to see it blink.
int led2 = D7; // This one is the built-in tiny one to the right of the USB jack
void setup() {
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH); // Turn ON the LED pins
digitalWrite(led2, HIGH);
delay(1000); // Wait for 1000mS = 1 second
digitalWrite(led, LOW); // Turn OFF the LED pins
digitalWrite(led2, LOW);
delay(1000); // Wait for 1 second in off mode
}
Following factory reset, I am able to flash the below code to the Spark Core. When I try to flash the same code again there seems to be a problem, Please see the video here
I can reproduce the problem to a degree - what follows is really diagnostics for the spark team:
after flashing the original code the spark is no longer able to OTA flash.
on restart, I don’t see the SOS, but I do get what looks like a reset:
white LED, then blue LED (listening), then back to white LED, then blue again - this may repeat another time (or not at all) before finally flashing green, then cyan then breathing.
When breathing, the cloud cannot push OTA updates and the LED never turns magenta.
using cli spark list shows my core as offline (after quite a long pause - I counted 30s.)
flashing tinker fixes the problem and OTA flash works again, so I flash the sketch above
spark starts up normally, gets to breathing. I attempt OTA flash again, but this fails with a stuck magenta LED, which then turns off, and eventually the core resets.
after reset, OTA flash doesn’t work (although spark list shows the core online.)
flash tinker allows OTA to work again.
With repeated attempts, I trimmed the code down to:
This blocks OTA updates. Tried increasing the delay to 1500, didn’t help.
At 2000ms, it attempts to OTA flash, but fails with stuck magenta.
Increased to 4000ms and then the flash succeeded, but not at 2500ms, which waited for a minute before giving a stuck magenta.
So somewhere between 2500 and 4000ms lies the threshold for publishing events that is fast enough to stop OTA from happening.