Tool/software:
Hello everyone,
I'm trying to test external watchdog by using GPIO API on TDA4.
Here's the relevant code which I based off of the code I've seen in other thread here on the forum:
#define PADCONFIG_34 0x0011C088 #define WKUP_PADCONFIG_23 0x4301C05C #define WKUP_PADCONFIG_41 0x4301C0A4 #define MCU_WDT_WDI_PIN (38U) #define MCU_WDT_WDO_PIN (34U) #define SYS_MCU_PWRDN_PIN (55U) static void watchdog_isr(void) { App_ConsolePrintf("Watchdog triggered!\n"); // Make rising edge on SYS_MCU_PWRDN pin GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, SYS_MCU_PWRDN_PIN, GPIO_PIN_LOW); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, SYS_MCU_PWRDN_PIN, GPIO_PIN_HIGH); } GPIO_PinConfig gpioPinConfigs[] = { GPIO_DEVICE_CONFIG(0, MCU_WDT_WDO_PIN) | GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT, GPIO_DEVICE_CONFIG(0, MCU_WDT_WDI_PIN) | GPIO_CFG_OUTPUT, GPIO_DEVICE_CONFIG(0, SYS_MCU_PWRDN_PIN) | GPIO_CFG_OUTPUT }; GPIO_CallbackFxn callbacks[] = { watchdog_isr, NULL, NULL }; GPIO_v0_Config GPIO_v0_config = { gpioPinConfigs, callbacks, sizeof(gpioPinConfigs) / sizeof(gpioPinConfigs[0]), sizeof(callbacks) / sizeof(callbacks[0]), ~0 }; void AppGPIOPadConfig() { *(uint32_t*)PADCONFIG_34 = 0x00060007; *(uint32_t*)WKUP_PADCONFIG_23 = 0x00010007; *(uint32_t*)WKUP_PADCONFIG_41 = 0x00010007; } /////////////////////////////////////////////////////////// GPIO_v0_HwAttrs gpio_cfg; GPIO_socGetInitCfg(0, &gpio_cfg); gpio_cfg.baseAddr = CSL_WKUP_GPIO0_BASE; (gpio_cfg.intCfg[0]).intcMuxNum = INVALID_INTC_MUX_NUM; (gpio_cfg.intCfg[0]).intcMuxInEvent = 0; (gpio_cfg.intCfg[0]).intcMuxOutEvent = 0; GPIO_socSetInitCfg(0, &gpio_cfg); GPIO_init(); //GPIO_setCallback(0, watchdog_isr); GPIO_enableInt(0); AppGPIOPadConfig(); GPIOSetDirMode_v0(CSL_WKUP_GPIO0_BASE, MCU_WDT_WDI_PIN, GPIO_DIRECTION_OUTPUT); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, MCU_WDT_WDI_PIN, GPIO_PIN_HIGH); //GPIOSetDirMode_v0(CSL_WKUP_GPIO0_BASE, MCU_WDT_WDO_PIN, GPIO_DIRECTION_INPUT); GPIOSetDirMode_v0(CSL_WKUP_GPIO0_BASE, SYS_MCU_PWRDN_PIN, GPIO_DIRECTION_OUTPUT); // Attempt to activate callback manually GPIO_toggle(0); Osal_delay(20); GPIO_toggle(0); for (uint32_t i = 0; i < 20; i++) { App_ConsolePrintf("\nNotifying watchdog...\n"); // Make a falling edge on WDI and assert it back GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, MCU_WDT_WDI_PIN, GPIO_PIN_LOW); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, MCU_WDT_WDI_PIN, GPIO_PIN_HIGH); Osal_delay(1000); } App_ConsolePrintf("\nStopped notifications. Waiting for watchog to trigger.\n"); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, SYS_MCU_PWRDN_PIN, GPIO_PIN_LOW); Osal_delay(50); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, SYS_MCU_PWRDN_PIN, GPIO_PIN_HIGH);
The issue is that watchdog_isr callback never gets called even when using GPIO_toggle to manually trigger it.
I also took a look at SYS_MCU_PWRD pin with oscilloscope and there weren't any changes.
Any help would be appreciated.