Jump to content

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 :?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×