Other Parts Discussed in Thread: SYSCONFIG
when integrated WDT in open window, code works fine. When 50% is used as window size, the code gets reset within just 2 lines of printing. It does not work as needed. How to properly configure window watchdog.
uint8_t adc_soc_continuous_main(void *args)
{
/* Open drivers to open the UART driver for console */
Drivers_open();
Board_driversOpen();
DebugP_log("ADC Soc Continuous Test Started\r\n");
ADC_forceMultipleSOC(gAdc1baseAddr, 0xFFFF);
gpio_init();
DebugP_log("ADC 1 channel 0 output:\r\n");
DebugP_log("outside ADC 1 channel 0 output:\r\n");
while(1)
{
Watchdog_clear(gWatchdogHandle[CONFIG_WDT0]);
while(false == ADC_getInterruptStatus(gAdc1baseAddr, ADC_INT_NUMBER2));
ADC_clearInterruptStatus(gAdc1baseAddr, ADC_INT_NUMBER2);
gAdc1Result0[0] = ADC_readResult(gAdc1resultBaseAddr,ADC_SOC_NUMBER0);
DebugP_log("register value = \t%d ",gAdc1Result0[0]);
result=gAdc1Result0[0];
voltage=(result/4096)*3.2;
DebugP_log("voltage =%f\r\n",voltage);
if(voltage>2.9 && voltage<3.2)
{
DebugP_log("voltage high =%f\r\n",voltage);
GPIO_pinWriteHigh(gpioBaseAddr, pinNum1);
Watchdog_clear(gWatchdogHandle[CONFIG_WDT0]);
}
else if(voltage>0 && voltage<0.9)
{
DebugP_log("voltage low =%f \r \n",voltage);
return power_err;
}
else
{
DebugP_log("Transition Happened - function calling");
}
}
This is a power monitoring code. I have integrated watchdog timer in it. On 100% window( open window) it works as I intended. On using other window size, the code gets reset fastly.