Serial causes persistent system level problems on Photons

This is long and complicated, but here goes…

Any time I include serial in my code, I need to go through a lengthy process to bring the device back.

I had my app running perfectly, but needed to debug some math. So I included some debug statements with serial.

Normally, my app would run with a Cyan Heartbeat. But as soon as I compiled with serial statements, I got a magenta heartbeat. In some cases I get 2-5 cyan heartbeats and then I get magenta heartbeats. Eventually even the magenta heartbeats turn into magenta blinks (uneven).

To get the device working again, I have found that I need to flash into firmware reset mode and then reflash Tinker from my tablet.

Some other notes:

I just tried this program:
(I have tried it with both of those Serial.available() statements commented/uncommented at a time)

bool debug = TRUE;

void setup() {

  //if(debug){while(!Serial.available()) delay(100);}
  //if(debug){while(!Serial.available()) Particle.process();}

void loop() {


I have also tried setting debug to FALSE and flashing, and this still causes problems! Also, it doesn’t matter if I am hooked to the PC or not connected at all (hooked up to PS).

Any ideas?

Note: It looks like the flashing process fails when I do this (never stops flashing magenta after FW download begins), and I can’t re-flash from the cloud IDE successfully (even in FW reset mode), hence needing to flash Tinker from the App).

Just to help out, here’s some details of going through the process…

  • Reset FW, Flashed Tinker from app. Checked that Tinker is working, Cyan heartbeat
  • Went to cloud IDE, forked “Blink an LED” and loaded it.
  • This causes a Magenta Blink that never stops.
  • Button Reset: Connects to cloud, Cyan Heartbeat for a couple seconds, device resets itself. Upon reset I have a magenta heartbeat
  • Attempt to flash from the cloud: After a few seconds Magenta blink. But I am not convinced it was the cloud that is causing this. Blink never stops.
  • Reset: Appears to go through WiFi connect and then MAgenta HB. HB is interrupted every so often by a blink. Device occasionally resets.

So at this point, and I didn’t even realize it, I can’t flash even non-serial code.

I have a second Photon, and I rand some of the same code on it- and I am getting the same problem! I cannot flash anything from the Cloud IDE successfully- only Tinker from the App.

Note: I did a full reset and unclaimed/reclaimed my second device and this did not help.

I’m not sure if this is related to your problem, but recently the newest firmware was released for system and application code for the Photon.
This implicitly requires the system parts to be pushed OTA to your Photon to ensure compatiblity between system and application FW versions. Hence the first flash with 0.4.4 application FW will take considerably longer than normal updates.
So if it’s breathing/flashing magenta be patient and let all three parts (sytem1, system2 and app) flash - may take up to two/three minutes.
If you interrupt this procedure, you’ll have to go back to Safe Mode and retry.

Quote from the mail you should have received today

We'll be delivering these updates to you automatically, so the next time you flash new firmware over the air, your Photon will automatically be updated to 0.4.4. Warning: this may take a few minutes!