Skip to main content

XMC1000 code examples

Supported evaluation kits

KIT_XMC11_BOOT_001

KIT_XMC12_BOOT_001

KIT_XMC13_BOOT_001

KIT_XMC14_BOOT_001

KIT_XMC1300_DC_V1

KIT_XMC1400_DC_V1

Getting Started

Example

Supported kit

Description

KIT_XMC11_BOOT_001

KIT_XMC12_BOOT_001

KIT_XMC13_BOOT_001

KIT_XMC14_BOOT_001

KIT_XMC1300_DC_V1

KIT_XMC1400_DC_V1

Empty XMC App

This empty application provides a template for creating applications using XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

FreeRTOS Blinky

This code example demonstrates blinking LED functionality implemented by FreeRTOS tasks running on the XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

Peripherals

Example

Supported kit

Description

KIT_XMC11_BOOT_001

KIT_XMC12_BOOT_001

KIT_XMC13_BOOT_001

KIT_XMC14_BOOT_001

KIT_XMC1300_DC_V1

KIT_XMC1400_DC_V1

Analog Comparator

This code example demonstrates the usage of the Analog Comparator (ACMP) peripheral of XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

Brownout Detection

This code example demonstrates brownout detection by reducing power supply voltage from 3.3 V to the defined voltage threshold using brownout detection available in XMC™ MCU devices. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CAN Receiver

This example demonstrates how to receive CAN messages over the CAN bus using XMC™ MCU. This example can be used together with the CAN Transmitter example running on another board. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CAN Transmitter

This example demonstrates how to transmit CAN messages over the CAN bus using XMC™ MCU. This example can be used with the CAN Receiver example running on another board. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU4 Capture

This code example demonstrates the capture features of the Capture and Compare Unit 4 (CCU4) slices available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU4 PWM

This code example demonstrates the use of CCU4 module in XMC™ MCU to create a PWM signal. The CCU4 slice is configured in monoshot mode and is restarted on an external start event. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU4 Timer

This code example demonstrates the usage of the Capture and Compare Unit 4 (CCU4) timer by blinking an LED using CCU4 timer period match interrupt available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU4 Timer Concatenation

This code example demonstrates the concatenation or linking feature of the Capture and Compare Unit 4 (CCU4) slices available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU8 Capture

This code example demonstrates the capture feature of Capture and Compare unit (CCU8) slices available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU8 PWM

This code example demonstrates how to generate PWM signals using Capture and Compare unit (CCU8) slices available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU8 PWM Complementary

This code example demonstrates generating two complementary pulse width modulated (PWM) waves using the Capture and Compare Unit(CCU8 module) available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU8 Timer

This code example demonstrates the usage of Capture-Compare Unit 8 (CCU8) in the XMC™ MCU in timer mode. The CCU8 timer slice program blinks an LED when a timer period match interrupt occurs. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU8 Timer Concatenation

This code example demonstrates the concatenation or linking feature of the Capture and Compare Unit 8 (CCU8) slices available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

CCU8 Timer Synchronous Start

This code example demonstrates the synchronous start of Capture-Compare Unit 8 (CCU80 and CCU81) in the XMC™ MCU upon receving a trigger from the Event Request Unit (ERU). The CCU8 timer slice program blinks the on-board user LEDs (CCU80 blinks User LED1 and CCU81 blinks User LED2) when a timer period match interrupt occurs. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

ERU EXTINT

This code example demonstrates Event Request Unit (ERU) functionality with external interrupt on XMC™ MCU evaluation kits. In this example, an external signal, fed into the ERU unit using a GPIO pin, triggers a service request interrupt that toggles an LED. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

Flash EEPROM

This code example shows how to use a portion of the internal flash memory of XMC™ MCUs as emulated EEPROM memory, and provides necessary APIs to perform read and write operations to the emulated EEPROM. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

Flash Program

This code example demonstrates how to erase a sector of the flash, write data to the sector and check the data for correctness on the XMC™ MCU device. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

GPIO Toggle

This code example demonstrates GPIO toggling by periodically blinking an LED using SysTick available in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

I2C Master and Slave

This code example demonstrates the implementation of an I2C master and an I2C slave on the same device based on the Universal Serial Interface Channel (USIC). The I2C master sends commands to the I2C slave to toggle the LEDs present on the XMC™ development kit. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

MATH CORDIC

This code example uses the MATH CORDIC block to perform circular, hyperbolic, and logarithmic operations. The example demonstrates the blocking, non-blocking, and direct register write operations of the CORDIC block. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

MATH SQRT

This code example uses the MATH CORDIC block to perform the square root operation for the given input number. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

POSIF Hall

This code example demonstrates a position interface (POSIF) module in Hall sensor mode and uses the capture and compare unit 4 (CCU40) module to determine the speed of rotation of the motor. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

POSIF QD

This example demonstrates a Position Interface (POSIF) module in Quadrature Decoder (QD) mode and uses the CCU40 module to determine the speed of rotation of the encoder. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

RTC Alarm

This code example demonstrates an RTC alarm interrupt of 1 minute to set a periodically blinking LED on the XMC™ MCU Evaluation kits. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

