Serial communication stuck after several days

Hi all,

I’m using the Particle Electron to retrieve data over a serial connection from a sensor and then communicate it to the particle cloud. This runs perfectly for a few days but after some (variable) time the electron becomes stuck and doesn’t work anymore. Resetting the particle using the button doesn’t solve it, only reprogramming it.

I’ve run the script 3 times until it became stuck. The periods of functionality differed but where between 3 to 5 days. I’ve also run the scripts without triggering the Deep Sleep mode and it seems that the issue doesn’t occur in this scenario. Do anyone of you have any explanation/fix for this?

I’ve put the code that I’m using on pastebin: http://pastebin.com/PhmYmNDM

Kind regards,

Rick