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.

TMS570LS3137: Making a watchdog using TMS570LS3137ZWT chip

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Dear All.

I'm trying to make a watchdog using the TMS570LS3137ZWT chip.
If you look at Halcogen's "Help Topics", there is an example source for implementing dwwd in "Examples".

So, I set up Halcogen according to the example, created a task, and tested it.

rtiInit();
/* Enable RTI compare 0 notification */
rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
/* Start counter */
rtiStartCounter(rtiCOUNTER_BLOCK0);
/* Initialize and start DWD */
dwwdInit(Generate_NMI, 4095, Size_100_Percent);
dwdCounterEnable();


However, when the watchdog timer expired, it was not called inside rtiNotification.

What I want to do is,
When running an infinite loop like while(1) inside a task, the watchdog gets caught and tries to reset the hardware.

Could you tell me what to do?

  • Dear Jagadish.

    Thank you so much.
    I understood what you told me.
    The code I tested is below.

    1. Coded to run infinite loop after setting dwwd in task

    /* Enable IRQ and FIQ interrupts */
    _enable_interrupt_();
    /* Initialize RTI */
    rtiInit();
    /* Enable RTI compare 0 notification */
    rtiEnableNotification(rtiNOTIFICATION_COMPARE2);
    /* Start counter */
    rtiStartCounter(rtiCOUNTER_BLOCK1);
    /* Initialize and start DWD */
    dwwdInit(Generate_NMI, 65535/*4095*/, Size_100_Percent);
    //dwdInit(25);
    dwdCounterEnable();
    onlyFirst = FALSE;

    while(1);

    2. rtiNodification function

    void rtiNotification(uint32 notification)
    {
    /* enter user code between the USER CODE BEGIN and USER CODE END. */
    /* USER CODE BEGIN (9) */
    dwdReset();
    /* USER CODE END */
    }

    3. esmGroup2Notification function

    void esmGroup2Notification(uint32 channel)
    {
    /* enter user code between the USER CODE BEGIN and USER CODE END. */
    /* USER CODE BEGIN (3) */
    if(channel == 24)
    {
    dwdGenerateSysReset();
    }
    }

    After testing, I found out the following.

    1. The dwdReset function continues dwd counting.

    If you do not use the dwdReset function, sooner or later the esmGroup2Notification function will be called and the dwdGenerateSysReset function will be called.

    But one thing occurred to me.
    In my opinion
    If you run an infinite loop using while(1) inside the task, the rtiNotification function is not called, so I thought that eventually esmGroup2Notification -> dwdGenerateSysReset would be called and reset, but that was not the case.
    Even if you arbitrarily run an infinite loop as above, the rtiNotification function continues to be called and dwdReset() is performed. So the SysReset I wanted didn't work.
    Why aren't you doing what I think you're doing? Can you please explain?

    Best Regards,
    IBLEE

  • Hi IBLEE,

    If you run an infinite loop using while(1) inside the task, the rtiNotification function is not called, so I thought that eventually esmGroup2Notification -> dwdGenerateSysReset would be called and reset, but that was not the case.
    Even if you arbitrarily run an infinite loop as above, the rtiNotification function continues to be called and dwdReset() is performed. So the SysReset I wanted didn't work.

    Here the example was developed using RTI interrupt method, and here the watchdog feed is doing using RTI interrupt. This method of watchdog will not helpful to reset the system for while(1); loops inside the task. This example is for just demo purpose only. If you want that kind of implementation, my suggestion will use code as follow:

    int Main(void)
    {
    	
    	
    	while(1)
    	{
    		Task_1();
    		Task_2();
    		Taks_3();
    		dwdReset();
    	}
    }

    So instead of using RTI interrupt to feed the watchdog, just keep the dwdReset function inside the while loop as above. So, if any task has a infinity loop then dwdReset function will not get called and eventually Watchdog NMI interrupt will get generate.

    --
    Thanks & regards,
    Jagadish.

  • Dear Jagadish
    Wow, that's a really good method.
    I tried doing what you just said, but the esmGroup2Notification function is called in too short a time.
    What should I change if I want to make the watchdog timer longer (e.g. 3 seconds)?
    Since the second argument of the dwwdInit() function is uint16 type, it can only be set to a maximum of 65535.

    best regards,
    IBLEE

  • Hi IBLEE,

    The maximum preload value is 4095 only not 65535.

    But this value will gets left shifted by 13 bits. And expiration time formula is given above.

    If your RTI clock 75Mhz and Preload value 4095 then expiration time will be: 0.447 Seconds, if this expiration time will not be sufficient in your application then you should need to decrease the RTI clock to increase the expiration time further.

    --
    Thanks & regards,
    Jagadish.

  • Dear Jagadish
    thank you so much.
    It's my first time using Ti products, and it's my first time with Halcogen, so I'm sorry I don't know much about it.
    Let me ask you one more question.
    RTI1CLK is set to 90 in Halcogen, but I cannot change this value.
    Can you tell me one more time what to do?

    Best Regards,
    IBLEE

  • Hi IBLEE,

    It's my first time using Ti products, and it's my first time with Halcogen, so I'm sorry I don't know much about it.

    No problem, we will assist you anytime.

    RTI1CLK is set to 90 in Halcogen, but I cannot change this value.
    Can you tell me one more time what to do?

    Verify which source was connected at "RTI1 Post Src", if it is VCLK means the clock is driven by VCLK1, so to reduce the clock we have to increase the "VCLK1 Divider".

    --
    Thanks & Regards,
    Jagadish.

  • Dear Jagadish.

    Thank you so much.

    Please take care next time too.

    Thanks & Regards,

    IBLEE