TMS320F28379D: ecap捕获外部输入方波时捕获值出错

Part Number: TMS320F28379D

我按照ecap_ex2_capture_pwm例程进行ecap方波捕获实验,当我捕获例程中产生的epwm波时,捕获值都是正确的。但当我用信号发生器输入同频率、同幅度的方波时,捕获值变得不正确。我尝试增加gpio口的采样时间来进行改善,但是没有任何效果。

以下是我的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//#############################################################################
//
// FILE: ecap_capture_pwm.c
//
// TITLE: Capture ePWM3.
//
//! \addtogroup driver_example_list
//! <h1>eCAP Capture PWM Example</h1>
//!
//! This example configures ePWM3A for:
//! - Up count mode
//! - Period starts at 500 and goes up to 8000
//! - Toggle output on PRD
//!
//! eCAP1 is configured to capture the time between rising
//! and falling edge of the ePWM3A output.
//!
//! \b External \b Connections \n
//! - eCAP1 is on GPIO16
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

附上一些图片:

这张是采集自身epwm波时正确的捕获值;

这张是外部输入方波时错误的捕获值。

恳求大佬的帮助!

不胜感激!