Code is not runing after firmware update (photon blinks red after flash)

Hi all.

Im having issues with my particle devices (photon and p1).
I cant run my code on my photon and p1 since the latest firmware update.
My code was running good and without problems before the update, but since the latest firmware update i cant make it work again.
I tried several ways to solve it but nothing worked.

can anyone point out on what may be the cause for this?

Thanks in advence!

(btw: i have not attached my code because its too large)

edit: could it be something with the cloud functions?

There are several breaking changes with v1.0.0. Most notably the requirement for defining PUBLIC vs PRIVATE when using Particle.publish() and Particle.subscribe(). See the changelog here:

You’ll have to look through the changelog yourself because your question is quite vague… after all, we have no idea what your code does and how it does it. You also haven’t stated what exactly your code isn’t doing beside a red blink. Does it blink an SOS pattern followed by an error code?

Does your code run OK if you downgrade to v0.7.0?

1 Like

It would help if you could point out what you’ve tried so we don’t have to suggest those things again.

If you’ve used the Web IDE, you could post the share link.

A Device OS update is only triggered if you’ve selected a user version higher than the Device OS version on the device. It won’t auto-update the Device OS without you doing something. IS it possible you’ve changed anything in your user code that causes the issues?

1 Like

Would be good to know what red code it blinks.
If it is SOS+7 then it may be in connection with threads and/or race conditions in constructing your objects.
But without knowing more about your code there is no way to tell for us.


Hi guys, thanks for the replys! :slight_smile:

So after a little of debugging, i found the problem.
In one part of the code i have the next lines:

Serial.println("DEBUG1"); //this line prints to the serial monitor
if(_i2cPort->Wire.endTransmission() != 0){
    Serial.println("DEBUG2"); //this line print nothing to the serial monitor.
    return (false);

Does anybody know what might be the issue here?

Thank you all very much!

Why do you write it like that? The Wire.endTransmission syntax doesn’t require the _i2cPort variable. Where is that variable defined/declared? Is that something left over from an Arduino port? I’m not familiar.

Does this work?:

Serial.println("DEBUG1"); //this line prints to the serial monitor
if(Wire.endTransmission() != 0){
    Serial.println("DEBUG2"); //this line print nothing to the serial monitor.
    return (false);

And that’s just a guess since you have shown such minimal code.


Hi ninjatill, thanks for the comment.

no, just tried it now and there are no changes…

In addition, i have changed my code and now using the Wire library as recommended (without _i2cPort variable).
still, not working.

Well in that code snippet I modified, if the transmission is successful, you will never get to the “DEBUG2” statement. I assume the code is functioning normally and so the red panic is something else. So then back to the beginning…

What IDE are you using? If Web IDE, use the “Share this Revision” button to post a link to your code. Also, describe the red blinks as @ScruffR asked. There is usually an SOS pattern followed by a error code. What exact error code are you seeing? Did you review the version 1.0.0 changelog? Did any of the breaking changes affect your code? Was your code relying on a bug that was patched in the latest release? If you don’t post your code, the review is all up to you.

Hi guys, sorry for the late response.

The error im getting from the photon seems to be the Red Flash Sos.

I did not found something that could be related to my problem.

Im using the code for scd30 air sensor from SparkFun, this is the code:

boolean SCD30::begin() //TwoWire &wirePort
    //Check for device to respond correctly
    if (beginMeasuring() == true) //Start continuous measurements
        setMeasurementInterval(2);    //2 seconds between measurements
        setAutoSelfCalibration(true); //Enable auto-self-calibration
        return (true);
    return (false); //Something went wrong
boolean SCD30::beginMeasuring(uint16_t pressureOffset)
    Serial.println("inside begin messuring");
    return (sendCommand(COMMAND_CONTINUOUS_MEASUREMENT, pressureOffset));
boolean SCD30::beginMeasuring(void)
    return (beginMeasuring(0));
void SCD30::setMeasurementInterval(uint16_t interval)
    Serial.println("before send command call at setMeasurementInterval");
    sendCommand(COMMAND_SET_MEASUREMENT_INTERVAL, interval);
    Serial.println("after send command call at setMeasurementInterval");
void SCD30::setAutoSelfCalibration(boolean enable)
    if (enable){
        Serial.println("inside setAutoSelfCalibration before send 1");
        sendCommand(COMMAND_AUTOMATIC_SELF_CALIBRATION, 1); //Activate continuous ASC
        Serial.println("inside setAutoSelfCalibration before send 2");
        sendCommand(COMMAND_AUTOMATIC_SELF_CALIBRATION, 0); //Deactivate continuous ASC
boolean SCD30::sendCommand(uint16_t command, uint16_t arguments)
    Serial.println("inside send command 1");
    uint8_t data[2];
    data[0] = arguments >> 8;
    data[1] = arguments & 0xFF;
    uint8_t crc = computeCRC8(data, 2); //Calc CRC on the arguments only, not the command
    Serial.println("inside send command 2");
    Wire.write(command >> 8);     //MSB
    Wire.write(command & 0xFF);   //LSB
    Wire.write(arguments >> 8);   //MSB
    Wire.write(arguments & 0xFF); //LSB
    Serial.println("inside send command 3");
    if (Wire.endTransmission() != 0){
        Serial.println("inside send command 4");
        return (false); //Sensor did not ACK
    Serial.println("inside send command 5");
    return (true);

Output of Serial prints:

inside begin messuring
inside send command 1
inside send command 2
inside send command 3
inside send command 5
before send command call at setMeasurementInterval
inside send command 1
inside send command 2
inside send command 3
inside send command 5
after send command call at setMeasurementInterval
inside setAutoSelfCalibration before send 1
inside send command 1
inside send command 2
inside send command 3

It crashes always at the same place…

Thank you all very much for the help!

We know it’s the SOS, but which one?

There are a number of other red blink codes that may be expressed after the SOS blinks:

Hard fault
Non-maskable interrupt fault
Memory Manager fault
Bus fault
Usage fault
Invalid length
Out of heap memory
SPI over-run
Assertion failure
Invalid case
Pure virtual call
Stack overflow
Semaphore lock timeout (Since 0.8.0 60 seconds expired while trying to acquire a semaphore lock, likely due to dynamic memory allocation)

Wait until the SOS is over, then count the amount of red blinks. Alternatively, shoot a quick video and we’ll try to count them for you…


Hi Moors7, thank you for the response.

I managed to solve the problem!

I had a class in which i used “this->” in some functions to mark and distinguish the members of the class and functions parameters.

After deleting all the “this->” for the class, the photon started working proparly.

Why is this happening? I did not found something that points that out at the 1.0.0 changelog…
Before the firmware update the code worked good, am I missing something?

Thanks again for the help!!

That’s probably due to a race condition during instantiation of your objects.
If you had provided the actual SOS code (the number of slow flashes after the actual SOS … - - - …) as asked so often before, we may have been able to tell you that earlier :wink: