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

cross mob
User12789
Level 3
Level 3
10 sign-ins First solution authored 5 sign-ins

I'm using a CCU8 slice to generate complementary PWM outputs to control the upper and lower MOSFETs on an half-bridge. I need to temporarily stop PWM output and drive both the upper and lower MOSFET gates low (to turn them off). I need the slice to retain its settings because I will reenable its PWM output at a later time.

I can think of two ways to do this: 1) put the slice in idle mode by writing to the Global Idle Set (GIDLS) register, and 2) clearing the timer run bit in the TCCLR register.

Which one of these is the preferred method for temporarily stopping PWM output on a CCU8 slice and force both outputs to the low state? I need to make sure that both outputs are set to low to prevent shoot-through. If there's a better method for doing this, please let me know, I'd be most appreciative.

Note: Setting the PWM duty cycle to 0% won't work because although the upper MOSFET will be off, the lower MOSFET (driven by the complementary output of the CCU8) will be on--I need both to be off.

0 Likes
1 Solution
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

 Hi @User12789,

While stopping the CCU8 slice:

1. Save the port I/O control register contents. This will be available in Pn_IOCR0, Pn_IOCR4, Pn_IOCR8 and/or Pn_IOCR12 according to the pin(s) used in your application.

2. Set the TRBC bit of TCCLR register to 1. This clears the run bit of the timer.

3. Configure the pins as output pins through the Pn_IOC register(s). Refer to the solution of the the following thread for more details: https://community.infineon.com/t5/XMC/Problems-with-symmetric-CCU-8-always-keep-a-pin-at-a-high-leve...

While starting the CCU8 slice:

1. Restore the saved Pn_IOCR contents. This restores the initial functionality for the GPIOs.

2. Set the TRSB bit of TCSET register to 1. This sets the run bit of the timer and timer starts.

Regards,
Nikhil

 

View solution in original post

0 Likes
4 Replies
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @User12789,

Yes, you may put the slice in idle mode. Also, you may enable and disable the CCU8 module by using the XMC_CCU8_EnableModule() and XMC_CCU8_DisableModule() APIs.

The passive levels of the outputs can be set to low as shown below:

ncbs_0-1654074916290.png

Regards,
Nikhil

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @User12789,

XMC_CCU8_SLICE_StartTimer() and XMC_CCU8_SLICE_StopTimer() APIs start and stop the timer counting operations respectively. The function prototypes are as follows:

  • void XMC_CCU8_SLICE_StartTimer ( XMC_CCU8_SLICE_t *const slice )
  • void XMC_CCU8_SLICE_StopTimer ( XMC_CCU8_SLICE_t *const slice )

Regards,
Nikhil

0 Likes
User12789
Level 3
Level 3
10 sign-ins First solution authored 5 sign-ins

Thanks for the reply, Nikhil.

I should have mentioned in my original post that I’m not using the XMC APIs—I’m programming the MCU (an XMC4400) directly at the register level.

How do the StartTimer and StopTimer functions work at the register level? How are the passive levels set?

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

 Hi @User12789,

While stopping the CCU8 slice:

1. Save the port I/O control register contents. This will be available in Pn_IOCR0, Pn_IOCR4, Pn_IOCR8 and/or Pn_IOCR12 according to the pin(s) used in your application.

2. Set the TRBC bit of TCCLR register to 1. This clears the run bit of the timer.

3. Configure the pins as output pins through the Pn_IOC register(s). Refer to the solution of the the following thread for more details: https://community.infineon.com/t5/XMC/Problems-with-symmetric-CCU-8-always-keep-a-pin-at-a-high-leve...

While starting the CCU8 slice:

1. Restore the saved Pn_IOCR contents. This restores the initial functionality for the GPIOs.

2. Set the TRSB bit of TCSET register to 1. This sets the run bit of the timer and timer starts.

Regards,
Nikhil

 

0 Likes