This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TPS TMS570 Reset Loop

Other Parts Discussed in Thread: TMS570LS3137, HALCOGEN

Hello,

I am still trying to set up the TMS570 HSK and I am yet to get the ENDRV to stay high.

The error count in the TPS is constantly at 7 and it is forcing the device to reset making debugging difficult.

I am aware that an error count above 5 causes the ENDRV line to stay low.

This is the code I am trying to use to initialise the TPS and watchdog (taken from the TPSDriver-User'sGuide-v2.2.0.chm)

/* USER CODE BEGIN (0) */
#include "Tps_Driver.h"
/* USER CODE END */

/* Include Files */

#include "sys_common.h"

/* USER CODE BEGIN (1) */
#include "mibspi.h"
#include "adc.h"
#include "rti.h"
#include "Application_Types.h"
#include "Board_Config.h"
#include "Interface_Support.h"
#include "sci.h"
#include <stdio.h>
#include <string.h>
/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
const  TPS_AllVoltageRailLimits TPS65381Q_VoltageLimits = VOLTAGE_RAIL_LIMITS;
/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */
	mibspiInit();
	gioInit();
	sciInit();
	adcInit();



	TPS_SendDebugText(INFO, (uint8*) "INIT TPS", 0);
	TPS_Initilization_struct initstruct;
	memcpy(&initstruct.AMUXVoltageRailLimits,  &TPS65381Q_VoltageLimits, sizeof(TPS65381Q_VoltageLimits));
	initstruct.GetTPSDiagPinSampledValue = TPSDiagosticPinSampledData;
	initstruct.blNRES_Monitoring = TRUE;
	initstruct.blbist_at_startup = TRUE;
	initstruct.blenable_drv_op = TRUE;
	//Error pin monitoring is disabled here,The Halcogen startup toggles the error pin,If error monitoring is
	//enabled then appropriate settings has to be made to error monitoring(PWM low width) width
	//so that the error monitoring does not reset the TPS device.
	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 dyuration in 204.8 us
	initstruct.error_pin_pwm_width.u8PWM_LOW = 40;
	initstruct.send_recieve_data_TPS = SendandRecieveDataTPS;
	initstruct.u8pwd_threshhold_value = 5;
	initstruct.u8safe_lock_threshhold = 5;
	//timeout duration in 198 ns
	initstruct.u8safe_state_timeout_scaler = 4;
	TPS_SendDebugText(INFO, (uint8*) "going in", 0);

	if(TPS_DriverInit(&initstruct))
	{
		TPS_SendDebugText(INFO, (uint8*) "init done", 0);
	}

	TpsIf_Init(SendandRecieveDataTPS);

	TPS_SendDebugText(INFO, (uint8*) "init watchdog", 0);
	TPS_WatchdoConfiguration watchdogconfig;
	//Initialize watchdog and open a new sequence run
	watchdogconfig.u8TokenFDBK = 0;
	watchdogconfig.u8TokenSeed = 0;
	watchdogconfig.blwatchdog_reset = FALSE;
	// 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;
	TPS_SendDebugText(INFO, (uint8*) "going in 2", 0);

	TPS_WatchdogInit(&watchdogconfig);

	uint8 u8wdfailcnt;

	while(1){

		TPS_GetWatchdogFailCount(&u8wdfailcnt);
		TPS_SendDebugText(INFO, (uint8*) u8wdfailcnt, 0);
	}

/* USER CODE END */
}

  • Hi Aaron,

    We will test out demo project on Hitex kit again today and provide you a response latest by tommorrow.Meantime can you share your project so that we can test it out also.

    Regards

    Manoj
  • The Google drive link to the project : drive.google.com/open

  • Hi Aaron,

    I did run the demo project we have for TMS570 hitex kit.I am not able to see th log messages as the com port changing on every power reset.

    But I do see that it is halting at the last while(1) which does indicate that it executed all the tests and watchdog services are getting called correctly and I could see that my TPS device state is active.How did you manage to get consistent  com port and see the messages on the terminal.

    Further not that the test project services the watchdog in the timer interrupts. This case below shows how we are handling watchdog you can see that we are starting the rti module which starts timers and on these timer interrupts we answer the Q&A watchdog.

     case TEST_WD_DIAGMODE:
                    testfsm.current_state = testfsm.next_state;
        watchdogconfig.u8TokenFDBK = 0;
        watchdogconfig.u8TokenSeed = 0;
                    watchdogconfig.blwatchdog_reset = FALSE;
        /* 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;
                    TPS_WatchdogInit(&watchdogconfig);
                    NextActiveWDWindow = OPENWDW;
                    rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
                    rtiREG1 ->CMP[0U].COMPx = (OPEN_WINDOW_CONFIG * 1000) / 2;
                    rtiStopCounter(rtiCOUNTER_BLOCK0);
                    rtiResetCounter(rtiCOUNTER_BLOCK0);
                    rtiStartCounter(rtiCOUNTER_BLOCK0);
                    rtiREG1 ->CMP[0U].UDCPx = (OPEN_WINDOW_CONFIG * 1000) / 2;
                    if(TRUE == TPS_RegReadBackandCompare(&readbackcompare_test))
                    {
                        if(TEST_PASS == readbackcompare_test)
                        {
                            TPS_SendDebugText(INFO, (uint8*) "TPS_RegReadBackandCompare PASS",0);
                        }
                        else
                        {
                            TPS_SendDebugText(INFO, (uint8*) "TPS_RegReadBackandCompare FAIL",0);
                        }
                    }
                    else
                    {
                        TPS_SendDebugText(INFO,
                                (uint8*) "TPS_RegReadBackandCompare did not execute",
                                0);
                    }
                    while (u8PendingWatchdogServices != 0)
                    {
    
                    }
                    if ((0U == u8CurrentWDFailCount)&&(1 == gioGetBit(gGio_Parameter.gioPort,gGio_Parameter.channel)))
                    {
                        TPS_SendDebugText(INFO, (uint8*) "TEST_WD_DIAGMODE PASS", 0);
                    }
                    else
                    {
                        TPS_SendDebugText(INFO, (uint8*) "TEST_WD_DIAGMODE FAIL", 0);
                    }
                    testfsm.next_state = TEST_WDDIAG_ERRORS;
                    break;

    In your code you have just initialized watchdog and you have not started timers which can service watchdog.

    Regards

    Manoj

  • I have moved back to using the exact example code in the C:\ti\Hercules\SafeTI Diagnostic Library\2.2.0\demo_app\HALCoGen\TMS570LS3137_HitexKit folder that I am still having problems with the device restarting when I step through the code at this point (see below).

    See the attached sys_main.c file I am using.

     3326.sys_main.c

    			/*The disabling of the CRC_EN bit is leading to a reset from TPS which has to be resolved*/
    			/*testing of the CRC calculation API's*/
    			/*Initialize the 64 bit data string which used for the calculation of CRC-8*/
    			blRetVal = TRUE;
    			blRetVal = blRetVal
    					&& TPS_InitializeDatastringforCRCCaclcuation(u32dataforcrc);
    			blRetVal = blRetVal
    					&& TPS_CalculateCRC8(u32dataforcrc, &u8crcvalue);
    			/*writing CRC to SAFETY_CFG_CRC register*/
    			//blRetVal = blRetVal && TPS_ConfigureSafetyCheckControl(CFG_CRC, TRUE);
    			blRetVal = blRetVal
    					&& TPS_ConfigureSafetyCheckControl(CFG_CRC, FALSE);
    			TPS_SendDebugText(DEBUG, (uint8*) "TPS_ConfigureSafetyCheckControl",
    					blRetVal);

  • These are the Serial Settings I am using

    and this is the event that occurs when the HSK restarts

  • Hi Aaron,

    The application testing cannot be done in debug mode efficiently as there are lot things which are related to power.As described in the user guide to test the demo application you need to first flash the demo and then power reset the board after the reset the application should stop at the last while(1) loop. 

    As you can see in the demo application the last  state of the demo is TEST_WDACT_ERRORS.in this state we introduce watchdog errors in active mode and the device fail count reaches 7 which results in ENDRV going low.

    I did retest the demo application behavior on my end.I did comment the statements testfsm.next_state = TEST_WDACT_ERRORS;As a result of this the watchdog errors were not introduced  the TPS remained in the active mode.The watchdog fail count is 0 as you can see in the attached snapshot.I have also attached the snapshot of the HSK monitor applcation which shows that the ENDRV is 1.Let me know whether this is you expectation.

    Let me know if you need more support in this regard.The demo application at my end on the TMS570LS31 Hitex kit is working as expected. There are no resets observed.The below snapshots reassure the correct working of the demo application.

    Note: This demo for hitex kit is test application for the TPS driver library and does not show usage of the Safety diagnostic library APIs.You can use this example application as the starting point for implementing your safety API's.During the development phase you can put the TPS in the diagnostic state instead of moving it into active mode and then you can start testing the safety diagnostic library API's.You can refer to the documentation.

    SafeTIDiagnosticLibrary-User'sGuide-v2.2.1.chm

    TPSDriver-User'sGuide-v2.2.1.chm

    For more information on usage of the diagnostic library and the Tps driver


  • I'm not 100% sure what you mean by a power reset. Is this literally removing and pugging back in the power cable then reconnecting the HSK-Safety Monitor or is this pressing the "SW300 Reset" Button by the screen?

    I have re downloaded and uninstalled and reinstalled the SafeTI Diagnostic Library and I am importing the CCS6 project installed at: C:\ti\Hercules\SafeTI Diagnostic Library\2.2.0\build\TMS570LS3137_HitexKit

    I have flashed the device (using the code composer debug button), I then press play and shortly after the device resets and I loose any JTAG debugging capability. I then unplug the power to the device and plug it back in and connect to it via the HSK-Safety Monitor application (which also flashes the screen on the device).

    With the alteration to the code (comment out "testfsm.next_state = TEST_WDACT_ERRORS;") the HSK-Safety Monitor application reports the following. As you can see the ENDRV line is now high (even though the GUI reports 0 on the sidebar) however the monitor is still reporting 7 errors. As i cannot see where the code is stopping I am not sure if this behaviour is expected or if there is another problem?

  • Removing the power plug and plugging back is power on reset in the case of this board.(we do not have seperate power on reset button).The GUI always reports the correct status if you drag the cursor to see the end of ENDRV line you can see that ENDRV is low in the end.Looks like you have not commentend all instances of testfsm.next_state = TEST_WDACT_ERRORS.The behavior you should see be exactly same as what i have shared in the previous post.Can you recheck. 

    In the image I have share you can clearly see that ENDRV status shown in the sidebar and the ENDRV signal on line are same.

  • Hi thanks for the help,

    I have managed to get the ENDRV line to stay high and the safe state TPS is now low, as shown in your screenshot.

    This may sound like a silly question but what do I do now? Instead of the infinite while loop should I now call another function with code I have created?

    The HSK-Monitor also doesn't seem to inject faults any more too, is there a way to re-enable this feature?

  • No with the current project it is not possible to recreate the Hitex kit demo again.To do that you may need to port the original Hitex safety kit project and then modify the safety library API calls to new APIs and use the new TPS driver instead of the old one.(that will be a lot of effort).
    If your need is to test the SafeTI Diagnostic library then You are at a good state now.

    As suggested earlier do not transit to the active state of TPS65381 just stay in diagnostic state, dont move out of it.(make necessary changes to the demo code).While (1) still needs to be there.But before while(1) you can start calling the safety diagnostic library APIs you can refer to the project C:\ti\Hercules\SafeTI Diagnostic Library\2.2.1\build\TMS570LS3137_NoOS to know more on how the diagnostic library APIs are called.

    Regards

    Manoj
  • Hello,

    Is there any way to use the fault injection capabilities on the RM48 and SafeTI- HSK Monitor without having to rewrite the original Safety Kit Project?
    As the safety diagnostic library can be used on 'normal' TMS570 HDK boards without the complication of the RM48 or the TPS
  • I Will come back to you on this with an answer by tuesday.

    Regards

    Manoj