Skip to content

Infineon/mtb-example-xmc-pccm-buck-single

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XMC™ MCU: PCCM buck converter

This example implements a buck converter in peak current control mode for being used with the XMC™ Digital Power Explorer Board. The XMC™ Digital Power Explorer Board can be used with XMC1300 Digital Power Control Card or XMC4200 Digital Power Control Card.

This example contains configurations for running on both these drive cards. The XMC1300 Digital Power Control Card is with a 32-bit Arm® Cortex®-M0 based microcontroller (XMC1302) and XMC4200 Digital Power Control Card is with a 32-bit Arm® Cortex®-M4 based microcontroller with floating-point unit (XMC4200).

Requirements

  • ModusToolbox™ v3.1
  • Board support package (BSP) minimum required version: (KIT_XMC13_DPCC_V1) v2.3.0
  • Board support package (BSP) minimum required version: (KIT_XMC42_DPCC_V1) v2.3.0
  • SEGGER J-Link software
  • Programming language: C
  • Associated parts: All XMC™ MCU parts

Supported toolchains (make variable 'TOOLCHAIN')

  • GNU Arm® Embedded Compiler v10.3.1 (GCC_ARM) – Default value of TOOLCHAIN

Supported kits (make variable 'TARGET')

Hardware setup

You can use this example in the following configurations:

  • XMC1300 Digital Power Control Card + XMC™ Digital Power Explorer Board: While using this configuration, select KIT_XMC13_DPCC_V1 as the BSP.

  • XMC4200 Digital Power Control Card + XMC™ Digital Power Explorer Board: While using this configuration, select KIT_XMC42_DPCC_V1 as the BSP.

Software setup

See the ModusToolbox™ tools package installation guide for information about installing and configuring the tools package.

This example requires no additional software or tools.

Using the code example

Create the project

The ModusToolbox™ tools package provides the Project Creator as both a GUI tool and a command line tool.

Use Project Creator GUI
  1. Open the Project Creator GUI tool.

    There are several ways to do this, including launching it from the dashboard or from inside the Eclipse IDE. For more details, see the Project Creator user guide (locally available at {ModusToolbox™ install directory}/tools_{version}/project-creator/docs/project-creator.pdf).

  2. On the Choose Board Support Package (BSP) page, select a kit supported by this code example. See Supported kits.

    Note: To use this code example for a kit not listed here, you may need to update the source files. If the kit does not have the required resources, the application may not work.

  3. On the Select Application page:

    a. Select the Applications(s) Root Path and the Target IDE.

    Note: Depending on how you open the Project Creator tool, these fields may be pre-selected for you.

    b. Select this code example from the list by enabling its check box.

    Note: You can narrow the list of displayed examples by typing in the filter box.

    c. (Optional) Change the suggested New Application Name and New BSP Name.

    d. Click Create to complete the application creation process.

Use Project Creator CLI

The 'project-creator-cli' tool can be used to create applications from a CLI terminal or from within batch files or shell scripts. This tool is available in the {ModusToolbox™ install directory}/tools_{version}/project-creator/ directory.

Use a CLI terminal to invoke the 'project-creator-cli' tool. On Windows, use the command-line 'modus-shell' program provided in the ModusToolbox™ installation instead of a standard Windows command-line application. This shell provides access to all ModusToolbox™ tools. You can access it by typing "modus-shell" in the search box in the Windows menu. In Linux and macOS, you can use any terminal application.

The following example clones the "mtb-example-xmc-pccm-buck-single" application with the desired name "PCCM_buck" configured for the KIT_XMC42_DPCC_V1 BSP into the specified working directory, C:/mtb_projects:

project-creator-cli --board-id KIT_XMC42_DPCC_V1 --app-id mtb-example-xmc-pccm-buck-single --user-app-name PCCM_buck --target-dir "C:/mtb_projects"

The 'project-creator-cli' tool has the following arguments:

