【Infineon XMC 应用笔记】 XMC1000 and XMC4000 CCU8 捕获比较单元 Part 2

1. CCU8 PWM多通道控制:

每个CAPCOM8(CCU80/-81)单元都是一个可用于多种应用的多用途计时单元。它由基本功能完全相同的计时子模组单元组成的结。这允许重复使用开发的软体底层驱动程式。图为CC8x单元4个CC8y计时子模组之一的功能方块图。
多通道功能可运用于马达电机三相控制,和电源全桥控制应用中。


2. CCU8 PWM死区时间生成:

每个CAPCOM8 计时子模组都提供两个独立的8 位死区时间计数器,这两个计数器可以在两个比较通道的上升和下降的转变中生成独立的死区时间。这个可以用于防止短路,例如可以用于对由MOSFETH组成的H桥的优化控制。



3. CCU8 Configuration and LLD Example Code:

#include "xmc_ccu8.h"

//* CCU8 Configuration for the 3 Slices */
static const XMC_CCU8_SLICE_COMPARE_CONFIG_t SLICE_config =
{
          .timer_mode = (uint32_t)XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA,
          .monoshot = (uint32_t)XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT,
          .shadow_xfer_clear = 0U,
          .dither_timer_period = 0U,
          .dither_duty_cycle = 0U,
          .prescaler_mode = (uint32_t)XMC_CCU8_SLICE_PRESCALER_MODE_NORMAL,
          .mcm_ch1_enable = 0U,
          .mcm_ch2_enable = 0U,
          .slice_status = (uint32_t)XMC_CCU8_SLICE_STATUS_CHANNEL_1,
          .passive_level_out0 = (uint32_t)XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW,
          .passive_level_out1 = (uint32_t)XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW,
          .passive_level_out2 = (uint32_t)XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW,
          .passive_level_out3 = (uint32_t)XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW,
          .asymmetric_pwm = 0U,
          .invert_out0 = 0U,
          .invert_out1 = 1U,
          .invert_out2 = 0U,
          .invert_out3 = 1U,
          .prescaler_initval = 0U,
          .float_limit = 0U,
          .dither_limit = 0U,
          .timer_concatenation = 0U,
};

/* Dead time configuration structure*/
XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t SLICE_dt_config =
{
          .enable_dead_time_channel1 = 1U,
          .enable_dead_time_channel2 = 0U,
          .channel1_st_path = 1U,
          .channel1_inv_st_path = 1U,
          .channel2_st_path = 0U,
          .channel2_inv_st_path = 0U,
          .div = (uint32_t) XMC_CCU8_SLICE_DTC_DIV_1,

          .channel1_st_rising_edge_counter = 24U,
          .channel1_st_falling_edge_counter = 12U,
          .channel2_st_rising_edge_counter = 0U,
          .channel2_st_falling_edge_counter = 0U,
};

//Enable clock
XMC_CCU8_Init(CCU80, XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR);
//Start the prescaler
XMC_CCU8_StartPrescaler(CCU80);
//Start of CCU8 configurations
XMC_CCU8_SetModuleClock(CCU80, XMC_CCU8_CLOCK_SCU);
//Configure CCU8x_CC8y slice as timer
XMC_CCU8_SLICE_CompareInit(SLICE0_PTR, &SLICE_config);
//Set period match value
XMC_CCU8_SLICE_SetTimerPeriodMatch(SLICE0_PTR, Period_Value);
//Set timer compare match value for duty
XMC_CCU8_SLICE_SetTimerCompareMatch(SLICE0_PTR, XMC_CCU8_SLICE_COMPARE_CHANNEL_1, (Period_Value >> 1));
XMC_CCU8_SLICE_SetTimerCompareMatch(SLICE0_PTR, XMC_CCU8_SLICE_COMPARE_CHANNEL_2, (Period_Value >> 1));
//Transfer value from shadow
XMC_CCU8_EnableShadowTransfer(MODULE_PTR, XMC_CCU8_SHADOW_TRANSFER_SLICE_0);
//Configure events
XMC_CCU8_SLICE_ConfigureEvent(SLICE0_PTR, XMC_CCU8_SLICE_EVENT_0, &SLICE_event0_config);
XMC_CCU8_SLICE_StartConfig(SLICE0_PTR, XMC_CCU8_SLICE_EVENT_0, XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR);
//Enable events
XMC_CCU8_SLICE_EnableEvent(SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH);
XMC_CCU8_SLICE_EnableEvent(SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH);
//Connect SR0
XMC_CCU8_SLICE_SetInterruptNode(SLICE0_PTR, XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH, XMC_CCU8_SLICE_SR_ID_0);
//Set NVIC priority
NVIC_SetPriority(CCU80_0_IRQn, 63U);
//Enable IRQ
NVIC_EnableIRQ(CCU80_0_IRQn);
//Deadtime initialisation
XMC_CCU8_SLICE_DeadTimeInit(SLICE0_PTR, &SLICE_dt_config);
XMC_CCU8_EnableClock(MODULE_PTR, SLICE0_NUMBER);



4. 参考资料来源:
(1) Peripheral - Capture and Compare Unit 8 (CCU8)
https://www.infineon.com/dgdl/Infineon-IP_CCU8_XMC-TR-v01_02-EN.pdf?fileId=5546d4624ad04ef9014b0780b3482262
(2) AP32288 - XMC1000/XMC4000 - Capture Compare Unit 8(CCU8)
https://www.infineon.com/dgdl/Infineon-CCU8-XMC1000_XMC4000-AP32288-AN-v01_01-EN.pdf?fileId=5546d4624e765da5014ed8dd5c7d1730
(3) XMC4700 XMC4800 Reference Manual
https://www.infineon.com/dgdl/Infineon-ReferenceManual_XMC4700_XMC4800-UM-v01_03-EN.pdf?fileId=5546d462518ffd850151904eb90c0044

★博文内容均由个人提供,与平台无关,如有违法或侵权,请与网站管理员联系。

★博文作者未开放评论功能