chipKIT® Development Platform

Inspired by Arduino™

Watchdog implementation

Created Tue, 05 Aug 2014 11:02:59 +0000 by tcsaba101


tcsaba101

Tue, 05 Aug 2014 11:02:59 +0000

After I have killed 2 pcs of INA219 sensors and my uC32 board, due to a silly grounding fault, my system works again flawless. No I2C stucks, no lost connection between REALICE and MPLABX.

I don't know why, but I thought notebooks are NOT grounded. But yes, the adapter's minus terminal connected to mains ground. Three notebooks are connetcted to the system, datalogger, display, development system. All was grounded and connected through USB connections. The problems has started after I connected the development system. With 2 notebooks grounding loop it was working without major problems. I have struggled 2 weeks, the system was breaked down in a stochastic behavior time to time, mainly when there was running 10 Amp though the INA sensor's shunt.

At the beginning it made only stucks on the i2c bus. I haven't get the message at the first INA death. Only when the uC32 card's PIC32chip has gone to 100 °C and obviously breaked down. Then I started to think and look for the cause......

Now I operate 1 notebook from ungrounded mains(like from battery), one trough USB isolator (the others don't work this way) and one is grounding the whole system. I have learned again..

To improve my system security I would like to implement the watchdog function. I couldn't find the obvioulsly right way on chipKIT Uno32, uC32, WF32 boards. Please advise what to do?

  1. Enabling WDT: set the WDTCON bit15 to 1.
  2. The watchdog will reset in 1.024 ms if the timer not cleared.
  3. Should I clear the counter by the WDTCON bit0 writing 1 (WDTCLEAR)? Or something else?
  4. Should it work with the original bootloader or need a modified one?
  5. All the boards works in the same way?

I would appreciate a short code help!

Thanks!


majenko

Tue, 05 Aug 2014 22:08:51 +0000

All you need is here: [url]https://github.com/majenkotech/Watchdog[/url]

Use it as a library, or just rip it apart to get the bits you need from it ;)


tcsaba101

Wed, 06 Aug 2014 05:28:45 +0000

Many thanks.