<div dir="ltr">Chip,<div><br></div><div>Forgive me but I do not recall if you have the Brown-out detector enabled on the Arduino. It is common to disable the brown-out detector to save power but these are the kind of symptoms the brown-out detector is designed to prevent. Odd lockup can frequently (but not always) come from voltage excursions out of spec. Basically the brown-out detector resets the microcontroller if the voltage drops below the brown-out level. Worth testing it is not currently enabled. No pun intended. </div><div><br></div><div>Shane</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 23, 2017 at 9:23 AM John Vaughters via TriEmbed <<a href="mailto:triembed@triembed.org">triembed@triembed.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_msg"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12px" class="gmail_msg"><div id="m_-496342455901314203yiv2044140087" class="gmail_msg"><div id="m_-496342455901314203yui_3_16_0_ym19_1_1485180850469_3549" class="gmail_msg"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12px" id="m_-496342455901314203yui_3_16_0_ym19_1_1485180850469_3548" class="gmail_msg"><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" class="gmail_msg"><span class="gmail_msg">Chip,</span></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" class="gmail_msg"><span class="gmail_msg"><br clear="none" class="gmail_msg"></span></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg">If the symptom is at regular intervals, whether they are regular events, or regular in time, I would consider a memory leak. I do not no have recommendations on how to check that, but I did a quick search and it appears there are some suggestions. I have never search for a memory leak in an Arduino before, but I am just throwing out an idea based on what appears to be regular intervals and a lock up condition. </div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg"><br class="gmail_msg"></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg">If you want to create a cheap reboot device, consider an ATTINY to wake up the device and look for a Digital IO to come on and off during a certain period of time, and if not cycle power. I know this just more power to Engineer which is a major negative for your product. Another option is a low cost, low power 555 timer set to trigger every so many hours or days, whatever you need. I am not sure which idea would give you the best power solution.</div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg"><br class="gmail_msg"></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg">Just throwing out ideas.</div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg"><br class="gmail_msg"></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg">Good Luck,</div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg"><br class="gmail_msg"></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg">John Vaughters</div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg"><br class="gmail_msg"></div><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr" class="gmail_msg"><br class="gmail_msg"></div> <div class="m_-496342455901314203yiv2044140087qtdSeparateBR gmail_msg" id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179920"><br clear="none" class="gmail_msg"><br clear="none" class="gmail_msg"></div></div></div></div></div></div><div class="gmail_msg"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12px" class="gmail_msg"><div class="m_-496342455901314203.yiv2044140087yahoo_quoted gmail_msg"> <div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179915" style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12px" class="gmail_msg"> <div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179914" style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px" class="gmail_msg"> <div class="m_-496342455901314203qtdSeparateBR gmail_msg"><br class="gmail_msg"><br class="gmail_msg"></div><div class="m_-496342455901314203yiv2044140087yqt2648336597 gmail_msg" id="m_-496342455901314203yiv2044140087yqt31766"><div dir="ltr" id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179919" class="gmail_msg"><font id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179918" size="2" face="Arial" class="gmail_msg"> On Sunday, January 22, 2017 3:37 PM, Chip McClelland via TriEmbed <<a href="mailto:triembed@triembed.org" class="gmail_msg" target="_blank">triembed@triembed.org</a>> wrote:<br clear="none" class="gmail_msg"></font></div>  <br clear="none" class="gmail_msg"><br clear="none" class="gmail_msg"> <div class="m_-496342455901314203yiv2044140087y_msg_container gmail_msg" id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179913"><div id="m_-496342455901314203yiv2044140087" class="gmail_msg"><div id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179912" class="gmail_msg">All, <div class="m_-496342455901314203yiv2044140087 gmail_msg" id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179917"><br clear="none" class="m_-496342455901314203yiv2044140087 gmail_msg"></div><div class="m_-496342455901314203yiv2044140087 gmail_msg" id="m_-496342455901314203yiv2044140087yui_3_16_0_ym19_1_1484938829374_179911">I have been installing trail counters at Umstead park for some time.  This has been an ideal situation as I often run or ride in the park and it allows me to keep an eye on things.  For some time now, I have been working to improve the reliability of my counters and I feel like I have hit a wall.  I am writing you all not in the hope that you can find the source of my issue but to offer suggestions on approaches I could use to better isolate what the root cause might be.  </div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><br clear="none" class="m_-496342455901314203yiv2044140087 gmail_msg"></div><div class="m_-496342455901314203yiv2044140087 gmail_msg">Background and what I know thus far:</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>- My sensor has two micro controllers (Arduino and Simblee) that share an i2c bus.  As they are both masters, I have a scheme to allow one or the other to take control.  I mention this because it may be the source of my issue.  More on how I architected this <a rel="nofollow" shape="rect" class="m_-496342455901314203yiv2044140087 gmail_msg" href="https://www.hackster.io/chipmc/arduino-i2c-multi-master-approach-why-and-how-93f638?ref=user&ref_id=6903&offset=0" target="_blank">here</a>   </div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">      </span>- The Arduino manages the sensor and the Simblee manages communications using Bluetooth LE.  </div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">       </span>- I have tested the software extensively and have a test rig that can test the full functionality of the system to randomly timed “events”.  I can only occasionally get the error condition with this approach typically requiring over 100,000 “events” before it happens.  Because of the timing in the system, this requires testing the systems continuously for days on end.  In the parks, the sensors typically run 25-30 days before they lock up during which time they will log around 30,000 “events”.</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">    </span>- When I do get the system to lock up, his is what I see:</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">            </span>- The Arduino is the one that is locked up not the Simblee</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">           </span>- When the Arduino locks up, the Simblee is unable to take control of the i2c bus</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">            </span>- The Arduino is in the “sleep” state and will not wake up - with the pin change interrupt set and <u class="m_-496342455901314203yiv2044140087 gmail_msg">even if I manually bring the interrupt pin low</u></div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">              </span>- The Arduino will not reset <u class="m_-496342455901314203yiv2044140087 gmail_msg">even if I manually bring the reset pin low</u> - this is odd and what I have come to call the "fugue state".</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">            </span>- The Simblee will be visible on Bluetooth LE but will lock up when I attempt to connect and it tries to read the i2c bus (I do not have a timeout on taking the bus)</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><span class="m_-496342455901314203yiv2044140087Apple-tab-span gmail_msg" style="white-space:pre-wrap">                </span>- The only way to recover is to power cycle the device</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><br clear="none" class="m_-496342455901314203yiv2044140087 gmail_msg"></div><div class="m_-496342455901314203yiv2044140087 gmail_msg">I am not sure how to best proceed.  I could spend more time / effort trying to figure out what the root cause is OR I could design an external watchdog that would simply recognize a lock up and reset the power.  In my application, the cost of a reset every 20-30 days is acceptable but, part of me says that is the easy way out.  </div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><br clear="none" class="m_-496342455901314203yiv2044140087 gmail_msg"></div><div class="m_-496342455901314203yiv2044140087 gmail_msg">So, I am open to any suggestions you might have even if they are the “have you checked to see if it is plugged in” variety.  If you want to see the code, it is in two parts: <a rel="nofollow" shape="rect" class="m_-496342455901314203yiv2044140087 gmail_msg" href="https://github.com/chipmc/Connected-Logger-Arduino" target="_blank">Arduino</a> and <a rel="nofollow" shape="rect" class="m_-496342455901314203yiv2044140087 gmail_msg" href="https://github.com/chipmc/Trail-Counter-Simblee" target="_blank">Simblee</a>   Any input is appreciated.</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><br clear="none" class="m_-496342455901314203yiv2044140087 gmail_msg"></div><div class="m_-496342455901314203yiv2044140087 gmail_msg">Thanks,</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"><br clear="none" class="m_-496342455901314203yiv2044140087 gmail_msg"></div><div class="m_-496342455901314203yiv2044140087 gmail_msg">Chip</div><div class="m_-496342455901314203yiv2044140087 gmail_msg"> </div></div></div><br clear="none" class="gmail_msg">_______________________________________________<br clear="none" class="gmail_msg">Triangle, NC Embedded Computing mailing list<br clear="none" class="gmail_msg"><a rel="nofollow" shape="rect" href="mailto:TriEmbed@triembed.org" class="gmail_msg" target="_blank">TriEmbed@triembed.org</a><br clear="none" class="gmail_msg"><a rel="nofollow" shape="rect" href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" class="gmail_msg" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br clear="none" class="gmail_msg">TriEmbed web site: <a rel="nofollow" shape="rect" href="http://triembed.org/" class="gmail_msg" target="_blank">http://TriEmbed.org</a><br clear="none" class="gmail_msg"><br clear="none" class="gmail_msg"><br clear="none" class="gmail_msg"></div></div>  </div> </div>  </div></div></div>_______________________________________________<br class="gmail_msg">
Triangle, NC Embedded Computing mailing list<br class="gmail_msg">
<a href="mailto:TriEmbed@triembed.org" class="gmail_msg" target="_blank">TriEmbed@triembed.org</a><br class="gmail_msg">
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" rel="noreferrer" class="gmail_msg" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br class="gmail_msg">
TriEmbed web site: <a href="http://TriEmbed.org" rel="noreferrer" class="gmail_msg" target="_blank">http://TriEmbed.org</a><br class="gmail_msg">
</blockquote></div>