XMC1000 / XMC4400 Motor Control Application Kit Getting Started 5 PMSM Motor Field Orientated Control(FOC) Sensorless with single shunt (SL 01) (PMSMFOCSL01) Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed (via POT) (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 2 Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed (via POT) (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 3 Motor Control Application Kit Composition – XMC1300 only XMC1300 CPU Card Micro USB 6 User LEDs On-board COM and Segger J-Link debugger Connectors according to pin-out XMC1300 3/21/2014 Edge connector for Application cards Copyright © Infineon Technologies 2011. All rights reserved. Page 4 Motor Control Application Kit Composition – XMC1300 only PMSM Low Voltage 15W Card Showcases motor control Shunt Amplifier MAXON Flat Motor ECF32_267121 Encoder Line Driver & Connector Gate Drive, Power Stage, Shunts 3/21/2014 Motor Connector Copyright © Infineon Technologies 2011. All rights reserved. Page 5 Motor Control Application Kit Composition – XMC1300 only Connect to PC PMSM LV15W Card XMC1300 CPU Card Power 24V 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 6 Motor Control Application Kit Composition – XMC4400 only XMC4400 24V Power Supply Encoder, Hall, Resolver connector On-board COM and Segger J-Link debugger XMC4400 Gate Drive, Power Stage, Shunts Nanotec Motor DB42S03 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 7 Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed (via POT) (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 8 Development Tool: DAVETM DAVETM is a free development platform for code generation by Infineon Can be downloaded from: http://www.infineon.com/cms/en/product/promopages/aimmc/DAVE_3_Download.html For a guide on setting up DAVETM, please refer to XMC1x00 Boot Kit Getting Started Help -> Check for DAVE Apps Updates (XMC1000) 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 9 Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed via POT (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 10 PMSM Motor FOC SL control with fixed speed Open DAVETM Select a Workspace or use the Default Workspace Click “OK” File Æ New DAVE Project 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 11 PMSM Motor FOC SL control with fixed speed Enter “PMSM_FOC_SL01_Example01” as the Project Name Click “Finish” Select “DAVE CE Project” as Project Type Click “Next” Select “XMC1300-TO38X0200” or “XMC4400-F100x512” as controller, depending on your hardware 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 12 PMSM Motor FOC SL control with fixed speed Click on “App Selection View” on your right 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 13 PMSM Motor FOC SL control with fixed speed Look for “PMSMFOCSL01” under App Selection View Double click on “PMSMFOCSL01” in the S/W App Connectivity View 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 14 PMSM Motor FOC SL control with fixed speed Configure ACIMVF01 settings Open PMSMFOCSL01 UIEditor by double-clicking or right-click->UIEditor on the app in S/W Connectivity View Control Algorithm tab, ¬ 3/21/2014 keep default settings Copyright © Infineon Technologies 2011. All rights reserved. Page 15 PMSM Motor FOC SL control with fixed speed – XMC1300 only Control Panel tab, ¬ Change Speed Slew Rate = 10 RPM/s Motor Parameters tab, ¬ Keep default settings. Power Board tab, ¬ keep default settings. Hint: Motor speed will be the “End Speed Reference” 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 16 PMSM Motor FOC SL control with fixed speed – XMC4400 only Control Panel tab, ¬ keep default settings. Motor Parameters tab, ¬ Nominal Speed: 4400 ¬ Phase to Phase Resistance: 1.5 Ω ¬ Phase to Phase Inductance: 2.1 mH ¬ End Speed Reference: 1500 Power Board tab, ¬ keep default settings. Hint: Motor speed will be the “End Speed Reference” 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 17 PMSM Motor FOC SL control with fixed speed Label the apps instance Under App Dependency TreeView ¬ Right click on IO002/0 app -> Add User Label ¬ Type U_H in the field provided Repeat the steps to label other apps App Feature IO002/0 [U_H] High side Phase U IO002/1 [U_L] Low side Phase U IO002/2 [V_H] High side Phase V IO002/3 [V_L] Low side Phase V IO002/4 [W_H] High side Phase W IO002/5 [W_L] Low side Phase W IO004/0 [Enable_Pin] Enable Pin Gate Driver IC IO002/6 [Trap_Pin] Trap Pin IO001/0 [I_DC] 3/21/2014 DC – link current Copyright © Infineon Technologies 2011. All rights reserved. Page 18 PMSM Motor FOC SL control with fixed speed – XMC1300 only Manual Pin Assignment for XMC1300 Assign Pin ¬ Click on ¬ Assign the Pins accordingly ¬ Solve and Save ¬ Close App Pin Number IO002/0 [U_H] P0.0 IO002/1 [U_L] P0.1 IO002/2 [V_H] P0.7 IO002/3 [V_L] P0.6 IO002/4 [W_H] P0.8 IO002/5 [W_L] P0.9 IO004/0 [Enable_Pin] P0.11 IO002/6 [Trap_Pin] P0.12 IO001/0 [I_DC] P2.7 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 19 PMSM Motor FOC SL control with fixed speed – XMC4400 only Manual Pin Assignment for XMC4400 Assign Pin ¬ Click on ¬ Assign the Pins accordingly ¬ Solve and Save ¬ Close App Pin Number IO002/0 [U_H] P0.5 IO002/1 [U_L] P0.2 IO002/2 [V_H] P0.4 IO002/3 [V_L] P0.1 IO002/4 [W_H] P0.3 IO002/5 [W_L] P0.0 IO004/0 [Enable_Pin] P1.15 IO002/6 [Trap_Pin] P0.7 IO001/0 [I_DC] P14.13 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 20 PMSM Motor FOC SL control with fixed speed Generate Code Click Initialize ACIMVF apps Go to Dave -> Generated -> src -> PMSMFOCSL01 -> PMSMFOCSL01.c APIs are defined in PMSMFOCSL01.c Look for the PMSMFOCSL01 _MotorStart() API 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 21 PMSM Motor FOC SL control with fixed speed Go to DAVE -> Generated -> src -> PMSMFOCSL01 -> PMSMFOCSL01_Conf.c All the variables & Handles is defined in PMSMFOCSL01_Conf.c Start the motor by calling the API function PMSMFOCSL01_MotorStart(&PMSMFOCSL01_Handle0) in Main.c 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 22 PMSM Motor FOC SL control with fixed speed Set the project compilation optimization to the maximum 1. Right click of PMSM_FOC_SL01_Example01 -> Properties 2. Under ARM-GCC C Compiler -> Optimization -> Optimization level -> Optimize Most (-O3) 3. Click Apply & OK 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 23 PMSM Motor FOC SL control with fixed speed Build project 1. Click 2. Wait for Build to finish Download code 1. Click 2. First time download, double click Tasking C/C++ Debugger in Debug Configuration 3a. Select Infineon Boot Kit for XMC1300 and click Debug 3b. Select Infineon Hexagon Application Kit XMC4400 Series and click Debug 4. 3/21/2014 Click to run code Copyright © Infineon Technologies 2011. All rights reserved. Page 24 Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed via POT (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Page 25 Copyright © Infineon Technologies 2011. All i ht d PMSM Motor FOC SL control with adjustable speed (via POT) Follow steps in “PMSM Sensorless FOC control with fixed speed “ Use different project name: “PMSM_FOC_SL01_Example02” Search for PMSMFOCSL01 app in App Selection View 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 26 PMSM Motor FOC SL control with adjustable speed (via POT) In UIEditor, under the Control Algorithm tab, Enable Speed Ref Via POT New Instances will be added Click “New Instance” & “OK” 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 27 PMSM Motor FOC SL control with adjustable speed (via POT) Two new ADC Channels are available: 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 28 PMSM Motor FOC SL control with adjustable speed (via POT) By enabling POT measurement, 3 ADC channels are added automatically Click , under Signal Assignment tab Two possible cases (A or B) could happen, it strongly depends DAVE3 created ADCCH001/2 or ADCCH001/1 at the first place 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 29 PMSM Motor FOC SL control with adjustable speed (via POT) Case A Case B ¬ ADCCH001/0 -> Channel A – Average Current Measurement ¬ ADCCH001/0 -> Channel A – Average Current Measurement ¬ ADCCH001/2 -> Channel B DC link Voltage measurement ¬ ADCCH001/1 -> Channel B DC link Voltage measurement ¬ ADCCH001/1 -> Channel C – POT measurement ¬ ADCCH001/2 -> Channel C – POT measurement 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 30 PMSM Motor FOC SL control with adjustable speed (via POT) Case A Case B App IO002/0 [U_H] IO002/1 [U_L] IO002/2 [V_H] IO002/3 [V_L] IO002/4 [W_H] Feature High side Phase U Low side Phase U High side Phase V Low side Phase V High side Phase W IO002/5 [W_L] IO004/0 [Enable_Pin] IO002/6 [Trap_Pin] IO001/0 [I_DC] IO001/1 [POT] IO001/2 [DC_Link] Low side Phase W Enable Pin Gate Driver IC Trap Pin DC link Current POT ADC measurement DC link Voltage App IO002/0 [U_H] Feature High side Phase U IO002/1 [U_L] IO002/2 [V_H] IO002/3 [V_L] IO002/4 [W_H] IO002/5 [W_L] IO004/0 [Enable_Pin] IO002/6 [Trap_Pin] Low side Phase U High side Phase V Low side Phase V High side Phase W Low side Phase W Enable Pin Gate Driver IC Trap Pin IO001/0 [I_DC] IO001/1 [DC_Link] IO001/2 [POT] DC link Current DC link Voltage POT ADC Measurement ¬ ADCCH001/0 -> Channel A – Average Current Measurement ¬ ADCCH001/0 -> Channel A – Average Current Measurement ¬ ADCCH001/2 -> Channel B DC link Voltage measurement ¬ ADCCH001/1 -> Channel B DC link Voltage measurement ¬ ADCCH001/1 -> Channel C – POT measurement ¬ ADCCH001/2 -> Channel C – POT measurement 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 31 PMSM Motor FOC SL control with adjustable speed (via POT) –XMC1300 only Manual Pin Assignment Click on , assign the pin accordingly Case A Case B App Pin Number App Pin Number IO002/0 [U_H] P0.0 IO002/0 [U_H] P0.0 IO002/1 [U_L] P0.1 IO002/1 [U_L] P0.1 IO002/2 [V_H] P0.7 IO002/2 [V_H] P0.7 IO002/3 [V_L] P0.6 IO002/3 [V_L] P0.6 IO002/4 [W_H] P0.8 IO002/4 [W_H] P0.8 IO002/5 [W_L] P0.9 IO002/5 [W_L] P0.9 IO004/0 [Enable_Pin] P0.11 IO004/0 [Enable_Pin] P0.11 IO002/6 [Trap_Pin] P0.12 IO002/6 [Trap_Pin] P0.12 IO001/0 [I_DC] P2.7 IO001/0 [I_DC] P2.7 IO001/2 [DC_Link] P2.3 IO001/1 [DC_Link] P2.3 IO001/1 [POT] P2.5 IO001/2 [POT] P2.5 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 32 PMSM Motor FOC SL control with adjustable speed (via POT) –XMC4400 only I_DC (P2.4) and POT(P14.1) do not share the same ADC Group. It is necessary use two ADC Groups. Enable Group B for Current Measurement in tab “ADC Group Configuration”. Confirm the information about adding a new instance New ADC002 and ADCCH001 is added. I_DC has moved from IO002/0 to IO002/3. 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 33 PMSM Motor FOC SL control with adjustable speed (via POT) –XMC4400 only Manual Pin Assignment Click on , assign the pin accordingly Case A Case B App Pin Number App Pin Number IO002/0 [U_H] P0.5 IO002/0 [U_H] P0.5 IO002/1 [U_L] P0.2 IO002/1 [U_L] P0.2 IO002/2 [V_H] P0.4 IO002/2 [V_H] P0.4 IO002/3 [V_L] P0.1 IO002/3 [V_L] P0.1 IO002/4 [W_H] P0.3 IO002/4 [W_H] P0.3 IO002/5 [W_L] P0.0 IO002/5 [W_L] P0.0 IO004/0 [Enable_Pin] P1.15 IO004/0 [Enable_Pin] P2.13 IO002/6 [Trap_Pin] P0.7 IO002/6 [Trap_Pin] P0.7 IO001/0 [not used] -- IO001/0 [not used] -- IO001/2 [DC_Link] P.14.2 IO001/1 [DC_Link] P.14.2 IO001/1 [POT] P14.1 IO001/2 [POT] P14.1 IO001/3 [I_DC] P14.13 IO001/3 [I_DC] P14.13 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 34 PMSM Motor FOC SL control with adjustable speed (via POT) Click Solve and Save, Click Close Generate Code Click Initialize BLDCBCH03 apps Go to Dave -> Generated -> src ->PMSMFOCSL01 >PMSMFOCSL01.c APIs are defined in PMSMFOCSL01.c Look for the PMSMFOCSL01_MotorStart() API 3/21/2014 Page 35 Copyright © Infineon Technologies 2011. All i ht d PMSM Motor FOC SL control with adjustable speed (via POT) Go to DAVE -> Generated -> src ->PMSMFOCSL01 -> PMSMFOCSL01_Conf.c All the variables & Handles is defined in PMSMFOCSL01_Conf.c Start the motor by calling the API function Call PMSMFOCSL01_MotorStart(&PMSMFOCSL01_Handle0) in Main.c Page 36 3/21/2014 Copyright © Infineon Technologies 2011. All i ht d PMSM Motor FOC SL control with adjustable speed (via POT) Set the project compilation optimization to the maximum 1. Right click of PMSM_FOC_SL01_Example02 -> Properties 2. Under ARM-GCC C Compiler -> Optimization -> Optimization level -> Optimize Most (-O3) 3. Click Apply & OK 3/21/2014 Page 37 Copyright © Infineon Technologies 2011. All i ht d PMSM Motor FOC SL control with adjustable speed (via POT) Build project 1. Click 2. Wait for Build to finish Download code 1. Click 2. First time download, double click Tasking C/C++ Debugger in Debug Configuration 3. Select Infineon Boot Kit for XMC1300/XMC4400 and click Debug 4. Click 3/21/2014 to run code Page 38 Copyright © Infineon Technologies 2011. All i ht d PMSM Motor FOC SL control with adjustable speed (via POT)- XMC1300 only Adjust your POT to change the reference speed = = × = × Speed; = frequency in Hz; 3/21/2014 = No. pole pair = 4005 rpm Phase W (C2) Phase V (C4) Phase U (C1) Page 39 Copyright © Infineon Technologies 2011. All i ht d PMSM Motor FOC SL control with adjustable speed (via POT) – XMC4400 only Waveform measurement with Oscilloscope = = × × = Speed; = frequency in Hz; = No. pole pair = 4350 rpm Phase U (C1) Phase V (C2) Phase W (C4) 3/21/2014 Page 40 Copyright © Infineon Technologies 2011. All i ht d Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed via POT (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 41 Additional Example Projects Download Download Additional Example Projects via DAVETM library store Help Æ Install DAVE Example Library 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 42 Additional Example Projects Download Select DAVE Project Library Manager in the drop-down menu 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 43 Additional Example Projects Download Select Additional Examples in the Libraries window and click Next 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 44 Additional Example Projects Download Accept terms of the license agreement and click Finish DAVE Example Projects are installed 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 45 Import Downloaded Example Projects (optionally) – XMC1300 only Download Motor Control Example Projects from the web http://www.infineon.com/cms/en/product/microcontrollers/32-bit-industrialmicrocontrollers-based-on-arm-registered-cortex-tm-m/32-bit-xmc1000-industrialmicrocontrollers-arm-registered-cortex-tm-m0/xmc-development-tools,-software-andkits/channel.html?channel=db3a30433d5e5530013d64397b0c2043 Download the project zip file Open DAVE™ and go to File Æ Import Æ Infineon Æ DAVE Project Check “Select Archive File” Browse to the downloaded DAVE project zip file Press “Open” 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 46 Contents Motor Control Application Kit Composition Getting Started Development Tool: DAVETM Example Project with PMSM Low motor ¬ PMSM Motor Sensorless FOC control with fixed speed (PMSM_FOC_SL01_Example01_XMC13.zip) (PMSM_FOC_SL01_Example01_XMC44.zip) ¬ PMSM Motor Sensorless FOC control with adjustable speed via POT (PMSM_FOC_SL01_Example02_XMC13.zip) (PMSM_FOC_SL01_Example02_XMC44.zip) Additional Example Projects Download Help Content 3/21/2014 Page 47 Copyright © Infineon Technologies 2011. All i ht d Help Content Go to Help -> Help Contents Look into DAVE Apps -> Expand topics -> click on PMSMFOCSL01 (latest version) Click on PMSMFOCSL01 App -> Overview 3/21/2014 Copyright © Infineon Technologies 2011. All rights reserved. Page 48