For software debug, I am using TPS_SetMCUSoftwareDebugMode function from sample code.
My question is when i need to exit from diag mode?
How to identity whether program is running without debugger (normal mode) or with debugger (to software debug)?
What changes i need to do to take care above conditions?
If i am not connecting debugger, device should not wait in diag mode and directly it has to continue with other task.
if ((E_OK == RetVal) && (TPS_DEVICE_DIAGNOSTIC == tps_device_state))
{
/*enable and mask the exit from the diagnostic mode*/
RetVal = CDD_PM_TPS_SetRegisterBitField(TPS_SAFETY_CHECK_CTRL,
CDD_PM_TPS_DIAG_EXIT_MASK_START, CDD_PM_TPS_DIAG_EXIT_MASK_LENGTH, 1U);
/*Disable the watchdog reset */
RetVal = CDD_PM_TPS_SetRegisterBitFieldVerify(TPS_SAFETY_FUNC_CFG,
CDD_PM_TPS_WD_RST_EN_START, CDD_PM_TPS_WD_RST_EN_LENGTH, 0U);
/*disable the error pin monitoring*/
/*disable the safe state timeout*/
RetVal = CDD_PM_TPS_SetRegisterBitFieldVerify(TPS_SAFETY_FUNC_CFG,
CDD_PM_TPS_NO_SAFE_TO_START, CDD_PM_TPS_NO_SAFE_TO_LENGTH, (uint8)0U);
RetVal = CDD_PM_TPS_SetRegisterBitField(TPS_SAFETY_CHECK_CTRL,
CDD_PM_TPS_NO_ERROR_START, CDD_PM_TPS_NO_ERROR_LENGTH, 0U);
}