HRPWM configuration

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Kris_Ke
Level 1
Level 1
Distributor - WPG(GC)
5 replies posted 25 sign-ins 5 questions asked

I refer to the example of HRPWM in XMC_Peripheral_Library. Successful experiment HRPWM output of CCU80_CCU80.

As below link
https://community.infineon.com/t5/XMC/HRPWM-configuration/td-p/347403

And I want to configuration second HRPWM form CCU80_CCU81, 

But modified the configuration, it is still no PWM output, I have confirmed that the timer of CCU80_CCU81 is working

Could you kindly help me confirm the following information?

 

 

  /* Configure start event */
  /* Configure event 0 */
  XMC_CCU8_SLICE_ConfigureEvent(CCU80_CC81, XMC_CCU8_SLICE_EVENT_0, &START_config1);
  XMC_CCU8_SLICE_StartConfig(CCU80_CC81, XMC_CCU8_SLICE_EVENT_0, XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR);

  /* Configure CCU8x_CC8y slice as timer */
  XMC_CCU8_SLICE_CompareInit(CCU80_CC82, &SLICE_config);

  /* Set period match value of the timer  */
  XMC_CCU8_SLICE_SetTimerPeriodMatch(CCU80_CC82, 1199U);

  /* Set timer compare match value for channel 1 - 50% duty */
  XMC_CCU8_SLICE_SetTimerCompareMatch(CCU80_CC82, XMC_CCU8_SLICE_COMPARE_CHANNEL_1, 599);
  /* Set timer compare match value for channel 2 - 80% duty */
  XMC_CCU8_SLICE_SetTimerCompareMatch(CCU80_CC82, XMC_CCU8_SLICE_COMPARE_CHANNEL_2, 480);
  /* Transfer value from shadow timer registers to actual timer registers */
  XMC_CCU8_EnableShadowTransfer(CCU80, XMC_CCU8_SHADOW_TRANSFER_SLICE_2);

  /* Configure start event */
  /* Configure event 0 */
  XMC_CCU8_SLICE_ConfigureEvent(CCU80_CC82, XMC_CCU8_SLICE_EVENT_0, &START_config2);
  XMC_CCU8_SLICE_StartConfig(CCU80_CC82, XMC_CCU8_SLICE_EVENT_0, XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR);

 

 

 

XMC_HRPWM_HRC_CONFIG_t HRPWM_0_hrc_channel_config =
      {
.dt_enable                       = (uint32_t)XMC_HRPWM_FUNC_STATUS_DISABLE,
.hr_out0_trap_enable             = (uint32_t)XMC_HRPWM_FUNC_STATUS_DISABLE,
.hr_out1_trap_enable             = (uint32_t)XMC_HRPWM_FUNC_STATUS_DISABLE,
.hrc_shadow_xfer_linktoCCU8      = (uint32_t)XMC_HRPWM_FUNC_STATUS_ENABLE,
.dt_shadow_xfer_linktoCCU8       = (uint32_t)XMC_HRPWM_FUNC_STATUS_ENABLE,
.hr_out0_inv_enable              = (uint32_t)XMC_HRPWM_FUNC_STATUS_DISABLE,
.hr_out1_inv_enable              = (uint32_t)XMC_HRPWM_FUNC_STATUS_DISABLE,
.dt_trigger_sel                  = 0U,

.hr_out0_passive_level_out       = 0U,
.hr_out1_passive_level_out       = 0U,
      };

const XMC_HRPWM_HRC_SRC_CONFIG_t   HRPWM_1_hrc_src_config0 =
     {
             .high_res_mode                   = XMC_HRPWM_HRC_HR_EDGE_SEL_BOTH,
             .set_config                      = XMC_HRPWM_HRC_SRC_INPUT_CCU,
             .clear_config                    = XMC_HRPWM_HRC_SRC_INPUT_CCU,
             .cmp_set                         = XMC_HRPWM_HRC_CMP_SEL_CSG0,
             .cmp_clear                       = XMC_HRPWM_HRC_CMP_SEL_CSG0,
             .timer_sel                       = XMC_HRPWM_HRC_TIMER_SEL_CCU_CC1,
             .set_edge_config                 = XMC_HRPWM_HRC_SRC_EDGE_SEL_RISING,
             .clear_edge_config               = XMC_HRPWM_HRC_SRC_EDGE_SEL_FALLING,
             .src_trap_enable                 = XMC_HRPWM_FUNC_STATUS_DISABLE
     };

