# Setup() running more than one time

**URL:** <https://community.particle.io/t/setup-running-more-than-one-time/16375>\
**Category:** Firmware\
**Created:** [October 9, 2015, 1:40am UTC](https://community.particle.io/t/setup-running-more-than-one-time/16375 "2015-10-09T01:40:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steelydev](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/steelydev/32/5688_2.png) [@steelydev](https://community.particle.io/u/steelydev)\
**Post date:** [October 9, 2015, 1:40am UTC](https://community.particle.io/t/setup-running-more-than-one-time/16375/1 "2015-10-09T01:40:17Z")

</div>

My user firmware has a function that blinks D7 to indicate normal startup. The blink routine is only called in startup(). My user firmware does not declare a SYSTEM\_MODE, so I assume I’m in AUTOMATIC.

I have an number of devices running in my test environment (office) and every once in a while D7 will start flashing on some device. There are no power interruptions because everything is on an uninterruptible power supply and I never notice any flickering of lights when this happens. There’s no system reset in my firmware.

What could make my user firmware execute startup() more than once?

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [October 9, 2015, 3:30am UTC](https://community.particle.io/t/setup-running-more-than-one-time/16375/2 "2015-10-09T03:30:15Z")

</div>

If your system every hard faults or has other system faults that cause an literal red blinking SOS followed by an error code, your system will then typically reset itself. If that happened you’d see setup() run again. Here’s the various code for SOS and what might cause them: [https://docs.particle.io/guide/getting-started/modes/photon/#red-flash-sos](https://docs.particle.io/guide/getting-started/modes/photon/#red-flash-sos)

Most common is dividing by zero, followed by a memory access fault (trying to read the memory contents using a NULL pointer) and also running out of HEAP (RAM).

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [October 9, 2015, 11:31am UTC](https://community.particle.io/t/setup-running-more-than-one-time/16375/3 "2015-10-09T11:31:30Z")

</div>

If you are using a Core another reason for going through `setup()` are all `System.sleep()` modes that power down the µC.

And at some point (might well be fixed by now tho’) a longer lasting loss of cloud connection also put the device back to startup.
