I am having a new issue with my core where once I flash firmware once anytime after it says the flash was successful, but the old firmware was still present. I just did a factory reset, flashed firmware, and now any flash after this doesn’t take. The web IDE reports the flash was successful every time. What could this be? I have a Photon and this isn’t having the issue.
Without any other info about your previous sketch it’s hard to tell, but the IDE only reports if the initial transfer (cloud to OTA buffer) was (probably) successful but does not tell if the flash (OTA buffer to app flash area) succeeded.
So if your running code manages to mess with WiFi mear the end of transfer or during flash-over (rapid magenta) your update will fail.
Does OTA work after a factory reset?
Could you show your code?
I’m seeing this happen with more than one sketch. Below is the smaller of the two where I’m just playing around with Blynk, but my main project which is completely different has the same issue. OTA works after a factory reset, but then doesn’t take any new code. The device flashes magenta like always, reboots, and then comes back up on the previous code.
// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
WidgetTerminal terminal(V3);
WidgetLED led1(V1);
WidgetLCD lcd(V2);
bool firstRun = true;
void setup() {
Blynk.begin(auth);
}
void loop() {
if (firstRun == true and Blynk.connected() == true) {
blynkStartup();
}
Blynk.run();
}
void blynkStartup() {
led1.on();
Blynk.virtualWrite(V0, 1);
//led1.setValue(255);
//Blynk.virtualWrite(1, 255);
terminal.println("Woke up");
terminal.flush();
firstRun = false;
}
BLYNK_WRITE(V0)
{
int value = param.asInt(); // Get value as integer
if (value == 1) {
led1.on();
lcd.clear();
lcd.print(0, 0, "You are:");
lcd.print(0, 1, "ON");
}
else if (value == 0) {
led1.off();
lcd.clear();
lcd.print(0, 0, "You are:");
lcd.print(0, 1, "OFF");
}
}
Sorry, was a while, but I can’t see anything wrong with your code.
It might be inside of Blynk tho’.
The background is, if the cloud house keeping is not done quick enough (at least (!) once per second) the cloud connection still stays alive, but OTA other features get unresponsive.
And especially OTA can’t cope with that too good.
Since you can OTA after a factory reset, you can be sure it’s no HW issue, so the next thought is the firmware and since you code looks fine, I’d suspect Blynk.
But since we don’t see a lot of complaints about Photon + Blynk it might be something in connection with the Core and so my next thought is: “What firmware version are you building for (0.3.4 or 0.4.7)?”
That's very strange then. I always build on the newest (currently 0.4.7).