ddodge
Junior Member

Posts: 75
|
Post by ddodge on Mar 5, 2019 12:35:12 GMT -8
SDL: I have the Watchdog Timer board: 100217-01-001 EL-1EP5-47YS. Per the documentation, this appears to be the latest version of the board. I am using it with OurWeather Arduino and V35 of the SW. The WatchDog board is connected to my Grove Digital Extender board, port D1 via a Grove connecter. I have a single wire from Dog1Out to pin RST of JP17 on the OurWeather Board My code is below. I just want to make sure this is wired correctly and if the value of “9” is correct for the “#define” statement. Thanks!
#define RESET_WATCHDOG1 9 // Is the “9” a correct value??? void ResetWatchdog1() { Serial.println("Watchdog1 about to Reset"); pinMode(RESET_WATCHDOG1, OUTPUT); delay(200); pinMode(RESET_WATCHDOG1, INPUT); Serial.println("Watchdog1 Reset"); } Then in the LOOP I have: ResetWatchdog1 ();
|
|
|
Post by SDL on Mar 6, 2019 5:58:46 GMT -8
The Grove Digital Extender board is programmed by using an I2C interface. You have to set the GPIOs on the extender board by using the I2C interface (see github.com/switchdoclabs/SDL_Arduino_GroveDigitalExtender ). You code is directly accessing GPIO 9, which is on the ESP8266 and not on the Grove GPIO Extender Board. So, no, the code will not work. Looks like you do have the Dog1Out wire to RST wired correctly. BP
|
|
ddodge
Junior Member

Posts: 75
|
Post by ddodge on Mar 6, 2019 7:19:41 GMT -8
Thanks. If I understand you correctly, since I have the WatchDog timer Grove wire connected to the Digital Extension Board, I need to define the proper PORT or Grove Connector on that board. I am choosing to use D1 port on the Digital Extension Board since my WatchDog timer documentation says to connect the Grove to a digital port. Here is my code if you wouldn't mind giving it a look-see. (I'm pretty novice at this...)
#include "SDL_Arduino_GroveDigitalExtender.h" // Include for the Digital Extender Board SDL_Arduino_GroveDigitalExtender GDE; // Reference Digital Extender using "GDE" #define RESET_WATCHDOG1 1 // "1" is the Grove Digital I/O port number on the board
// Routine to Pat the Dog void ResetWatchdog1() { Serial.println("Watchdog1 about to Reset"); // pinMode(RESET_WATCHDOG1, OUTPUT);
// Set Digital Extender Board Grove Port 1 to output mode GDE.setDirectionGPIOChannel(RESET_WATCHDOG1 , GroveDigitalExtender_OUTPUT); GDE.writeGPIO(RESET_WATCHDOG1 ,0x01); // Turn on the port delay(200); GDE.writeGPIO(RESET_WATCHDOG1 ,0x00); // Turn off the port GDE.setDirectionGPIOChannel(RESET_WATCHDOG1 , GroveDigitalExtender_INPUT); // pinMode(RESET_WATCHDOG1, INPUT); Serial.println("Watchdog1 Reset"); }
Then in the LOOP section I have: ResetWatchdog1 (); // Pat the Dog
|
|
|
Post by SDL on Mar 6, 2019 13:50:01 GMT -8
Now this looks pretty good! Make sure you visually see on the watchdog board that it is not triggering (to test your code).
John
|
|
ddodge
Junior Member

Posts: 75
|
Post by ddodge on Mar 7, 2019 6:14:50 GMT -8
Thanks John. The code compiled. I need to wait until my new FTDI board for OurWeather shows up. The USB connector loosened up and won't stay connected (and I am past 30 day return timeframe).
|
|
ddodge
Junior Member

Posts: 75
|
Post by ddodge on Mar 9, 2019 4:57:27 GMT -8
Good news. That new code compiled AND executed properly first time! Woo woo! I tested it by changing the timeout on the board and seeing with a 30 second timeout it would trigger a reset. I then placed several "pat the dog" statements in my code. Watching the WatcgDog timer board shows it was not triggering. I changed the WatchDog timeout to the full 240 seconds to allow time for the IDE to load new code. If the compile and download took too long, the WatchDog timer would throw a reset in the middle of a download.
|
|