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.

TMS570LS0714的PWM波产生trigger开始ADC采样问题

如题,在使用PWM波产生AD采样的事件时,不能使AD采样。

我已经设置是AD采样换成硬件触发,PWM的SOCA使能,并且在软件触发下AD采样能够正确采样。

现在的问题是我怎么知道自己PWM波确实产生了事件,如果产生了事件为什么触发不了AD采样呢?

谢谢!

  • Hi Lily,

    采用eTPWM硬件触发ADC采样,主要配置三点:

    1, PINMUX的PINMMR,即在PINMUX页面配置使能相应外设Peripherals,并在Special Pin Muxing中使能相应的“Use Alternate ADC “Trigger Option””;

    2,ETPWM的SOC Interrupt Event Selection,使能ADC SOCA,及配置SOCASEL寄存器;

    3,ADC的触发源配置,即ADC1 Event Group Trigger Source的选择。

    配置好以上几点后,在main()中做adcEnableNotification及adcStartConversion。举例-如下代码:

    int main(void) {
    	/* USER CODE BEGIN (3) */
    	//_enable_interrupt_();
            int a=0,n=1;
    	adcInit();
    	etpwmInit();
    	adcEnableNotification(adcREG1, adcGROUP0);
    	/* Enable IRQ - Clear I flag in CPS register */
    	/* Note: This is usually done by the OS or in an svc dispatcher */
    	_enable_IRQ_interrupt_();
    	adcStartConversion(adcREG1, adcGROUP0);
    	while (1) {
    		if (flag_int_adc == 1)
    			a=n;
    			//	break;
    	}
    	/* USER CODE END */
    
    	return 0;
    }