|
@@ -1,4 +1,6 @@
|
|
|
-#include "ti/driverlib/dl_wwdt.h"
|
|
|
|
|
|
|
+
|
|
|
|
|
+//#include "ti/driverlib/dl_timer.h"
|
|
|
|
|
+//#include "ti/driverlib/dl_wwdt.h"
|
|
|
#include "ti/driverlib/m0p/dl_core.h"
|
|
#include "ti/driverlib/m0p/dl_core.h"
|
|
|
#include "ti_msp_dl_config.h"
|
|
#include "ti_msp_dl_config.h"
|
|
|
#include "src/pi/i2c_pi_target.h"
|
|
#include "src/pi/i2c_pi_target.h"
|
|
@@ -82,18 +84,15 @@ void I2C_0_INST_IRQHandler(void)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//interrupt added for Windows Watchdog Timer:
|
|
//interrupt added for Windows Watchdog Timer:
|
|
|
-void GROUP0_IRQHandler(void)
|
|
|
|
|
|
|
+void TIMER_0_INST_IRQHandler(void)
|
|
|
{
|
|
{
|
|
|
- switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_0)) {
|
|
|
|
|
- case DL_INTERRUPT_GROUP0_IIDX_WWDT0:
|
|
|
|
|
|
|
+ switch (DL_TimerG_getPendingInterrupt(TIMER_0_INST)) {
|
|
|
|
|
+ case DL_TIMER_IIDX_ZERO:
|
|
|
if (DL_WWDT_getPendingInterrupt(WWDT0)) {
|
|
if (DL_WWDT_getPendingInterrupt(WWDT0)) {
|
|
|
- //Clears the interrupt
|
|
|
|
|
- DL_WWDT_clearInterruptStatus(WWDT0);
|
|
|
|
|
- //Resets the timer:
|
|
|
|
|
- DL_WWDT_reset(WWDT0);
|
|
|
|
|
|
|
+ //Restart the WWDT peripheral:
|
|
|
|
|
+ DL_WWDT_restart(WWDT0);
|
|
|
//Set the flag to True
|
|
//Set the flag to True
|
|
|
watchdog_triggered= true;
|
|
watchdog_triggered= true;
|
|
|
- //how to handle in the case of failure?
|
|
|
|
|
}
|
|
}
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
@@ -112,21 +111,20 @@ int main(void)
|
|
|
NVIC_EnableIRQ(I2C_0_INST_INT_IRQN);
|
|
NVIC_EnableIRQ(I2C_0_INST_INT_IRQN);
|
|
|
//Interrupt for target mcu
|
|
//Interrupt for target mcu
|
|
|
NVIC_EnableIRQ(I2C_1_INST_INT_IRQN);
|
|
NVIC_EnableIRQ(I2C_1_INST_INT_IRQN);
|
|
|
- //DL_GPIO_setPins(GPIO_Battery_Discharging_PORT, GPIO_Battery_Discharging_PIN_PB7_PIN);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Configures timer to be halted if CPU is halted. This ensures
|
|
|
|
|
+ * that timer is always aligned with the WWDT so it is never serviced
|
|
|
|
|
+ * too late or too early.
|
|
|
|
|
+ */
|
|
|
|
|
+ DL_Timer_setCoreHaltBehavior(TIMER_0_INST, DL_TIMER_CORE_HALT_IMMEDIATE);
|
|
|
|
|
+
|
|
|
|
|
+ /* Start TimerG counter */
|
|
|
|
|
+ DL_TimerG_startCounter(TIMER_0_INST);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
while(1)
|
|
while(1)
|
|
|
{
|
|
{
|
|
|
- if(watchdog_triggered){
|
|
|
|
|
- printf("ERROR: ***WATCHDOG TRIGGERED***\n");
|
|
|
|
|
- //Resetting the flags to its original state
|
|
|
|
|
- picommandPending= false;
|
|
|
|
|
- mcuSendCommand= false;
|
|
|
|
|
- watchdog_triggered= false;
|
|
|
|
|
- //Reinitialize the system
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if(picommandPending)
|
|
if(picommandPending)
|
|
|
{ printf("Pi Interrupt Triggered.\n");
|
|
{ printf("Pi Interrupt Triggered.\n");
|
|
|
pi_i2c_mcu();
|
|
pi_i2c_mcu();
|