background image

Getting Started – Example –

Blinky based on XMC Lib (2/8)

14

Copyright © Infineon Technologies AG 2015. All rights reserved.

For this project, we will use

System clock frequency of 8MHz

LED on Port pin

System timer, SysTick, as the time base for interrupt

P4.9 for CAN Tx and P4.8 for CAN Rx

Next, we will show you how to

1.

Set up the System or Main Clock (MCLK)

2.

Configure Port pin

3.

Configure SysTick and define its exception service routine

4.

Configure 2 CAN message objects

5.

Configure P4.9 for CAN Tx and P4.8 for CAN Rx

Summary of Contents for XMC1400

Page 1: ...Getting Started XMC1400 Boot Kit XMC Microcontrollers Dec 2015 ...

Page 2: ...Agenda Kit Overview Hardware Overview Tooling Overview Getting Started 1 2 3 6 4 5 2 Copyright Infineon Technologies AG 2015 All rights reserved Resource Listing References 6 ...

Page 3: ...ll rights reserved XMC1400 Boot Kit Consists of an XMC1400 CPU Card Supported Application Cards examples Colour LED Card White LED Card Application Card is orderable separately or as part of another Application Kit XMC1400 CPU Card Colour LED Card White LED Card ...

Page 4: ...pyright Infineon Technologies AG 2015 All rights reserved XMC1400 CPU Card Home Home On board COM and Segger J Link debugger XMC1400 4 User LEDs Connectors according to pin out Micro USB Edge connector for Application cards ...

Page 5: ...ogies AG 2015 All rights reserved Connect XMC1400 CPU Card to PC via USB cable CPU Card is powered up as indicated by LED on the card Note Supported Application Card may be additionally connected to the CPU card Home Home CPU Card powered via USB cable ...

Page 6: ...rts Order Number XMC1400 Microcontroller XMC1404 Q064X0200 XMC4200 Microcontroller XMC4200 Q48F256 3V3 regulator IFX25001MEV33 Nr Kit Name Kit Description Order Number 1 KIT_XMC14_BOOT_001 Boot Kit XMC1400 KIT_XMC14_BOOT_001 6 Copyright Infineon Technologies AG 2015 All rights reserved ...

Page 7: ...ap Loader Mode User Mode Halt After Reset User Mode Debug Default Mode of device on Boot Kit User Mode Productive Boot Modes can be configured via DAVETM Download DAVETM DAVETM v4 1 4 download MemTool Download MemTool MemTool v4 65 exe download For more information on how to configure the BMI value please refer to the XMC1000 Tooling Guide Home Home ...

Page 8: ...Tooling Overview DAVETM 1 5 8 Copyright Infineon Technologies AG 2015 All rights reserved DAVETM download package is available at http infineon community com LP 400 ...

Page 9: ... AG 2015 All rights reserved After registration download and unzip the installer package Run DAVE 4 1 4 Setup exe to install DAVETM IDE and SEGGER J Link drivers Open DAVETM Update DAVETM and DAVETM libraries Help Check for Updates Help Check for DAVE APP Updates ...

Page 10: ...5 10 Copyright Infineon Technologies AG 2015 All rights reserved Install DAVETM APPs libraries and Device Description Help Install DAVE APP Example Device Library Note You may skip the above step if you are not using DAVETM APPs ...

Page 11: ...rview DAVETM 4 5 11 Copyright Infineon Technologies AG 2015 All rights reserved Select DAVE Apps Library Manager in the drop down menu Select DEVICE_PACK Library_DAVEDeviceDescriptions XMC1400 Device and DAVE APPs ...

Page 12: ... Overview DAVETM 5 5 12 Copyright Infineon Technologies AG 2015 All rights reserved Accept terms of the license agreements and click Finish DAVETM APPs libraries and Device Description are installed Home Home ...

Page 13: ...8 13 Copyright Infineon Technologies AG 2015 All rights reserved 1 Open DAVETM 2 Create a new Simple Main project File New DAVE Project Enter project name e g XMC1400_BlinkyMCAN Select Simple Main Project as Project Type 3 Select the device accordingly ...

Page 14: ...ck frequency of 8MHz LED on Port pin System timer SysTick as the time base for interrupt P4 9 for CAN Tx and P4 8 for CAN Rx Next we will show you how to 1 Set up the System or Main Clock MCLK 2 Configure Port pin 3 Configure SysTick and define its exception service routine 4 Configure 2 CAN message objects 5 Configure P4 9 for CAN Tx and P4 8 for CAN Rx ...

