Sfoglia il codice sorgente

Main file and Configuration update for WWDT

namrota ghosh 7 mesi fa
parent
commit
23b7c73dc3
2 ha cambiato i file con 10 aggiunte e 27 eliminazioni
  1. 6 22
      main.c
  2. 4 5
      main.syscfg

+ 6 - 22
main.c

@@ -1,6 +1,7 @@
 
 //#include "ti/driverlib/dl_timer.h"
 //#include "ti/driverlib/dl_wwdt.h"
+#include "ti/driverlib/dl_wwdt.h"
 #include "ti/driverlib/m0p/dl_core.h"
 #include "ti_msp_dl_config.h"
 #include "src/pi/i2c_pi_target.h"
@@ -82,35 +83,18 @@ void I2C_0_INST_IRQHandler(void)
             break;
     }
 }
-/*Timer feeds the WWDT. the initialization of the Timer is done in the config.h file
-Timer is configured to reset the watchdog timer periodically.
-LFCLK is sourced from the internal low frequency oscilloscope. 
-The device remains in STANDBY mode while waiting for an interrupt
-*/
-//interrupt added for Windows Watchdog Timer:
-void TIMER_0_INST_IRQHandler(void)
-{
-    switch (DL_TimerG_getPendingInterrupt(TIMER_0_INST)) {
-        case DL_TIMER_IIDX_ZERO:
-            if (DL_WWDT_getPendingInterrupt(WWDT0)) {
-                //Restart the WWDT peripheral:
-                DL_WWDT_restart(WWDT0);
-                //Set the flag to True
-                watchdog_triggered= true;
-            }
-        default:
-            break;
-    }
-}
+
 
 int main(void)
 {  
     SYSCFG_DL_init();
+    // initialize watchdog timer configuration
+    SYSCFG_DL_WWDT0_init();
+    // Enable WWDT after initialization:
+    DL_WWDT_enablePower(WWDT0);
     Battery_Init();
     //dynamic addressing function call for Pi
     dynamic_gpio_addressing();
-    /* Enable WWDT interrupts on device */
-    NVIC_EnableIRQ(WWDT0_INT_IRQN);
     //Interrupt routine for Pi
     NVIC_EnableIRQ(I2C_0_INST_INT_IRQN);
     //Interrupt for target mcu

+ 4 - 5
main.syscfg

@@ -90,10 +90,10 @@ PWM1.PWM_CHANNEL_0.$name        = "ti_driverlib_pwm_PWMTimerCC0";
 PWM1.PWM_CHANNEL_0.invert       = true;
 PWM1.ccp0PinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric4";
 
-SYSCTL.forceDefaultClkConfig = true;
-SYSCTL.validateClkStatus     = true;
 SYSCTL.clockTreeEn           = true;
 SYSCTL.powerPolicy           = "STANDBY0";
+SYSCTL.forceDefaultClkConfig = true;
+SYSCTL.validateClkStatus     = true;
 
 TIMER1.$name              = "TIMER_0";
 TIMER1.timerClkSrc        = "LFCLK";
@@ -103,9 +103,8 @@ TIMER1.timerPeriod        = "300 ms";
 TIMER1.interrupts         = ["ZERO"];
 TIMER1.peripheral.$assign = "TIMG0";
 
-WWDT1.$name               = "WWDT0";
-WWDT1.sleepMode           = true;
-WWDT1.window0ClosedPeriod = "25";
+WWDT1.$name     = "WWDT0";
+WWDT1.sleepMode = true;
 
 ProjectConfig.migrationCondition = true;