Part Number:TDA4VM
I want to add timer function to MCU function on tda4. I found the directory \ Ti processor SDK rtos-j721e-evm-08_ 00_ 00_ 12\ti-processor-sdk-rtos-j721e-evm-08_ 00_ 00_ 12\pdk_ jacinto_ 08_ 00_ 00_ 37 \ packages \ Ti \ CSL \ example \ RTI has timer function. During debugging, it is found that the RTI timer can only enter the interrupt function once. I want a one millisecond cyclic timer. Then I put RTI_CLOCK_SOURCE_32KHZ clock is replaced by RTI_CLOCK_SOURCE_12MHZ found that it can cycle forward interrupt, but the cycle seems to be inaccurate. How to configure one millisecond cycle time for RTI? Or are there other timer examples of similar functions?
Nancy Wang:
我需要咨询相关工程师再给您回复。
,
Nancy Wang:
Yang Yong 说:Then I put RTI_CLOCK_SOURCE_32KHZ clock is replaced by RTI_CLOCK_SOURCE_12MHZ found that it can cycle forward interrupt,
这是可以连续的进中断吗?
,
Yang Yong:
感谢您的帮助。是的,更换12M时钟后可以连续进,但周期貌似不准确。
,
Nancy Wang:
好的。
,
Nancy Wang:
请将timer有关的配置贴出来。
,
Yang Yong:
我用的就是开发包里的例子: \ Ti processor SDK rtos-j721e-evm-08_ 00_ 00_ 12\ti-processor-sdk-rtos-j721e-evm-08_ 00_ 00_ 12\pdk_ jacinto_ 08_ 00_ 00_ 37 \ packages \ Ti \ CSL \ example \ RTI。部分代码如下:
void test_csl_rti_dwwd_test_app(void){ /* @description: Test that runs a basic functionality test of WDT
@requirements: PRSDK-5575
@cores: mpu1_0 */
#ifdef LINUX_HOST_PROC_WDT_CONFIG
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_UART_STDIO; Board_init(boardCfg);
/* Register Interrupt */ isrFlag = 0U; if(RTIInterruptConfig(APP_RTI_MODULE) != 0) { RTIAppUtilsPrint("\r\nRTI Interrupt configuration failed. \r\n");#ifdef UNITY_INCLUDE_CONFIG_H TEST_FAIL();#endif return; } RTIAppUtilsPrint(APP_NAME ": RTI App WDT timeout interrupt configured.\n"); while (0U == isrFlag) { /* Wait for interrupt */ }#else uint32_t rtiModule, rtiWindow_size, rtiPreload_value, rtiReaction; int32_t config_status;#ifndef DISABLE_UART_PRINT Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO; Board_init(boardCfg);#endif RTIAppUtilsPrint("\n Board init complete\n");
/* Register Interrupt */ isrFlag = 0U; if(RTIInterruptConfig() != 0) { RTIAppUtilsPrint("\r\nRTI Interrupt configuration failed. \r\n");#ifdef UNITY_INCLUDE_CONFIG_H TEST_FAIL();#endif return; } RTIAppUtilsPrint("\n Interrupt config complete\n");
/* Configure RTI parameters */ rtiModule = RTI_APP_RTI_CFG_BASE; rtiWindow_size = APP_RTI_DWWD_WINDOW_SIZE; rtiReaction = APP_RTI_DWWD_REACTION; rtiPreload_value = RTIGetPreloadValue((uint32_t) RTI_CLOCK_SOURCE_32KHZ, (uint32_t) APP_RTI_DWWD_TIMEOUT_VALUE);
/* Select RTI module clock source */ RTISetClockSource((uint32_t) RTI_CLOCK_SOURCE_32KHZ); config_status = RTIDwwdWindowConfig(rtiModule, rtiReaction, rtiPreload_value, rtiWindow_size); if (config_status == CSL_EFAIL) { RTIAppUtilsPrint(APP_NAME ": Error during Window configuration.\n");#ifdef UNITY_INCLUDE_CONFIG_H TEST_FAIL();#endif } else { RTIAppUtilsPrint(APP_NAME ": DWWD is configured for %u ms time-out \n", APP_RTI_DWWD_TIMEOUT_VALUE); RTIAppUtilsPrint(APP_NAME ": DWWD will generate interrupt after " "above time-out period.\n"); RTIDwwdCounterEnable(rtiModule); /* Let DWWD expire here */ RTIAppUtilsPrint(APP_NAME ": Wait for %u ms for interrupt " "to be generated by DWWD.\n", APP_RTI_DWWD_TIMEOUT_VALUE);
while (0U == isrFlag) { /* Wait for interrupt */ } RTIAppUtilsPrint(APP_NAME ": RTI App completed successfully.\n"); UART_printStatus("\n All tests have passed. \n");#ifdef UNITY_INCLUDE_CONFIG_H TEST_PASS();#endif }#endif}
,
Nancy Wang:
好的,已经反馈给相关工程师。