<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="yui_3_16_0_ym19_1_1488993895642_378319"><span>Chip,</span></div><div id="yui_3_16_0_ym19_1_1488993895642_378319"><span><br></span></div><div id="yui_3_16_0_ym19_1_1488993895642_378319" dir="ltr"><span id="yui_3_16_0_ym19_1_1488993895642_378656">Tough problem, Thanks for the feedback. I have been curious if you solved it. Interesting specifics on the boards.</span></div><div id="yui_3_16_0_ym19_1_1488993895642_378319" dir="ltr"><span><br></span></div><div id="yui_3_16_0_ym19_1_1488993895642_378319" dir="ltr"><span id="yui_3_16_0_ym19_1_1488993895642_378695">So you have a watchdog workaround which is a common fix for tough issues like this. The actual lock up could still be a tough one to solve, I wish you luck on that task. Could be power and/or timing issues from wake up.</span></div><div id="yui_3_16_0_ym19_1_1488993895642_378319" dir="ltr"><span><br></span></div><div id="yui_3_16_0_ym19_1_1488993895642_378319" dir="ltr">John Vaughters</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Tuesday, March 14, 2017 10:02 PM, Chip McClelland via TriEmbed <triembed@triembed.org> wrote:<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv5874260457"><div>All, <div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457">For those who missed it, I sent a note about a month ago asking for advice on improving the reliability of my sensors.  These sensors would go weeks and measure tens of thousands of cars and then lock up.  I was struggling to fix a problem I could not easily reproduce so I asked this group for ideas.   </div><div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457">Thank you for all the great advice it has been very helpful.  I think I have made significant progress in my testing and, this week, I have deployed the updates to the sensors in the park.  Given that many of you took the time to give me your thoughts, I wanted to share what I have learned.</div><div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457"><span class="yiv5874260457Apple-tab-span" style="white-space:pre;">       </span>1) A few of you suggested making the problem worse to help improve the reproducibility of the issue - that was key.  I was eventually able to get the issue to surface in under ten minutes which helped me test potential fixes.</div><div class="yiv5874260457"><span class="yiv5874260457Apple-tab-span" style="white-space:pre;"> </span>2) My problem seemed to be related to the Arduino’s ability to wake from sleep and reliably access data on the i2c bus.  I was able to find the specific function and eventually the  i2c command - t = RTC.get(); that would lock up the i2c bus and the Arduino.  The incidence of this issue was increased significantly when the Arduino was recently brought back from sleep.</div><div class="yiv5874260457"><span class="yiv5874260457Apple-tab-span" style="white-space:pre;">    </span>3) The solution was to start a watchdog timer prior to using this command and set up the Arduino to reboot if it did not complete in a reasonable period.  Worked fine on the Uno but this locked up the Arduino Pro Mini.  It seemed that the Pro mini does not use an Optiboot boot loader like the Uno and there is a <a rel="nofollow" target="_blank" href="https://forum.arduino.cc/index.php?topic=435172.0" class="yiv5874260457">known bug</a> that prevents the watchdog timer from functioning correctly.  I found a new boot loader - <a rel="nofollow" target="_blank" href="https://github.com/MCUdude/MiniCore" class="yiv5874260457">MiniCore</a> that fixed the issue and delivered on some cool new features.</div><div class="yiv5874260457"><span class="yiv5874260457Apple-tab-span" style="white-space:pre;">     </span>4) The problem was that I have a number of boards in production which do not have ICSP headers.  I was able to find a <a rel="nofollow" target="_blank" href="https://www.amazon.com/gp/product/B00V2W467I/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1" class="yiv5874260457"></a><a rel="nofollow" target="_blank" href="https://www.amazon.com/gp/product/B00V2W467I/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1" class="yiv5874260457">great adapte</a>r  that let me refresh the chips in place - highly recommended.   </div><div class="yiv5874260457"><span class="yiv5874260457Apple-tab-span" style="white-space:pre;">     </span>5) Changing the boot loader also changed my tool chain and I ended up asking the <a rel="nofollow" target="_blank" href="https://embedxcode.freshdesk.com/support/tickets/660" class="yiv5874260457">embedXcode folks for help</a> and they delivered a new release that let me integrate the new boot loader with the board definition files.  If you are a Mac user and want a better IDE, I can highly recommend <a rel="nofollow" target="_blank" href="http://embedxcode.weebly.com/" class="yiv5874260457">embedXcode</a>.</div><div class="yiv5874260457">  </div><div class="yiv5874260457">With these changes and some improvements to the process of waking from sleep from Nick Gammon and the <a rel="nofollow" target="_blank" href="http://forum.arduino.cc/index.php?topic=336789.0" class="yiv5874260457">Arduino forums,</a> I was able to put the device through significant</div><div class="yiv5874260457">testing without any lock ups.  I added a “reboot” counter to EEPROM so I can see if more changes are needed in the future.  I just finished updating all the sensors in the park and will see how the real world reacts to my efforts. </div><div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457">I hope there are some ideas in here that might be helpful.  Please let me know if you have more suggestions.  I will also be looking at my power and signal integrity on the boards but, for now, I think I have a solution.  If you would like to see what the code looks like, you can find it <a rel="nofollow" target="_blank" href="https://github.com/chipmc/Logger-Arduino-PIR" class="yiv5874260457">here</a>.  Thanks again for all your suggestions.</div><div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457">Chip</div><div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457"><br class="yiv5874260457"></div><div class="yiv5874260457"><br class="yiv5874260457"></div></div></div><br>_______________________________________________<br>Triangle, NC Embedded Computing mailing list<br><a ymailto="mailto:TriEmbed@triembed.org" href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br><a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>TriEmbed web site: <a href="http://triembed.org/" target="_blank">http://TriEmbed.org</a><br><br><br></div>  </div> </div>  </div></div></body></html>