TI中文支持网
TI专业的中文技术问题搜集分享网站

TDA4VM: DM timer 周期及其配置不准

Part Number:TDA4VM

TI 专家你好:

开发板:自己开发板

sdk:  ti-processor-sdk-rtos-j721e-evm-08_01_00_13

我想在mcu1_0上去使用了 DM timer.

其中,周期配置为5000, 周期类型为 微秒(period_type= 0)。

但是在调试过程中,发现周期远远超过了5毫秒,然后我输出日志,

打印了定时器的配置:

发现周期参数不对。请问一下TI专家,怎么解决这个问题。

谢谢。

Shine:

已咨询e2e产品线工程师,请关注下面帖子的回复。https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1251158/tda4vm-dm-timer-period-is-not-accuracy

,

eason zhou:

你好,该帖子有什么进展吗?目前没有任何更新。

,

Shine:

抱歉,已经去催了。

,

Shine:

请看下面e2e工程师的回复。Are they referring to any existing example. If yes, can you please share the changes that they have made so I can reproduce this error on my end?

,

eason zhou:

main_rtos.c

/**\brief Main file for TI-RTOS build*//* ========================================================================== */
/*Include Files*/
/* ========================================================================== */#include <ti/csl/arch/csl_arch.h>
#include <ti/csl/soc.h>
#include <ti/csl/cslr.h>#include <ti/osal/osal.h>
#include <ti/osal/TaskP.h>#if (defined (BUILD_MCU1_0) && (defined (SOC_J721E) || defined (SOC_J7200)))
#include <ti/drv/sciclient/sciserver_tirtos.h>
#endif
#include <ti/drv/ipc/include/ipc_rsctypes.h>#include <Adc.h>#include "AdcApp.h"
#include "string.h"
#include "app_utils.h"
#include "AdcApp_Startup.h"
#include <ti/board/board.h>
#include <ti/drv/sciclient/sciclient.h>#include <ti/kernel/freertos/FreeRTOS-LTS/FreeRTOS-Kernel/include/FreeRTOS.h>
#include <ti/kernel/freertos/FreeRTOS-LTS/FreeRTOS-Kernel/include/task.h>
#include <ti/drv/sciclient/sciclient.h>
#include <ti/drv/sciclient/sciserver_tirtos.h>
#include "Dio.h"#include "pmic_app.h"
#include "pmic_common.h"
#include "ipc_trace.h"
#include <ti/csl/arch/r5/csl_arm_r5.h>/* ========================================================================== */
/*Macros & Typedefs*/
/* ========================================================================== *//* Test application stack size */
#define APP_TASK_STACK(10U * 1024U)
/**< Stack required for the stack */
/**< Task name */
#define APP_TSK_STACK_MAIN(32U * 1024U)
/**< Test application stack size */
#define IPC_INIT_SCISERVER_TASK_PRI(12)
#define APP_SCISERVER_INIT_TSK_STACK(32U * 1024U)
/* High Priority for SCI Server - must be higher than Low priority task */
#define IPC_SETUP_SCISERVER_TASK_PRI_HIGH(8)
/** Low Priority for SCI Server - must be higher than IPC echo test tasks* to prevent delay in handling Sciserver requests when test is performing* multicore ping/pong.*/
#define IPC_SETUP_SCISERVER_TASK_PRI_LOW(7)#define MSG_APP_NAME "adc_detect"
#define MSG_NORMAL 0x01U
#define ADC_INIT_TASK_PRI(3)
#define PMIC_TASK_PRI(5)
#define TISCI_DEV_MCU_ADC00
#define TISCI_DEV_MCU_ADC11
#define TISCI_DEV_MCU_I2C0194
#define TISCI_DEV_WKUP_I2C0197
#define TISCI_DEV_USB0288
#define TISCI_DEV_MMCSD091
/* None *//* ==========================================================================*/
/*Function Declarations*/
/* ========================================================================== */void CanProfile_setupSciServer(void);
void ipc_initSciclient(void);
void Ipc_setupSciServer(void);
/* ========================================================================== */
/*Global Variables*/
/* ========================================================================== */
/* application stack */
static uint8_t CanApp_TaskStack[APP_TASK_STACK] __attribute__((aligned(32)));
static uint8_t SciServer_TaskStack[APP_TASK_STACK] __attribute__((aligned(32)));
static uint8_tgAppTskStackMain[APP_TSK_STACK_MAIN] __attribute__ ((aligned(8192)));
static uint8_tgSciserverInitTskStack[APP_SCISERVER_INIT_TSK_STACK] __attribute__ ((aligned(8192)));static uint8_tgAdcInitTskStack[APP_SCISERVER_INIT_TSK_STACK] __attribute__ ((aligned(8192)));
static uint8_tgPmicInitTskStack[APP_TASK_STACK] __attribute__ ((aligned(32)));static void taskFxn(void* a0, void* a1);
static void Adc_detect_Fxn(void* a0, void* a1);
static void Pmic_wdg_Fxn(void* a0, void* a1);
extern void pmic_wdg_app_runner(void);
/***Without this linux kernel can not boot.*/
const Ipc_ResourceTable ti_ipc_remoteproc_ResourceTable __attribute__ ((section (".resource_table"), aligned (4096))) ={{1U,/* we're the first version that implements this */2U,/* number of entries in the table */{0U,0U,/* reserved, must be zero */}},
};/* ==========================================================================*/
/*This is for adc detect*/
/* ========================================================================== */
static uint32_t AdcApp_procImplicitStop(const Adc_ConfigType *Adc_ConfigPtr, uint32_t groupId);
static void AdcApp_procIsr(uint32_t grpIdx);uint32_tAdc_TestPassed = E_OK;
/**< App Result Status Flag */
uint32_tAdc_AppLoopCount = 5U;
/**< Number of times App runs */
Adc_ValueGroupTypeAdc_AppBuffer[ADC_MAX_GROUP][ADC_APP_BUF_SIZE_WORD];
/**< SetUp Result Buffer passed to driver */
Adc_ValueGroupTypeAdc_AppReadBuffer[ADC_MAX_GROUP][ADC_APP_READ_BUF_SIZE_WORD];
/**< Output Result Buffer */
volatile uint32_tAdc_AppRdBufCount[ADC_MAX_GROUP];
/**< No of Samples Counter */
volatile uint32_tAdc_AppGroupDone[ADC_MAX_GROUP];
/**< Group Conversion Completion flag */
extern const Adc_ConfigType *Adc_ConfigPtr;#defineGET_ADC_VOITAGE(adcValue)(((adcValue)*(1800U)) / (4095U))static SemaphoreP_Handle Pmic_Handle = NULL;
static TimerP_Handle dmhandle = NULL;
typedef struct Adc_Target
{Adc_HWUnitTypeAdc_id;uint16_tChannel;uint32_tVoltage;Adc_ValueGroupTypeAdc_Result;
} Adc_Target_t;Adc_Target_t Adc_target = {.Adc_id = ADC_UNIT_1,.Channel = 1,.Adc_Result = 0,.Voltage = 0
};/* ========================================================================== */
/*End ofadc detect*/
/* ========================================================================== */int32_t local_moduleClockEnable(uint32_t moduleId)
{int32_t retVal = 0;int32_t status = -1;uint32_t moduleState = 0U;uint32_t resetState = 0U;uint32_t contextLossState = 0U;/* Get the module state.No need to change the module state if itis already ON*/status = Sciclient_pmGetModuleState(moduleId,&moduleState,&resetState,&contextLossState,SCICLIENT_SERVICE_WAIT_FOREVER);if(moduleState == TISCI_MSG_VALUE_DEVICE_HW_STATE_OFF){status = Sciclient_pmSetModuleState(moduleId,TISCI_MSG_VALUE_DEVICE_SW_STATE_ON,(TISCI_MSG_FLAG_AOP |TISCI_MSG_FLAG_DEVICE_RESET_ISO),SCICLIENT_SERVICE_WAIT_FOREVER);if (status == 0){status = Sciclient_pmSetModuleRst (moduleId,0x0U,SCICLIENT_SERVICE_WAIT_FOREVER);if (status != 0){retVal = -1;}}else{retVal = -1;}}return retVal;
}TaskP_Handle task;
TaskP_Params taskParams;
int main(void)
{/* Relocate FreeRTOS Reset Vectors from BTCM*/void _freertosresetvectors (void);memcpy((void *)0x0, (void *)_freertosresetvectors, 0x40);OS_init();/* Initialize the task params */TaskP_Params_init(&taskParams);/* Set the task priority higher than the default priority (1) */taskParams.priority = 2;taskParams.stack= gAppTskStackMain;taskParams.stacksize= sizeof (gAppTskStackMain);task = TaskP_create(taskFxn, &taskParams);if(NULL == task){OS_stop();}OS_start();/* does not return */}static void tick_fxn(unsigned int t)
{// Test here
}static void taskFxn(void* a0, void* a1)
{
#ifdef UART_ENABLEDAppUtils_Init();
#endif/* Initialize SCI Client - It must be called before board init */ipc_initSciclient();TaskP_Handle sciserverInitTask;TaskP_Params sciserverInitTaskParams;/* Initialize SCI Client Server */TaskP_Params_init(&sciserverInitTaskParams);sciserverInitTaskParams.priority= IPC_INIT_SCISERVER_TASK_PRI;sciserverInitTaskParams.stack= gSciserverInitTskStack;sciserverInitTaskParams.stacksize= sizeof (gSciserverInitTskStack);sciserverInitTask = TaskP_create(Ipc_setupSciServer, &sciserverInitTaskParams);if(NULL == sciserverInitTask){OS_stop();}// Board_initCfgboardCfg;// boardCfg = BOARD_INIT_PINMUX_CONFIG |//BOARD_INIT_UART_STDIO;// Board_init(boardCfg);#if 1TimerP_Params dmtimerPar;TimerP_Params_init(&dmtimerPar);dmtimerPar.period = 5000;dmtimerPar.periodType = (uint32_t)TimerP_PeriodType_MICROSECS;dmhandle = TimerP_create(TimerP_ANY, tick_fxn, &dmtimerPar);if (NULL == dmhandle)pmic_log_info("Creat dmtimer error.\n");TimerP_start(dmhandle);
#endif}void ipc_initSciclient(void)
{int32_t ret = CSL_PASS;Sciclient_ConfigPrms_tconfig;/* Now reinitialize it as default parameter */ret = Sciclient_configPrmsInit(&config);if (ret != CSL_PASS){AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME "Sciclient_configPrmsInit Failed\n");}#if (defined (BUILD_MCU1_0) && (defined (SOC_J721E) || defined (SOC_J7200) || defined (SOC_J721S2)))if (ret == CSL_PASS){ret = Sciclient_boardCfgParseHeader((uint8_t *)SCISERVER_COMMON_X509_HEADER_ADDR,&config.inPmPrms, &config.inRmPrms);if (ret != CSL_PASS){AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME "Sciclient_boardCfgParseHeader Failed\n");}}
#endifif (ret == CSL_PASS){ret = Sciclient_init(&config);if (ret != CSL_PASS){AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME "Sciclient_init Failed\n");}}
}void Ipc_setupSciServer(void)
{Sciserver_TirtosCfgPrms_t appPrms;int32_t ret = CSL_PASS;ret = Sciserver_tirtosInitPrms_Init(&appPrms);appPrms.taskPriority[SCISERVER_TASK_USER_LO] =IPC_SETUP_SCISERVER_TASK_PRI_LOW;appPrms.taskPriority[SCISERVER_TASK_USER_HI] =IPC_SETUP_SCISERVER_TASK_PRI_HIGH;if (ret == CSL_PASS){ret = Sciserver_tirtosInit(&appPrms);}if (ret == CSL_PASS){AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME "Starting Sciserver..... PASSED\n");}else{AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME "Starting Sciserver..... FAILED\n");}return;
}

