Hi,
I am using the TMS 570 0332, CCS6.1 and halcogen 4.2.
I am trying to set up a Q and A wdog with the TPS chip.
I am able to initialize the TPS and set it to stay in the diagnostic mode. However, when I re-initialize it so that the wdog starts, I am getting a reset entry somewhere in TPS_DriverInit(). I know I can communicate with the TPS chip and that the function works because it works the first time, sees the TPS chip is in the diagnostic state and returns from the function.
I am trying to follow the flow from a combination of the safeTI example and the example from spna176a, but there are two main differences, I stripped out all the diagnostic stuff for now, and I am trying to run it from a task instead of using rti.
The line I am getting the reset entry on is in tpsWdgTask, TPS_DriverInit(&initstruct). I tried stepping through the source, and I get the reset error on the following line from Tps_Driver.c
while (TPS_DEVICE_DIAGNOSTIC != u8tps_device_state) { blRetVal = TPS_GetCurrentTPSDeviceState(&u8tps_device_state); }
My code:
bool tpsInit() { bool noErr = FALSE; TPS_Initilization_struct initstruct; /*initialize TPS driver*/ initstruct.AMUXVoltageRailLimits = TPS65381Q_VoltageLimits; initstruct.GetTPSDiagPinSampledValue = NULL; initstruct.blNRES_Monitoring = TRUE; initstruct.blbist_at_startup = TRUE; initstruct.blenable_drv_op = TRUE; initstruct.blerror_pin_monitoring = FALSE; initstruct.blignition_power_latch = FALSE; initstruct.blsafe_state_timeout = TRUE; initstruct.dev_configreg_settings.blMASK_VBAT_OV = TRUE; initstruct.dev_configreg_settings.blMASK_VDD1_UV = TRUE; initstruct.dev_configreg_settings.blPOST_RUN_RST = TRUE; initstruct.dev_configreg_settings.blVDD3_5_OT = TRUE; initstruct.dev_configreg_settings.blVDD5_OT = TRUE; initstruct.error_pin_monitoring_mode = ERROR_PIN_MODE; initstruct.error_pin_pwm_width.u8PWM_HIGH = 8; /* the min error pin low duration in 204.8 us*/ initstruct.error_pin_pwm_width.u8PWM_LOW = 40; initstruct.send_recieve_data_TPS = sendAndReceiveDataTPS; initstruct.u8pwd_threshhold_value = 5; initstruct.u8safe_lock_threshhold = 5; /* timeout duration in 198 ns*/ initstruct.u8safe_state_timeout_scaler = 4; ulTPSTaskCheck[2] = OPEN_WINDOW_CONFIG/2; ulTPSTaskCheck[3] = OPEN_WINDOW_CONFIG/2+CLOSE_WINDOW_CONFIG/3; noErr = TPS_DriverInit(&initstruct); if (noErr == TRUE) { noErr = TPS_SetMCUSoftwareDebugMode(); } asm (" b #-8"); return noErr; } void tpsWdgTask(void *params) { volatile unsigned portLONG *pulTaskCheckVariable; uint8_t wdgFailCount; bool noErr = FALSE; /* The variable this task increments to show it is still running is passed in as the parameter. */ pulTaskCheckVariable = ( unsigned portLONG * )params; TPS_WatchdoConfiguration watchdogconfig; noErr = TPS_DriverInit(&initstruct); if (noErr) { /*Initialize watchdog and open a new sequence run*/ watchdogconfig.u8TokenFDBK = 0; watchdogconfig.u8TokenSeed = 0; watchdogconfig.blwatchdog_reset = TRUE; /* approx 40ms*/ watchdogconfig.u8open_windowtime_scaler = (uint8) (OPEN_WINDOW_CONFIG / 0.55 - 1); /*approx 15 ms*/ watchdogconfig.u8close_windowtime_scaler = (uint8) (CLOSE_WINDOW_CONFIG / 0.55 - 1); watchdogconfig.watchdog_mode = QANDA_MODE; noErr = TPS_WatchdogInit(&watchdogconfig); } if(noErr == FALSE) { //TODO handle the problem } ( void ) params; while(1) { ( *pulTaskCheckVariable )++; noErr = TPS_GetWatchdogFailCount(&wdgFailCount); if(wdgFailCount == 0) { switch (*(pulTaskCheckVariable+1)) { case 0: { if(TPS_ConfigureWatchdogReset(TRUE)) { (*(pulTaskCheckVariable+1))++; } TPS_ProtectConfigurationRegisters(LOCK); } break; case 1: { if(TPS_ExitDiagnosticMode()) { (*(pulTaskCheckVariable+1))++; } } break; default: { //Don't do anything here } break; } } TPS_UpdateActiveWDToken(); TPS_SendWdgResponse(WD_TOKEN_RESP3); TPS_SendWdgResponse(WD_TOKEN_RESP2); TPS_SendWdgResponse(WD_TOKEN_RESP1); delay(*(pulTaskCheckVariable+3)); TPS_SendWdgResponse(WD_TOKEN_RESP0); delay(*(pulTaskCheckVariable+2)); } }