Page 15: ...nologies AG 2015 All rights reserved 1 Set up System or Main Clock MCLK and include the required header files MCLK configured via IDIV and FDIV bit fields in XMC_SCU_CLOCK_CONFIG data structure Initializes clock generators ad clock tree in Main c to set MCLK 48MHz and PCLK 96MHz ...

Page 16: ...FIG structure P4 0 will toggle at regular interval P4 1 will toggle when CAN message transmit and P4 3 toggle when CAN message received Configure P4 9 as CAN Tx pin and P4 8 as CAN Rx pin Getting Started Example Blinky based on XMC Lib 4 8 16 Copyright Infineon Technologies AG 2015 All rights reserved ...

Page 17: ...hts reserved 3 Configure SysTick and define its exception service routine SysTick exception handler is defined in startup_XMC1300 s by using the macro Initialize the SysTick in Main c Define the SysTick exception handler routine Every 0 5s toggle P4 0 and transmit the CAN message followed by toggle P4 1 ...

Page 18: ...le Blinky based on XMC Lib 6 8 18 Copyright Infineon Technologies AG 2015 All rights reserved 4 Configure CAN node 1 baudrate and CAN message object Configure Tx message object and its data bytes Configure Rx message object ...

Page 19: ...ice request number and allocate the message objects to CAN node 1 Define the interrupt event handler for CAN node Getting Started Example Blinky based on XMC Lib 7 8 19 Copyright Infineon Technologies AG 2015 All rights reserved ...

Page 20: ... XMC Lib 8 8 20 Copyright Infineon Technologies AG 2015 All rights reserved Build project 1 Click 2 Wait for Build to finish Download code 1 Click 2 Switch to Debug perspective 3 Click to run code LED LEDs P40 P41 blinks every 0 5s Home Home ...

Page 21: ... 13 21 Copyright Infineon Technologies AG 2015 All rights reserved 1 Open DAVETM 2 Create a new DAVE CE project File New DAVE Project Enter project name e g XMC1400_BlinkyMCAN_withApps Select DAVE CE Project as Project Type 3 Select the device accordingly ...

Page 22: ...ct we will use System clock frequency of 48MHz LED on Port pin System timer as the time base for interrupt Next we will show you how to 1 Set up the System or Main Clock MCLK 2 Configure Port pin 3 Configure System Timer and define its exception service routine 4 Configure CAN Node 5 Configure CAN Message Objects CAN Tx Rx pin and ISR ...

Page 23: ...ies AG 2015 All rights reserved 1 Set up System or Main Clock MCLK Click to add new APP Double click CLOCK_XMC1 APP and close window Open APP configuration editor In APP Dependency view double click CLOCK_XMC1 Configure APP instance In APP configuration window set Main clock MCLK to 48MHz ...

Page 24: ...k DIGITAL_IO APP and close window Open APP configuration editor In APP Dependency view double click DIGITAL_IO Configure APP instance In APP configuration window set Pin direction to Input Output and set Initial output level to High Assign pin to P4 0 Click to open Manual Pin Allocator Set Pin Number Port to 59 P4 0 Save and closed P4 0 will toggle output at 0 5s interval ...

Page 25: ...AVETM APPs 5 13 25 Copyright Infineon Technologies AG 2015 All rights reserved 3 Configure Port pin P4 1 and P4 3 using steps described in 2 P4 1 will toggle output when CAN message transmitted P4 3 will toggle output when CAN message received ...

Page 26: ...nfigure System Timer and define its exception service routine Click to add new APP Double click SYSTIMER APP and close window Open APP configuration editor In APP Dependency view double click SYSTIMER Configure APP instance In APP configuration window under General Settings tab set System timer tick interval to 100000us 0 1s ...

Page 27: ...mple Blinky based on DAVETM APPs 7 13 27 Copyright Infineon Technologies AG 2015 All rights reserved Create software timer using SYSTIMER Apps Define exception handler routine in Main c Define the toggle interval in usec ...

Page 28: ...15 All rights reserved 4 Configure CAN node Click to add new APP Double click CAN_NODE APP and close window Open APP configuration editor In APP Dependency view double click GLOBAL_CAN Configure APP instance In APP configuration window under General Settings tab set Desired CAN frequency MHz to 11 ...