1,将上述源文件编译。启动核为mcu1_0.

2,将编译出来的固件,将其make u-boot-a72的 DM,编译tispl.bin

(注意:我在tick_fxn中,没有加入我们的代码,TI的专家可以将tda4vm板中的某一个IO作为测试点,将其5ms一次 循环拉高、拉低。通过示波器观察)

,

eason zhou:

上述就是我用示波器测量的结果。时钟会在上电之后不久,会出现一次或多次挂死现象,待linux kernel启动完成后,就不会出现上述现象,且时钟稳定。麻烦TI专家帮忙分析一下。谢谢。

,

Shine:

已跟进,请关注帖子的回复。

,

eason zhou:

你好,那个英文贴貌似没有更新了。

,

Shine:

我去催一下

,

eason zhou:

你好,那个英文帖子没有更新了,这个问题挺重要的,帮忙和专家沟通一下,谢谢

,

Shine:

抱歉,我再去催一下。

,

eason zhou:

你好,这个问题已经将近半个月了,这个还有什么进展吗?TI工程师帮忙验证了嘛?

,

Shine:

抱歉回复晚了,请看下面工程师的回复。

The timer configuration looks fine.

Do you see the same issue when just running the RTOS alone, without running the Linux on A72?

Also, can you try using any other timer instance and see if the results are same?

,

eason zhou:

1,CCS debug的时候,是正常的(我想ccs去debug的时候是没有运行linux的)

2,我尝试过其他的DM timer ,但是毫无意外,均在linux kernel启动过程中,出现了这个问题。

同时,mcu 能使用的DM timer 不多, 即使TRM上有众多DM timer可以使用(大约20个),但是mcu能使用的也才几个,如下:

后来我尝试去修改这个mask,将其扩展为(0xFF),但是也有几个DM timer会创建不成功。

请问TI专家,您在开发板上,通过编译修改tispl.bin测试了这个DM timer了嘛?结果是正常的嘛?

,

Shine:

已把您的回复更新到e2e帖子。

赞(0)
未经允许不得转载:TI中文支持网 » TDA4VM: DM timer 周期及其配置不准
分享到: 更多 (0)