Argument Description Required/optional
--board-id Defined in the field of the BSP manifest Required
--app-id Defined in the field of the CE manifest Required
--target-dir Specify the directory in which the application is to be created if you prefer not to use the default current working directory Optional
--user-app-name Specify the name of the application if you prefer to have a name other than the example's default name Optional

Note: The project-creator-cli tool uses the git clone and make getlibs commands to fetch the repository and import the required libraries. For details, see the "Project creator tools" section of the ModusToolbox™ tools package user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mtb_user_guide.pdf).

Open the project

After the project has been created, you can open it in your preferred development environment.

Eclipse IDE

If you opened the Project Creator tool from the included Eclipse IDE, the project will open in Eclipse automatically.

For more details, see the Eclipse IDE for ModusToolbox™ user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mt_ide_user_guide.pdf).

Visual Studio (VS) Code

Launch VS Code manually, and then open the generated {project-name}.code-workspace file located in the project directory.

For more details, see the Visual Studio Code for ModusToolbox™ user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mt_vscode_user_guide.pdf).

Command line

If you prefer to use the CLI, open the appropriate terminal, and navigate to the project directory. On Windows, use the command-line 'modus-shell' program; on Linux and macOS, you can use any terminal application. From there, you can run various make commands.

For more details, see the ModusToolbox™ tools package user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mtb_user_guide.pdf).

Operation

You can use this code example with the KIT_XMC13_DPCC_V1 or KIT_XMC42_DPCC_V1 board paired with XMC™ Digital Power Explorer Board. If you use this code example with KIT_XMC42_DPCC_V1, connect the board to the XMC™ Digital Power Explorer Board and set the SV5 jumper to the XMC4000 option. If you use this code example with KIT_XMC13_DPCC_V1, connect the board to the XMC™ Digital Power Explorer Board and set the jumper SV5 to the XMC1000 option.

To provide the input power, XMC™ Digital Power Explorer Board comes with a 12 V adaptor. Connect the adaptor output to the 12 V DC Supply Jack (J2) of the XMC™ Digital Power Explorer Board. The regulated output voltage is available in the testpoint marked 'VOUT FILT' on the XMC™ Digital Power Explorer Board. To monitor the regulated output voltage, connect an oscilloscope or multimeter to this point.

  1. Connect the board to your PC using the provided USB cable through the JLink USB connector.

  2. Program the board using one of the following:

    Using Eclipse IDE
    1. Select the application project in the Project Explorer.

    2. In the Quick Panel, scroll down, and click <Application Name> Program (JLink).

    In other IDEs

    Follow the instructions in your preferred IDE.

    Using CLI

    From the terminal, execute the make program command to build and program the application using the default toolchain to the default target. The default toolchain is specified in the application's Makefile but you can override this value manually:

    make program TOOLCHAIN=<toolchain>
    

    Example:

    make program TOOLCHAIN=GCC_ARM
    
  3. After programming, the application starts automatically.

  4. Check that the XMC™ Digital Power Explorer Board produces 3.3 V output.

  5. Try varying the load on the output using the switches SW1, SW2, and SW3 and verify that the output voltage is maintained.

Debugging

You can debug the example to step through the code.

In Eclipse IDE

Use the <Application Name> Debug (JLink) configuration in the Quick Panel. For details, see the Program and debug section in the Eclipse IDE for ModusToolbox™ user guide.

In other IDEs

Follow the instructions in your preferred IDE.

Design and implementation

XMC1302 MCU configuration

For the XMC1302 MCU, the control loop is implemented by a 2-poles 2-zeros filter using fixed-point values. The filter coefficients have been selected to have the following controller characteristics:

Table 1. Filter coefficients for XMC1302 MCU

Description Value
Vout 3.3 V
Switching freq 100 kHz
Crossover freq 5 kHz
Phase margin 50 degrees
PWM master clock 64 MHz
ADC resolution 12 bits
Max duty 90%

Filter-related APIs are implemented in the xmc_2p2z_filter_fixed.h file and the PWM initialization and control ISR are implemented in the xmc13_pccm_buck_single.c file.

