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:ECAP 中断冲突

Guru**** 2460850 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/648245/compiler-tms570ls0714-ecap-interrupt-conflict

器件型号:TMS570LS0714

工具/软件:TI C/C++编译器

尊敬的所有:
     我使用 ecap4 ecap5来捕获两 个 PWM,但  ecap4 ecap5 冲突。

当 ecap4  中断 计算时、Duty,ecap5即将到来。

duty4 跳转至零。

void DTS_capInit (void)

   ecapInit();
  /*配置 ECAP4 */*配置事件1以捕捉上升沿*/
  ecapSetCaptureEvent1 (ecapREG4、上升沿、复位禁用);
 /*配置事件2以捕获下降沿*/
 ecapSetCaptureEvent2 (ecapREG4、下降沿、复位禁用);
 /*配置事件3以捕获上升沿并启用复位计数器*/
 ecapSetCaptureEvent3 (ecapREG4、上升沿、RESET_ENABLE);
 /*将 Capure 模式设置为连续事件,并将后续事件设置为 CAP3 */
 ecapSetCaptureMode (ecapREG4、连续、CAPTURE_EVENT3);
 /*开始计数器*/
 ecapStartCounter (ecapREG4);
 /*启用捕获加载*/
 ecapEnableCapture (ecapREG4);
 /*为 CAP3事件启用中断*/
 ecapEnableInterrupt (ecapREG4、ecapInt_CEVT3);


 /*配置 ECAP5 */*配置事件1以捕获上升沿*/
 ecapSetCaptureEvent1 (ecapREG5、上升沿、复位禁用);
 /*配置事件2以捕获下降沿*/
 ecapSetCaptureEvent2 (ecapREG5、FALLING_EDGE、RESET_DISABLE);
 /*配置事件3以捕获上升沿并启用复位计数器*/
 ecapSetCaptureEvent3 (ecapREG5、上升沿、RESET_ENABLE);
 /*将 Capure 模式设置为连续事件,并将后续事件设置为 CAP3 */
 ecapSetCaptureMode (ecapREG5、Continuous、CAPTURE_EVENT3);
 /*开始计数器*/
 ecapStartCounter (ecapREG5);
 /*启用捕获加载*/
 ecapEnableCapture (ecapREG5);
 /*为 CAP3事件启用中断*/
 ecapEnableInterrupt (ecapREG5、ecapInt_CEVT3);

int dts_duty1、dts_duty2;
float Duty_cap4、period_cap4、Duty_cap5、period_cap5;
void ecapNotification (ecapBASE-t * ECAP、uint16标志)

  uint32 cap_1、cap_2、cap_3;

 if (eCAP ==ecapREG4)
 {
   CAP_1 = ecapGetCAP1 (ecapREG4);
   CAP_2 = ecapGetCAP2 (ecapREG4);
   CAP_3 = ecapGetCAP3 (ecapREG4);
   Duty_cap4 =(CAP_2 - CAP_1)* 1000/VCLK4_FREQ;
   Period_cap4 =(CAP_3 - CAP_1)* 1000/VCLK4_FREQ;
   DTS_duty1 = Duty_cap4/Period_cap4*100;
  }
  否则、如果(ECAP = ecapREG5)
  {
   CAP_1 = ecapGetCAP1 (ecapREG5);
   CAP_2 = ecapGetCAP2 (ecapREG5);
   CAP_3 = ecapGetCAP3 (ecapREG5);
   Duty_cap5 =(CAP_2 - CAP_1)* 1000/VCLK4_FREQ;
   Period_cap5 =(CAP_3 - CAP_1)* 1000/VCLK4_FREQ;
   DTS_duty2 = Duty_cap5/period_cap5*100;
  }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Yang、

    当 CPU 进入中断处理例程(例如、eCAP3 ISR)时、IRQ 被自动禁用。 在最后一个 ISR 完成之前、CPU 不会处理 eCAP4 ISR。

    请在 Duty_cap4 =(cap_2 - cap_1)*1000/VCLK4_FREQ 处添加一个断点;

    在检查 CPSR 寄存器时、I 位应设置:

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Yang、

    有更新吗?