SCU Sleep

This code example demonstrates the System Control Unit (SCU) sleep mode on the XMC™ MCU evaluation kits. Wakeup is done by using an external interrupt via the Event Request Unit (ERU). An LED glows at every falling edge of the external signal inside the ERU interrupt. The MCU is put back to sleep mode again after servicing the interrupt. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

SPI EXTTRG transmit

This example demonstrates the transfer of three bytes of data using the SPI master triggered by an external event or a timer-based event in XMC™ MCU. For more details, see the README on GitHub.

SPI Master

This code example demonstrates the transfer of 3 bytes of data using SPI Master in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

TSE Calc Temperature

This code example demonstrates how to use TSE (on-chip temperature sensor). TSE calculates temperature readings from the sensor and sends them over UART periodically every 1 s. Correspondingly, the LED blinks every 1 s; the temperature readings can be observed on the terminal. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

UART Printf

This example demonstrates how to use the printf function with a Universal Serial Interface Channel (USIC) based UART in XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

UART Shell

This code example demonstrates implementation of a shell on the UART communication interface including commands to toggle a LED using XMC™ MCU. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

UART Transmit

This code example demonstrates simple UART communication by printing periodic "Hello World!!" message on a terminal and blinking an LED. The message can be seen on a PC terminal. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

UART Transmit Receive FIFO Interrupts

This code example demonstrates how to use the Tx and Rx FIFO limit interrupts and send data from the Tx buffer to the Rx buffer. If reception is successful, the on-board LED 1 glows; otherwise, the LED remains OFF. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

VADC Background

This example demonstrates how to convert a single channel using the background source in VADC. In this example, the background source continuously requests conversion. The ADC conversion result is read and displayed on the UART Terminal. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

VADC EMUX

This code example demonstrates the VADC capability to drive a external multiplexer automatically by emux output pins in XMC™ MCU. For more details, see the README on GitHub.

VADC Queue

This example demonstrates how to convert multiple channels in a dedicated sequence using the queue source in VADC. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

WDT FEED

This code example demonstrates a Watchdog Timer (WDT) on the XMC™ MCU. The WDT needs to be fed every second for proper serving of the WDT. The SysTick timer is used to feed the WDT. When feeding occurs, the User LED blinks. If there is no feeding, the device goes into reset. After the reset, the MCU checks the reason for the last reset. If it is due to a failure to feed the WDT, the User LED blinks at a faster rate. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

WDT Prewarning

This code example demonstrates the prewarning feature of the watchdog timer (WDT) on the XMC™ MCU evaluation kits. A pre-warning alarm is triggered before a watchdog reset only if the watchdog timer is not serviced properly. When a prewarning condition occurs, the User LED1 blinks once. After a watchdog reset, the MCU checks the reason for the last reset; if it was caused by a watchdog reset, the User LED2 blinks at a faster rate. For more details, see the README on GitHub. Note: Programming this code example requires installing SEGGER J-Link software.

Community Code Examples

Example

Supported kit

Description

KIT_XMC11_BOOT_001

KIT_XMC12_BOOT_001

KIT_XMC13_BOOT_001

KIT_XMC14_BOOT_001

KIT_XMC1300_DC_V1

KIT_XMC1400_DC_V1

XMC13-14 PMSM FOC SL

Disclaimer: This is a community code example (CCE) released for the benefit of the community users. These projects have only been tested for the listed BSPs, tools versions and toolchains documented in the Readme.This code example demonstrates the sensorless PMSM FOC motor control application using XMC1300/1400. In order to test this software, XMC1000 Motor Control Application Kit is needed. According to the user preference, XMC1300 or XMC1400 board can be used with this kit.For more details, see the README on GitHub.

XMC13-14 PMSM FOC SL DC

Disclaimer: This is a community code example (CCE) released for the benefit of the community users. These projects have only been tested for the listed BSPs, tools versions and toolchains documented in the Readme.This community code example (CCE) demonstrates the sensorless PMSM FOC motor control application using XMC1300/1400 Drive Card. In order to test this software; XMC1300 or XMC1400 Drive Card, 3-phase DC power board, and Nanotec DC motor (DB42S03) are needed.For more details, see the README on GitHub.

XMC1300 BLDC Scalar Hall

Disclaimer: This is a community code example (CCE) released for the benefit of the community users. These projects have only been tested for the listed BSPs, tools versions and toolchains documented in the Readme.This community code example (CCE) demonstrates Hall sensor based three phase BLDC motor control application using XMC1300 Boot Kit. In order to test this software, XMC1000 Motor Control Application Kit is needed. For more details, see the README on GitHub.

XMC1300 BLDC Scalar Sensorless

Disclaimer: This is a community code example (CCE) released for the benefit of the community users. These projects have only been tested for the listed BSPs, tools versions and toolchains documented in the Readme.This community code example (CCE) demonstrates sensorless three-phase BLDC motor control application using XMC1300 Boot Kit. In order to test this software, XMC1000 Motor Control Application Kit is needed. For more details, see the README on GitHub.