Thread 中讨论的其他器件:C2000WARE
工具与软件:
您好!
如本文所述、用于设置 CMPCTL 寄存器位的驱动程序库调用中存在一个错误。 这种异常基本上会将带有数字滤波器 CTRIPH 和 CTRIPL 的 COMPH/L 输出推入或门、而 COMPCTL 输出所选的控件。
从表面上看、图16-1显示了异步路径是一个单独的寄存器控制寄存器位状态、例如位14 (ASYNCLEN)和位6 (ASYNCHEN)。
针对 CMPCTL 寄存器位的快速处理会修改如下所示的调用、以控制 位14 ASYNCLEN 和6 ASYNCHEN。 从表面上看、这需要添加单独的新函数(cmpss.h)来以更高的精度控制数字滤波器。 当前 cmpss.h 库调用 C2000Ware 5.04及更低版本的一个意外异常;COMP_H/L 状态寄存器不会响应进入 EPWM_Xbar CMPSS MUX0.0表9-2的数字滤波器输出状态的软件复位调用。
除了通过 SYSCLK 重置斜坡发生器之外、在异步路径之后使用数字滤波器 OR'D'(图16-1 CMPSS 方框图)的原因是什么?
当为锁存或不锁存滤波器状态选择数字滤波器时、以下解决方法可校正与 COMPH 或 COMPL 输出(ASYNC 路径)进行"或"运算的数字滤波器输出锁存状态到 ePWM XBAR MUX0.0。
//*****************************************************************************
//
//! Sets the output signal configuration for the high comparator.
//!
//! \param base is the base address of the CMPSS module.
//! \param config is the configuration of the high comparator output signals.
//!
//! This function configures a comparator's output signals CTRIP and CTRIPOUT.
//! The \e config parameter is the result of a logical OR operation between the
//! \b CMPSS_TRIPOUT_xxx and \b CMPSS_TRIP_xxx values.
//!
//! The \b CMPSS_TRIPOUT_xxx term can take on the following values to specify
//! which signal drives CTRIPOUTH:
//! - \b CMPSS_TRIPOUT_ASYNC_COMP - The asynchronous comparator output.
//! - \b CMPSS_TRIPOUT_SYNC_COMP - The synchronous comparator output.
//! - \b CMPSS_TRIPOUT_FILTER - The output of the digital filter.
//! - \b CMPSS_TRIPOUT_LATCH - The latched output of the digital filter.
//!
//! The \b CMPSS_TRIP_xxx term can take on the following values to specify
//! which signal drives CTRIPH:
//! - \b CMPSS_TRIP_ASYNC_COMP - The asynchronous comparator output.
//! - \b CMPSS_TRIP_SYNC_COMP - The synchronous comparator output.
//! - \b CMPSS_TRIP_FILTER - The output of the digital filter.
//! - \b CMPSS_TRIP_LATCH - The latched output of the digital filter.
//!
//! \return None.
//
//*****************************************************************************
static inline void
CMPSS_configOutputsHigh(uint32_t base, uint16_t config)
{
//
// Check the arguments.
//
ASSERT(CMPSS_isBaseValid(base));
//
// Write the high comparator output settings to the appropriate register.
//
EALLOW;
HWREGH(base + CMPSS_O_COMPCTL) = (HWREGH(base + CMPSS_O_COMPCTL) &
~(CMPSS_COMPCTL_CTRIPOUTHSEL_M |
CMPSS_COMPCTL_CTRIPHSEL_M |
CMPSS_COMPCTL_ASYNCHEN)) |
config;
EDIS;
}
//*****************************************************************************
//
//! Sets the output signal configuration for the low comparator.
//!
//! \param base is the base address of the CMPSS module.
//! \param config is the configuration of the low comparator output signals.
//!
//! This function configures a comparator's output signals CTRIP and CTRIPOUT.
//! The \e config parameter is the result of a logical OR operation between the
//! \b CMPSS_TRIPOUT_xxx and \b CMPSS_TRIP_xxx values.
//!
//! The \b CMPSS_TRIPOUT_xxx term can take on the following values to specify
//! which signal drives CTRIPOUTL:
//! - \b CMPSS_TRIPOUT_ASYNC_COMP - OR The asynchronous comparator output.
//! - \b CMPSS_TRIPOUT_SYNC_COMP - The synchronous comparator output.
//! - \b CMPSS_TRIPOUT_FILTER - The output of the digital filter.
//! - \b CMPSS_TRIPOUT_LATCH - The latched output of the digital filter.
//!
//! The \b CMPSS_TRIP_xxx term can take on the following values to specify
//! which signal drives CTRIPL:
//! - \b CMPSS_TRIP_ASYNC_COMP - OR The asynchronous comparator output.
//! - \b CMPSS_TRIP_SYNC_COMP - The synchronous comparator output.
//! - \b CMPSS_TRIP_FILTER - The output of the digital filter.
//! - \b CMPSS_TRIP_LATCH - The latched output of the digital filter.
//!
//! \return None.
//
//*****************************************************************************
static inline void
CMPSS_configOutputsLow(uint32_t base, uint16_t config)
{
//
// Check the arguments.
//
ASSERT(CMPSS_isBaseValid(base));
//
// Write the low comparator output settings to the appropriate register.
//
EALLOW;
HWREGH(base + CMPSS_O_COMPCTL) = (HWREGH(base + CMPSS_O_COMPCTL) &
~(CMPSS_COMPCTL_CTRIPOUTLSEL_M |
CMPSS_COMPCTL_CTRIPLSEL_M |
CMPSS_COMPCTL_ASYNCLEN)) |
(config << 8U);
EDIS;
}