What can cause the event "spark/device/last_reset", with "data":"pin_reset"

I’m seeing this on one of my devices in the field that isn’t reporting data periodically as it’s supposed to (it’s supposed to publish every 30 mins)

I figured that the the 30 min counter was restarting over and over because of bad wifi causing my single-threaded firmware to restart each time the photon reconnected.

Having now had the client replace wifi hardware, and I’ve updated to a multi-threaded firmware, I’ve started to notice the event in the subject happening frequently, and am now wondering if some other reason for a reset is happening. Certainly no one is manually pushing the reset button every few minutes.

Edit: I should mention that this is a Photon on a PowerShield with a full charge. It’s not happening because of a jiggly usb cable.


Let me ping someone that might be able to help, @tylercpeacock are you able to assist?


Any ideas on this? I’m going to work on using retained variables to survive a reset, but it’s happening a LOT, like every 7 minutes sometimes

Just to add some more details. I’ve reworked my firmware so that all the necessary data persists during a reset.

One variable I keep track of is “elapsed time” between resets, so that using the usual “millis() - _timer” method I can start from “millis() - _timer - prevElapsedTime”, and basically continue to accrue time even during a reset. Essentially, the device is supposed to publish every 30mins, and with the device resetting every 7-15 mins, it never published.

It now publishes. So that’s nice. I also buffer up any data that was supposed to publish if the device happened to be disconnected (i.e. Particle.publish() returns false). The idea was that the device should always be able to publish 30minutes of periodic data, even if it has to do it after the fact while both wifi connectivity and pin_resets are unreliable.

Enter Strangeness. I’m only getting data every hour or more. That seems to indicate to me that my thread isn’t executing for much of that time. It’s as if the device is spending so much time resetting that my thread is only accumulating 30 minutes worth of millis() in an hour. That seems crazy.

I’m thinking there must be some kind of hardware issue? Any ideas on what to try next?

@rickkas7 are you able to assist?


@Horganic, without seeing code, it is difficult to diagnose. Also, what does your external hardware (connected to the Photon) look like?

1 Like

The pin reset event only occurs when the reset button is pressed, or something causes the RESET line to be pulled low. Do you have any additional circuitry connected to that pin?

In my case the reset was caused by ESD, or EMI caused by ESD or other heavy load switching. Check for any events that might cause ESD on the device, or ESD around or just a big AC motor turning on (HVAC, elevator, etc.)

Thanks all,

I’ve sent a replacement out to the field and I’ll update this post when I have the device shipped back.

In your experience, was this something you had the photon driving? Or was it enough to just be “near” some of those things. The device is near a refrigerator, and a temperature controller that probably has some big relays.

In my case the EMI came from ESD discharges nearby or directly to my board (as a testrig I forced discharges various way later). The heavy load switching is just an other possible source for the EMI.