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

XMC™ Forum Discussions

Not applicable
Hi all,

I am trying to figure out how to use a CCU8 module on an Infineon XMC4700 Relax Kit MCU board, and eventually generate a PWM signal. For starters, I am attempting at making a program that will vary the duty cycle on a PWM pin internally connected to an LED - pin map suggests that pins P5.8 and P5.9 (two on-board LEDs) indeed have CCU8 listed here[1] (datasheet) as their alternate functions. Some extra documentation is available for an XMC4500 MCU board with a very similar architecture and libraries, which is where I got the following example code that is intended to configure 3rd alternative function on a specific pin:

XMC_GPIO_CONFIG_t OUTPUT_strong_sharp_config =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3,
.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE
};

Here[2] is the source of this code. Now my question is regarding the different available options to configuring the pin as an output pin with an alternate function enabled, namely configuring the pin as simply an output with ALT3 enabled or configuring the pin as a push-pull output with ALT3 enabled. What is the difference between the two, and is it critical for PWM applications? Here is how it looks like in the header file.


XMC_GPIO_MODE_OUTPUT_ALT3 = 0x3UL << PORT0_IOCR0_PC0_Pos,
XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT3, /**< Push-pull alternate output function 3 */

[1] http://www.infineon.com/dgdl/Infineon-XMC4700-XMC4800-DS-v00_07-EN.pdf?fileId=5546d462518ffd85015190... - XMC4700/XMC4800 Datasheet

[2] http://www.infineon.com/dgdl/Infineon-CCU8-XMC1000_XMC4000-AP32288-AN-v01_00-EN.pdf?fileId=5546d4624...
0 Likes
2 Replies
chismo
Employee
Employee
First like received
Hello,

The GPIO supports the following 2 output modes:
1) Push-pull
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3,

2) Open drain
.mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT3


"XMC_GPIO_MODE_OUTPUT_ALT3" is an atomic representation of the alternate function line and on its own, is not enough to configure the GPIO.
To select output + alternate function (similar to <1> above), you need:
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT3


I think typically for PWM applications, the push-pull option is used.

Regards,
Min Wei
0 Likes
Not applicable
Hi Min Wei,

Thank you for your reply - I have been trying to find this information in the documentation for the MCU, but unfortunately I was unable to do so, although it is worth noting that I at most skimmed through the datasheet and reference manual. I would like to note that, indeed, the following configuration worked for me and PWM peripheral worked as it should (note that the sharp edge configuration is valid for A2 class pads):

	XMC_GPIO_CONFIG_t OUTPUT_strong_sharp_config =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3,
.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE
};
0 Likes