Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN
Tool/software: TI C/C++ Compiler
HELLO
Where can I find the code that is generated automatically on the outside of the watchdog?
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.
Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN
Tool/software: TI C/C++ Compiler
HELLO
Where can I find the code that is generated automatically on the outside of the watchdog?
Hi Whong,
The HALCoGen GUI doesn't have configuration tab for watchdog. But it generates APIs for watchdog. You can call the APIs to enable/start the DWWD.
Once you enable the digital watchdog you will need to write the proper key within the window. If you don't write the key then by default the watchdog will automatically reset the device or jump to the Interrupt routine.
You will use dwdReset() API to write the key so that the reset does not generate. See below code the dwdReset() simply writes two back to back keys to the WDKEY register. When proper key is written the watchdog counter will restart from its preload value and down count again. You must write proper key before the watchdog counter down count to 0. The proper key is a 0xE51A followed by 0xA35C. This is described in the RTI module userguide.
void dwdReset(rtiBASE_t *rtiREG)
{
/* USER CODE BEGIN (26) */
/* USER CODE END */
rtiREG->WDKEY = 0x0000E51AU;
rtiREG->WDKEY = 0x0000A35CU;
/* USER CODE BEGIN (27) */
/* USER CODE END */
}
If you want to intentionally generate a reset you can write incorrect watchdog key by calling the dwdGenerateSysReset(). See below. Here you see that the second key is intentionally written incorrectly with the value of 0x2345.
void dwdGenerateSysReset(rtiBASE_t *rtiREG)
{
/* USER CODE BEGIN (28) */
/* USER CODE END */
rtiREG->WDKEY = 0x0000E51AU;
rtiREG->WDKEY = 0x00002345U;
/* USER CODE BEGIN (29) */
/* USER CODE END */
}