Jump to content
43oh

Recommended Posts

I was able to get it working using the functions from the original Stellarisware driver.

#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/sysctl.h"
#include "driverlib/eeprom.h"
#include "driverlib/watchdog.h"
#include "driverlib/interrupt.h"

void setup()
{}

void loop()
{
  //Watchdog Stuff
  SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);
  SysCtlPeripheralReset(SYSCTL_PERIPH_WDOG0);

  if(WatchdogLockState(WATCHDOG0_BASE) == true)
  {
    WatchdogUnlock(WATCHDOG0_BASE);
  }

  WatchdogReloadSet(WATCHDOG0_BASE, ROM_SysCtlClockGet());
  WatchdogResetEnable(WATCHDOG0_BASE);
  WatchdogEnable(WATCHDOG0_BASE);
  //IntMasterEnable();
  //IntEnable(INT_WATCHDOG);

  while(1)
  {
    WatchdogIntClear(WATCHDOG0_BASE);
    //do stuff
  }
}

My only remaining problem is that I need to know when the watchdog triggered a reset. There must be some way to read the Reset Source at startup but I couldn't find anything on that :/

 

Alternatively I could use the Watchdog ISR, but as far as I understand it, it has to be defined in the vector table in "startup_gcc.c" and implemented in "WInterrupts.c". But these files are compiled at startup of Energia (I'm running on the latest git version), so I've got no way to pass variables between it and my main file :?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...