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.

关于2812 EVB启动ADC SOC的问题



我在用2812进行数据采集50Hz市电信号,采样频率初步定位1.6K,打算使用ADC的顺序级联模式,用EVB的定时器GP3比较产生SOC信号,每次转换16个通道。先不说采集的数对不对,现在发现这样一个问题:我在ADC中断里设置断点,点全速运行,每次都可以进入ADC中断,但是如果把断点去了再点全速运行,就会进入PDPINTA_ISR中断,看了一下这个是EVA的外部触发中断,但是我没有使能这个中断啊。如果DSP上电后不初始化EVB的相关参数则不会进入这个中断,当然由于没有初始化EVB触发SOC,因为无法进行正常的AD转换;而DSP不重新上电,如果进入过一次PDPINTA_ISR中断后,再屏蔽EVB的相关代码则不管用了,依然会进入PDPINTA_ISR中断。以下是ADC初始化的相关代码:

void InitAdc(void)
{
	extern void DSP28x_usDelay(Uint32 Count);
	
    // To powerup the ADC the ADCENCLK bit should be set first to enable
    // clocks, followed by powering up the bandgap and reference circuitry.
    // After a 5ms delay the rest of the ADC can be powered up. After ADC
    // powerup, another 20us delay is required before performing the first
    // ADC conversion. Please note that for the delay function below to
    // operate correctly the CPU_CLOCK_SPEED define statement in the
    // DSP28_Examples.h file must contain the correct CPU clock period in
    // nanoseconds. For example:

	AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3;	// Power up bandgap/reference circuitry
	DELAY_US(ADC_usDELAY);                  // Delay before powering up rest of ADC
	AdcRegs.ADCTRL3.bit.ADCPWDN = 1;		// Power up rest of ADC
	DELAY_US(ADC_usDELAY2);                 // Delay after powering up ADC
	
	
	//级联模式顺序采样
	// Configure ADC
   AdcRegs.ADCMAXCONV.all = 15;      	 //最大转换通道

//   AdcRegs.ADCTRL1.all = 0x2810;		//级联
	AdcRegs.ADCTRL1.bit.ACQ_PS = 7;		//采样窗口8*ADCLK
   	AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;	//级联模式

	AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ = 1;	//允许EVB信号启动级联排序器

 //  AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ = 1;  // Enable EVBSOC to start SEQ1
   AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;  // Enable SEQ1 interrupt (every EOS)

   AdcRegs.ADCCHSELSEQ1.all = 0x3210;	//排序
   AdcRegs.ADCCHSELSEQ2.all = 0x7654;
   AdcRegs.ADCCHSELSEQ3.all = 0xBA98;
   AdcRegs.ADCCHSELSEQ4.all = 0xFEDC;

//   AdcRegs.ADCTRL3.all = 0x00E6;	
	AdcRegs.ADCTRL3.bit.ADCCLKPS = 3;		//ADCLK = 10MHz
	AdcRegs.ADCTRL3.bit.ADCBGRFDN = 3;

  
  // Configure EVB
  // Assumes EVA Clock is already enabled in InitSysCtrl();

   EvbRegs.T3CMPR = 0x0010;               // Setup T3 compare value
   EvbRegs.T3PR = 2343;                	 // Setup period register 128点采样,6.4KHz

   EvbRegs.GPTCONB.bit.T3STAT = 1;		//递增计数
   EvbRegs.GPTCONB.bit.T3TOADC = 3;		//比较中断的产生启动ADC

   EvbRegs.T3CON.bit.TMODE = 2;			//递增计数模式
   EvbRegs.T3CON.bit.TPS = 2;			//1/4*HSPCLK
   EvbRegs.T3CON.bit.TECMPR = 1;		//使能比较
   EvbRegs.T3CON.bit.TENABLE = 1;		//使能定时器3
//   EvbRegs.T3CON.all = 0x1442;            // Enable timer 1 compare (upcount mode) 

}	

以上是初始化AD及EVB定时器的代码。哪位朋友有时间帮忙看看,有没有有过类似应用的提供个例子就更好了,谢谢!