<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px"><div id="yiv2044140087"><div id="yui_3_16_0_ym19_1_1485180850469_3549"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px;" id="yui_3_16_0_ym19_1_1485180850469_3548"><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891"><span>Chip,</span></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891"><span><br clear="none"></span></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr">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="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr"><br></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr">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="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr"><br></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr">Just throwing out ideas.</div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr"><br></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr">Good Luck,</div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr"><br></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr">John Vaughters</div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr"><br></div><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179891" dir="ltr"><br></div> <div class="yiv2044140087qtdSeparateBR" id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179920"><br clear="none"><br clear="none"></div></div></div></div><div class=".yiv2044140087yahoo_quoted"> <div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179915" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px;"> <div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179914" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div class="qtdSeparateBR"><br><br></div><div class="yiv2044140087yqt2648336597" id="yiv2044140087yqt31766"><div dir="ltr" id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179919"><font id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179918" size="2" face="Arial"> On Sunday, January 22, 2017 3:37 PM, Chip McClelland via TriEmbed <triembed@triembed.org> wrote:<br clear="none"></font></div>  <br clear="none"><br clear="none"> <div class="yiv2044140087y_msg_container" id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179913"><div id="yiv2044140087"><div id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179912">All, <div class="yiv2044140087" id="yiv2044140087yui_3_16_0_ym19_1_1484938829374_179917"><br clear="none" class="yiv2044140087"></div><div class="yiv2044140087" id="yiv2044140087yui_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="yiv2044140087"><br clear="none" class="yiv2044140087"></div><div class="yiv2044140087">Background and what I know thus far:</div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">     </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="yiv2044140087" target="_blank" href="https://www.hackster.io/chipmc/arduino-i2c-multi-master-approach-why-and-how-93f638?ref=user&ref_id=6903&offset=0">here</a>   </div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">       </span>- The Arduino manages the sensor and the Simblee manages communications using Bluetooth LE.  </div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">     </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="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">  </span>- When I do get the system to lock up, his is what I see:</div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">              </span>- The Arduino is the one that is locked up not the Simblee</div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">             </span>- When the Arduino locks up, the Simblee is unable to take control of the i2c bus</div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">              </span>- The Arduino is in the “sleep” state and will not wake up - with the pin change interrupt set and <u class="yiv2044140087">even if I manually bring the interrupt pin low</u></div><div class="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">               </span>- The Arduino will not reset <u class="yiv2044140087">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="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">             </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="yiv2044140087"><span class="yiv2044140087Apple-tab-span" style="white-space:pre;">          </span>- The only way to recover is to power cycle the device</div><div class="yiv2044140087"><br clear="none" class="yiv2044140087"></div><div class="yiv2044140087">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="yiv2044140087"><br clear="none" class="yiv2044140087"></div><div class="yiv2044140087">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="yiv2044140087" target="_blank" href="https://github.com/chipmc/Connected-Logger-Arduino">Arduino</a> and <a rel="nofollow" shape="rect" class="yiv2044140087" target="_blank" href="https://github.com/chipmc/Trail-Counter-Simblee">Simblee</a>   Any input is appreciated.</div><div class="yiv2044140087"><br clear="none" class="yiv2044140087"></div><div class="yiv2044140087">Thanks,</div><div class="yiv2044140087"><br clear="none" class="yiv2044140087"></div><div class="yiv2044140087">Chip</div><div class="yiv2044140087"> </div></div></div><br clear="none">_______________________________________________<br clear="none">Triangle, NC Embedded Computing mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:TriEmbed@triembed.org" target="_blank" href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br clear="none">TriEmbed web site: <a rel="nofollow" shape="rect" target="_blank" href="http://triembed.org/">http://TriEmbed.org</a><br clear="none"><br clear="none"><br clear="none"></div></div>  </div> </div>  </div></div></body></html>