XMC4200 MCU configuration

For the XMC4200 MCU, the control loop is implemented by a 2-poles 2-zeros filter using floating-point values. The filter coefficients have been selected to have the following controller characteristics:

Table 2. Filter coefficients for XMC4200 MCU

Description Value
Vout 3.3 V
Switching freq 200 kHz
Crossover freq 10 kHz
Phase margin 60 degrees
PWM clock 80 MHz
ADC resolution 12 bits
Max duty 90%

Filter-related APIs are implemented in the xmc_2p2z_filter_float.h file and the PWM initialization and control ISR are implemented in the xmc42_pccm_buck_single.c file.

Select the required BSP based on the drive card used.

Resources and settings

Table 3. Application resources on KIT_XMC13_DPCC_V1

Resource Alias/object Purpose
PWM P0_0 PWM Direct Output
PWM Compl P0_5 PWM Complementary Output
ADC Input P2_3 ADC Analog Input (Output Voltage)
COMP In P2_9 Comparator Input (Inductor Current)
COMP In Inv P2_8 Comparator Input (Inductor reference voltage)
PWM Ref P0_9 Reference generator PWM output

Table 4. Application resources on KIT_XMC42_DPCC_V1

Resource Alias/object Purpose
PWM P0_5 PWM direct output
PWM Compl P0_2 PWM complementary output
ADC Input P14_6 ADC analog input (output voltage)
CSG Input P1_0 Comparator input (inductor current)

Related resources

Resources Links
Code examples Using ModusToolbox™ on GitHub
Kit guides XMC1300 Digital Power Control Card user manual
XMC4200 Digital Power Control Card user manual
Device documentation XMC1000 family datasheets
XMC1000 family technical reference manuals
XMC4000 family datasheets
XMC4000 family technical reference manuals
Development kits XMC™ eval boards
Libraries on GitHub mtb-xmclib-cat3 – XMC™ peripheral driver library (XMCLib) and docs
Tools ModusToolbox™ – ModusToolbox™ software is a collection of easy-to-use libraries and tools enabling rapid development with Infineon MCUs for applications ranging from wireless and cloud-connected systems, edge AI/ML, embedded sense and control, to wired USB connectivity using PSoC™ Industrial/IoT MCUs, AIROC™ Wi-Fi and Bluetooth® connectivity devices, XMC™ Industrial MCUs, and EZ-USB™/EZ-PD™ wired connectivity controllers. ModusToolbox™ incorporates a comprehensive set of BSPs, HAL, libraries, configuration tools, and provides support for industry-standard IDEs to fast-track your embedded application development.

Other resources

Infineon provides a wealth of data at www.infineon.com to help you select the right device, and quickly and effectively integrate it into your design.

For XMC™ MCU devices, see 32-bit XMC™ industrial microcontroller based on Arm® Cortex®-M.

Document history

Document title: CE239197XMC™ MCU: PCCM buck converter

Version Description of change
1.0.0 New code example

All referenced product or service names and trademarks are the property of their respective owners.

The Bluetooth® word mark and logos are registered trademarks owned by Bluetooth SIG, Inc., and any use of such marks by Infineon is under license.

© 2023 Infineon Technologies AG

All Rights Reserved.

Legal disclaimer

The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics. With respect to any examples or hints given herein, any typical values stated herein and/or any information regarding the application of the device, Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind, including without limitation, warranties of non-infringement of intellectual property rights of any third party.

Information

For further information on technology, delivery terms and conditions and prices, please contact the nearest Infineon Technologies Office (www.infineon.com).

Warnings

Due to technical requirements, components may contain dangerous substances. For information on the types in question, please contact the nearest Infineon Technologies Office.

Infineon Technologies components may be used in life-support devices or systems only with the express written approval of Infineon Technologies, if a failure of such components can reasonably be expected to cause the failure of that life-support device or system or to affect the safety or effectiveness of that device or system. Life support devices or systems are intended to be implanted in the human body or to support and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health of the user or other persons may be endangered.