主题: C2000WARE 中讨论的其他器件
工具/软件:
工具/软件:
TI 团队大家好、
我目前正在使用 TMDSCNCD28P55X 控制卡进行开发。
我要在 CLA 中读取 ADC 结果寄存器。
ADCINT 不会启动 CLA 中的任务 2。 即使如此、任务 8 的初始化也没有发生(感觉如此)。
看到 ADCINTFLG 固定为 1。 显示值的 ADCCresult 寄存器。 下表给出了 CLA 初始化的代码。
谢谢。此致
Ram Singh
// CLA trigger source
AdccRegs.ADCINTSEL1N2.bit.INT1SEL = 0; // End of SOC0 will set INT1 flag
AdccRegs.ADCINTSEL1N2.bit.INT1E = 1; // Enable INT1 flag
AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Make sure INT1 flag is cleared
AdccRegs.ADCINTSEL1N2.bit.INT1CONT= 1;
//
// Configure memory and initialize the CLA registers
//
init_CLA();
CLA_configClaMemory();
void EscController::init_CLA()
{
#ifdef _FLASH
#ifndef CMDTOOL // Linker command tool is not used
extern uint16_t Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize;
extern uint16_t Cla1ConstRunStart, Cla1ConstLoadStart, Cla1ConstLoadSize;
//
// Copy the program and constants from FLASH to RAM before configuring
// the CLA
//
memcpy((uint32_t *)&Cla1ProgRunStart, (uint32_t *)&Cla1ProgLoadStart,
(uint32_t)&Cla1ProgLoadSize);
memcpy((uint32_t *)&Cla1ConstRunStart, (uint32_t *)&Cla1ConstLoadStart,
(uint32_t)&Cla1ConstLoadSize );
#endif //CMDTOOL
#endif //_FLASH
CLATask_init();
}
void EscController::CLA_configClaMemory()
{
EALLOW;
//
// Initialize and wait for CLA1ToCPUMsgRAM
//
MemCfgRegs.MSGxINIT.bit.INIT_CLA1TOCPU = 1;
while(MemCfgRegs.MSGxINITDONE.bit.INITDONE_CLA1TOCPU != 1){};
//
// Initialize and wait for CPUToCLA1MsgRAM
//
MemCfgRegs.MSGxINIT.bit.INIT_CPUTOCLA1 = 1;
while(MemCfgRegs.MSGxINITDONE.bit.INITDONE_CPUTOCLA1 != 1){};
//
// CLA Program will reside in RAMLS0 and data in RAMLS1, RAMLS2
//
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS0 = 1U;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS1 = 0U;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS2 = 0U;
//
// Select CLA as the master of RAMLS0, RAMSL1, RAMLS2
//
MemCfgRegs.LSxMSEL.bit.MSEL_LS0 = 1U;
MemCfgRegs.LSxMSEL.bit.MSEL_LS1 = 1U;
MemCfgRegs.LSxMSEL.bit.MSEL_LS2 = 1U;
EDIS;
}
void CLATask_init(){
//
// Configure all CLA task vectors
// On Type-1 and Type-2 CLAs the MVECT registers accept full 16-bit task addresses as
// opposed to offsets used on older Type-0 CLAs
//
#pragma diag_suppress=770
//
// CLA Task 1
//
EALLOW;
Cla1Regs.MVECT2 = (uint16_t) (&runEscInCla1Task2);
DmaClaSrcSelRegs.CLA1TASKSRCSEL1.bit.TASK2 = 11; //Cla runEscInCla1Task2 trrigered by ADCCINT1
//
// CLA Task 8
//
Cla1Regs.MVECT8 = (uint16_t) (&Cla1Task8);
DmaClaSrcSelRegs.CLA1TASKSRCSEL1.bit.TASK2 = 0; //CLA_TRIGGER_SOFTWARE
//
// Disable background task
//
Cla1Regs._MCTLBGRND.bit.BGEN = 0;
#pragma diag_warning=770
//
// Enable the IACK instruction to start a task on CLA in software
// for all 8 CLA tasks. Also, globally enable all 8 tasks (or a
// subset of tasks) by writing to their respective bits in the
// MIER register
//
// Enable IACK to start tasks via software
Cla1Regs.MCTL.bit.IACKE = 1;
Cla1Regs.MIER.all = (M_INT8 | M_INT2);
EDIS;
}