const XMC_HRPWM_HRC_SRC_CONFIG_t   HRPWM_1_hrc_src_config1 =
     {
             .high_res_mode                   = XMC_HRPWM_HRC_HR_EDGE_SEL_BOTH,
             .set_config                      = XMC_HRPWM_HRC_SRC_INPUT_CCU,
             .clear_config                    = XMC_HRPWM_HRC_SRC_INPUT_CCU,
             .cmp_set                         = XMC_HRPWM_HRC_CMP_SEL_CSG0,
             .cmp_clear                       = XMC_HRPWM_HRC_CMP_SEL_CSG0,
             .timer_sel                       = XMC_HRPWM_HRC_TIMER_SEL_CCU_CC1,
             .set_edge_config                 = XMC_HRPWM_HRC_SRC_EDGE_SEL_DISABLED,
             .clear_edge_config               = XMC_HRPWM_HRC_SRC_EDGE_SEL_DISABLED,
             .src_trap_enable                 = XMC_HRPWM_FUNC_STATUS_DISABLE
     };

 

 

 

  XMC_HRPWM_HRC_Init(HRPWM0_HRC2, &HRPWM_0_hrc_channel_config);   /* Initialise HRC Channel 0*/

  if (XMC_HRPWM_GetHRGenReadyStatus(HRPWM0) == XMC_HRPWM_HR_LOGIC_WORKING)
  {
	  XMC_HRPWM_EnableHighResolutionPath(HRPWM0, XMC_HRPWM_HR_PATH_HRC0);
    XMC_HRPWM_DisableLowResolutionPath(HRPWM0, XMC_HRPWM_LR_PATH_HRC0);
  }

  while (XMC_HRPWM_GetHRGenReadyStatus(HRPWM0) == XMC_HRPWM_HR_LOGIC_NOT_WORKING)
  {
    /* Wait until ready */
  }

  XMC_HRPWM_HRC_Set_HR_Source(HRPWM0_HRC2, XMC_HRPWM_HRC_SOURCE_1);  /* select Source 1 as HR path*/
  XMC_HRPWM_HRC_ConfigSourceSelect0(HRPWM0_HRC2, &HRPWM_1_hrc_src_config0);
  XMC_HRPWM_HRC_ConfigSourceSelect1(HRPWM0_HRC2, &HRPWM_1_hrc_src_config1);   /* Configure Source 1*/
  XMC_HRPWM_EnableHighResolutionShadowTransfer(HRPWM0, XMC_HRPWM_HRC_SHADOW_TX_HRC2_VALUE);

 

 

 

  config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT4;
  config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW;
  config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;

  XMC_GPIO_Init(P0_3, &config);
  XMC_GPIO_Init(P0_4, &config);

 

 

 

Thanks,

Kris

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @Kris_Ke ,

    The attachment you shared with us is the one you successfully output of CCU80_CCU80? I checked the attachment and compared with our example; it seems that you lost the part ' Enable compare match event', so you should first remove the redundant code and try to use CCU80_ CC81 output PWM. By the way, you can also refer to the 'Help content', which introduces how to use 'HRPWM' APP, you can follow the steps to set up your codes, with the 'HRPWM' APP, it will be much easier to configure the CCU8.  Hope this can help you.

Regards,

Owen_Su

View solution in original post

0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @Kris_Ke ,

    The attachment you shared with us is the one you successfully output of CCU80_CCU80? I checked the attachment and compared with our example; it seems that you lost the part ' Enable compare match event', so you should first remove the redundant code and try to use CCU80_ CC81 output PWM. By the way, you can also refer to the 'Help content', which introduces how to use 'HRPWM' APP, you can follow the steps to set up your codes, with the 'HRPWM' APP, it will be much easier to configure the CCU8.  Hope this can help you.

Regards,

Owen_Su

0 Likes
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

    This thread will be closed due to long time no reply, you can create a new one if you have any other question. Thanks for your understanding.

Regards,

Owen

0 Likes