Page 29: ...In APP Dependency view double click CAN_NODE Configure APP instance In APP configuration window under General Settings tab set Number of message objects in the list to 2 Under Event Settings enable Enable node alert Under MO Settings_Page1 setup a TX message object with 8 data bytes Identifier value 0x3FF Under MO Settings_Page1 setup a RX message object with Identifier value 0x2FF ...

Page 30: ...hnologies AG 2015 All rights reserved Click to add new APP Double click INTERRUPT APP and close window Open APP configuration editor In APP Dependency view double click INTERRUPT Configure APP instance In APP configuration window configure ISR for CAN_NODE_0 as EventHandler_CanNode_0 ...

Page 31: ...served Right click on the CAN_NODE_0 APP and select HW signal connection Select MO transmit event and link it to NVIC node Then click and link MO received event to NVIC node Assign CAN TX pin to P4 9 and CAN RX pin to P4 8 Click to open Manual Pin Allocator Set the desired pins as shown on the right Save and closed ...

Page 32: ...Getting Started Example Blinky based on DAVETM APPs 12 13 32 Copyright Infineon Technologies AG 2015 All rights reserved Add the Interrupt Service Routine for CAN_Node_0 to main c ...

Page 33: ... 13 13 33 Copyright Infineon Technologies AG 2015 All rights reserved Generate code 1 Click Build project 1 Click 2 Wait for Build to finish Download code 1 Click 2 Switch to Debug perspective 3 Click to run code LEDs P40 P41 blinks every 0 5s Home Home ...

Page 34: ...mentation 34 Copyright Infineon Technologies AG 2015 All rights reserved 1 Go to DAVETM Version 4 website http www infineon com dave v4 2 Download XMC Lib and unzip file 3 Open XMC1_Peripheral_Library 4 Click on Modules or Files Home Home ...

Page 35: ...Resource Listing Kit documentation Boot Kit XMC1400 35 Copyright Infineon Technologies AG 2015 All rights reserved ...

Page 36: ...References Where to find App Documentation 36 Copyright Infineon Technologies AG 2015 All rights reserved 1 In DAVETM go to Help Help Contents 2 Expand DAVE Apps Click on CLOCK_XMC1 Overview Home Home ...

Page 37: ...ferences Where to download Example Projects 37 Copyright Infineon Technologies AG 2015 All rights reserved 1 Example Project library within DAVETM 2 DAVETM website 3 Example from XMC Lib package Home Home ...

Page 38: ...on Technologies AG 2015 All rights reserved Example Project library within DAVETM 1 Help Install DAVE APP Example Device Library 2 Select DAVE Project Library Manager 3 Select Examples in the Libraries window Click Next 4 Accept terms of the license agreements Click Finish ...

Page 39: ...Technologies AG 2015 All rights reserved DAVETM website 1 Go to DAVETM Version 4 website http www infineon com dave v4 2 Download DAVETM EXAMPLES 3 In DAVETM go to File Import 4 Select DAVE Project Next 5 Select Archive File Browse to downloaded project zip file 6 Click Finish ...

Page 40: ...neon Technologies AG 2015 All rights reserved Example from XMC Lib package 1 Go to DAVETM Version 4 website http www infineon com dave v4 2 Download XMC Lib and unzip file 3 Example code main c can be found within XMC Lib package 4 Create new Simple Main Project in DAVETM ...

Page 41: ...chnologies AG 2015 All rights reserved 5 Select target device of selected main c example 6 Delete main c in the newly created DAVE project 7 Copy main c from XMC Lib example into DAVE project 8 Click to Build project 9 Click to download and run project on target board Home Home ...

Page 42: ...Technical Videos Product Information Videos Forums Product Support Support material Collaterals and Brochures Technical Material Videos Contact www infineon com XMC www infineon com XMC Kits and Boards DAVETM Software and Tool Ecosystem Infineon Media Center XMC Mediathek Infineon Forums Technical Assistance Center TAC 42 Copyright Infineon Technologies AG 2015 All rights reserved ...

Page 43: ...Glossary abbreviations ADC Analog Digital Converter DAVE Free development IDE for XMC MO Message Object PWM Pulse Width Modulation 43 Copyright Infineon Technologies AG 2015 All rights reserved ...

Page 44: ...or warranty of a certain functionality condition or quality of the Infineon Technologies component 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 with respect to any and all information given in this training material Disclaimer ...

Page 45: ......

Reviews: