XMC1100 LED Circuit/ Output problem using GPIO.h

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

cross mob
atvmainiac
Level 1
Level 1
5 questions asked 10 sign-ins First solution authored

Im extremely new to the infineon product line.

i recently ordered the 1100 boot kit board, and ive been playing with the online simulator. 

i cant seem to get the simulator to turn on a simple output using the GPIO.h functions. i even used the examples provided with the DAVE 4 program but i cant seem to find any support documents to see where im going wrong.

i initialized the pin by the following

P0_5_set_mode(OUTPUT_OD_GP);

and tried to turn on the output as follows

P0_5_set();

P0_5_reset();

P0_5_toggle();

 

none of these give me an open drain output. can someone post a code example or explain what i may be doing wrong? also, if anyone could help define all of the GPIO functions like read();, reset();, etc. i would greatly appreciate it.

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

Hi @atvmainiac,

I believe you are trying to program the example codes present on the XMC1100 Boot Kit homepage

ncbs_0-1647751666598.png

 

Blinky Example with Apps uses DAVE APPS in the project. The configurable parameters are set in the APP GUI. For example, for a DIGITAL_IO APP, the configurator looks as shown in the picture below. You may open this by double-clicking on the APP.

ncbs_1-1647751925118.png

Open-drain mode can drive only low voltage. An external pull-up resistor is required to drive high voltage. If you want to use open-drain mode, make sure you have an external pull-up resistor. Else you may use push pull mode, which is capable of driving both low and high voltages. You may find these information in the APP Help (Right click on the APP -> App Help. Information regarding the configurable parameters may be found in the "App Configuration Parameters"].

ncbs_2-1647752305743.png

ncbs_3-1647752356408.png

 

Using APIs in Blinky Example and Blinky Example with Apps: You may find these functions in xmc_gpio.h

  1. Initialising GPIO: void XMC_GPIO_Init(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config)
  2. Toggling GPIO: __STATIC_INLINE void XMC_GPIO_ToggleOutput(XMC_GPIO_PORT_t *const port, const uint8_t pin)
  3. Setting GPIO: __STATIC_INLINE void XMC_GPIO_SetOutputHigh(XMC_GPIO_PORT_t *const port, const uint8_t pin)
  4. Resetting GPIO: __STATIC_INLINE void XMC_GPIO_SetOutputLow(XMC_GPIO_PORT_t *const port, const uint8_t pin)
  5. Setting output mode: void XMC_GPIO_SetMode(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode)

 

You may set the mode to push pull by using the macro XMC_GPIO_MODE_OUTPUT_PUSH_PULL  and open drain by using XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN. This can be set during initialization or you may use XMC_GPIO_SetMode function. Refer to the below code snippets:

#define LED1 P0_5

XMC_GPIO_CONFIG_t gpio_output_config =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
.output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH,
};

XMC_GPIO_Init(LED1, &gpio_output_config);

or 

#define LED1 P0_5

XMC_GPIO_SetMode(LED1, XMC_GPIO_MODE_OUTPUT_PUSH_PULL);

 

Refer to Blinky Example and Blinky Example with Apps code examples for detailed implementation.

Regards,
Nikhil

View solution in original post

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

Hi @atvmainiac,

I believe you are trying to program the example codes present on the XMC1100 Boot Kit homepage

ncbs_0-1647751666598.png

 

Blinky Example with Apps uses DAVE APPS in the project. The configurable parameters are set in the APP GUI. For example, for a DIGITAL_IO APP, the configurator looks as shown in the picture below. You may open this by double-clicking on the APP.

ncbs_1-1647751925118.png

Open-drain mode can drive only low voltage. An external pull-up resistor is required to drive high voltage. If you want to use open-drain mode, make sure you have an external pull-up resistor. Else you may use push pull mode, which is capable of driving both low and high voltages. You may find these information in the APP Help (Right click on the APP -> App Help. Information regarding the configurable parameters may be found in the "App Configuration Parameters"].

ncbs_2-1647752305743.png

ncbs_3-1647752356408.png

 

Using APIs in Blinky Example and Blinky Example with Apps: You may find these functions in xmc_gpio.h

  1. Initialising GPIO: void XMC_GPIO_Init(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config)
  2. Toggling GPIO: __STATIC_INLINE void XMC_GPIO_ToggleOutput(XMC_GPIO_PORT_t *const port, const uint8_t pin)
  3. Setting GPIO: __STATIC_INLINE void XMC_GPIO_SetOutputHigh(XMC_GPIO_PORT_t *const port, const uint8_t pin)
  4. Resetting GPIO: __STATIC_INLINE void XMC_GPIO_SetOutputLow(XMC_GPIO_PORT_t *const port, const uint8_t pin)
  5. Setting output mode: void XMC_GPIO_SetMode(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode)

 

You may set the mode to push pull by using the macro XMC_GPIO_MODE_OUTPUT_PUSH_PULL  and open drain by using XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN. This can be set during initialization or you may use XMC_GPIO_SetMode function. Refer to the below code snippets:

#define LED1 P0_5

XMC_GPIO_CONFIG_t gpio_output_config =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
.output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH,
};

XMC_GPIO_Init(LED1, &gpio_output_config);

or 

#define LED1 P0_5

XMC_GPIO_SetMode(LED1, XMC_GPIO_MODE_OUTPUT_PUSH_PULL);

 

Refer to Blinky Example and Blinky Example with Apps code examples for detailed implementation.

Regards,
Nikhil

atvmainiac
Level 1
Level 1
5 questions asked 10 sign-ins First solution authored

Thank you, i knew i had something wrong. the way you explained this makes much more sense inline with other IDEs and MCUs ive used in the past. much appreciated.

0 Likes
atvmainiac
Level 1
Level 1
5 questions asked 10 sign-ins First solution authored

After further review of the help link, i realized my understanding of open drain was completely off. i i had the anode of the LED tied to %V, and cathode to the pin, uswing the pin as my gnd refernce. i did not realize that i had it backwards, and my logic was that the MCU provided my path to ground. i realize now that this is not quite the case. to clarify, the xmc1100 does have an internal oull up, but its not big enough to drive a higher load. correct?

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

Hi @atvmainiac,

A pin has both pull-up and pull-down devices. You may see that in Figure 18-1 in XMC1100 Reference Manual. So, based on the mode chosen (open drain or push-pull), pull-down and/or pull-up devices will be operational.

ncbs_1-1647884410910.png

 

Regarding load:

Refer to table 3.2.1 Input/Output Characteristics in XMC1100 Data Sheet. This table summarises all the parameter values defined for operating conditions. In XMC1100, Port 1 pins support high current driving capability. 

ncbs_3-1647885526966.png

The maximum current per pin or maximum current per high current pins define the maximum current driving capability of that respective pin. Any load which is attempted to be driven directly from the MCU pin should be in compliance with these values.

ncbs_2-1647885388758.png

 

Regards,
Nikhil

0 Likes