Home

PMSM Servo Motor Speed Control User Manual

image

Contents

1. Lock Rotor Protect Voltage Protect Module Laver Q PID Regulator Drive Layer Global Layer Figure 4 3 Servo motor FW Architecture 4 3 Files Description The detailed descriptions for each file are shown as Table 4 3 Table 4 3 File Description of Project Foder Fe Bed sO1 global No files temporarily 902 driver No files temporarily coordinate transfrom c FOC axis convert One order low pass filter s03 module P math c The math module including the function such as SQRT COS SIN 10 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL The PID module for current and speed PI et eee The SVPWM module motor_startup_encoder c The motor start up module with encoder after motor_ctrl c The main file of the motor control including the main function of FOC process of motor and the start stop s04 app function of motor Initialize MCU peripheral functions 4 4 FW Control Flow The control flow for the motor is shown as Figure 4 4 There are 4 interrupts that are red highlighted for the motor FOC control hall capture AD converter The timer events are executed in the end less loop and the timers are generated in the zero detection interrupt ISR_MFT_FRT of the free run timer 0 End less loop in Main c Initialize peripheral Current U V W sample Feed watchdog DC bus sample and calculate Motor Start Stop IG ADC unitO q ISR MFT FRT FOC control PD SVPWM Other Algo
2. 4 Connect AC power to inverter board shown as below Figure 6 5 AC Plug 6 2 Motor Debug After the hardware connection with the motor is completed you can debug the new motor as described in this section Click the IAR program to open the IAR and open the EWW file of the inverter servo motor workspace at the location you ve stored on your computer as shown in Figure 6 6 Jan 26 2015 AN709 00011 1v0 E 17 TAN SPANSION A N USER MANUAL 3 IAR Embedded File Edit View Project Tools Window Help orkbench ID TES ry c6 e EDO ew D ECKE Ae n Open A Ctri 0 N N Sawe Workspace N Close EE H Save Ctri s REESEN EE New folder V 7 Save All e pS Name E Date modified Type Page Setup BE Desktop v config 2015 3 16 9 22 File folder Print Ctrl F de Downloads Debug 2015 3 16 9 22 File folder AAA El Recent Places Le settings 2015 3 16 9 22 File folder A E E 4 fm4 serva motar eww 2015 2 4 18 02 IAR IDE Workspa BE Desktop Exit Libraries Es Documents a Music RK E Pictures Exi Subversion BE Videos Figure 6 6 Open the Workspace 6 2 1 FW Interface Configuration All of the variables reserved for the user interfaces are located in the file s05 user customer interface c and the macro definitions are located in the file h05 user customer interface h Files DC fm4 servo motor Debug I C3h01 global a 1h02 driver 1h03 module h04 app 30 h05_ us
3. USER MANUAL AN709 00011 1v0 E Spansion e Application Note FM4 Family 32 BIT MCROCONTROLLER PMSM Servo Motor Speed Control User Manual Jan 2015 Rev 1 0 Published Spansion Inc Edited Communications Jan 26 2015 AN709 00011 1v0 E 27 TAN SPANSION 28 USER MANUAL Colophon The products described in this document are designed developed and manufactured as contemplated for general use including without limitation ordinary industrial use general office use personal use and household use but are not designed developed and manufactured as contemplated 1 for any use that includes fatal risks or dangers that unless extremely high safety is secured could have a serious effect to the public and could lead directly to death personal injury severe physical damage or other loss i e nuclear reaction control in nuclear facility aircraft flight control air traffic control mass transport control medical life support system missile launch control in weapon system or 2 for any use where chance of failure is intolerable i e submersible repeater and artificial satellite Please note that Spansion will not be liable to you and or any third party for any claims or damages arising in connection with above mentioned uses of the products Any semiconductor devices have an inherent chance of failure You must protect against injury damage or loss from such failures by incorporating safety design measures into your f
4. MOSFET or IGBT the minimum dead time can be found in its datasheet Carrier frequency can be rewritten as requirement 6 2 1 4 UI 04 Current PID and Speed Loop PID float32 t Motor f32LowSpdki float32 t Motor f32LowSpdkp float32 t Motor f32Dki float32 t Motor f32Dkp float32 t Motor f32 ki Motor f32Q0kp Hotor f325kp _t Motor f325ki 0 000023f uinti6_t Motor_u16ChgP1SpdHz 225 Table 6 3 Current PID and Speed PID Nme Exado Motor f32LowSpdki Speed loop integration parameters when speed These parameters are Motor f32LowSpdKP Speed loop proportion parameters when speed depend on motors and B 00023f 0 322 D br 18 0f B 5f 18 68 0 322f Tune these parameters when changing motor Jan 26 2015 AN709 00011 1v0 E 19 TAN SPANSION h N USER MANUAL Tigh than Motor ui6ChgPISpdHz Motor f32Skp Speed loop proportion parameters when speed higher than Motor u16ChgPiSpdHz Motor_u16ChgPiSpdHz Switch speed loop Pl parameters 6 2 1 5 UU 05 Motor Startup Parameters int16 t Hotor 11603 rientIqRef float32 t Hotor f320rientT ime uint16 t Motor ut160penbLoopSpdIncHz uint16 t Motor ut1 amp OpenbLoopSpdInitHz uintiG t Motor_u1bO0penLcopspdEndHz int16 t Hotor 11603 OpenbLloopIqRef Table 6 4 Motor Startup Parameters Q8 1 0 1A Q8 2 0 2A Current setting in orientation and open loop stage is related to motor electrical parameter Ensure that not exceeding motor rated
5. Project Debug Disassembly J Link Tools Window Help observer encoder h init mcu c observer encoder c main c main x Live Watch PLLELELLLLEEELEZELEZETLEE ELLE AAA AAA EE ETES Expression Value MotorCtri_stcRunPar lt struct gt dad i32TargetSpeedRpm s t S ES i32TargetSpeedRpmMax 0 brief xxxxxx i32TargetSpeedRpmMin 0 he cn 13208 EstimWmHz e h03 module arg XXXXXX L CY h04 app lreturn XXXXXX L Lange user TS iain pare u32ErroType e l customer intera void main void i32Q8 VdcReciprocal hardware config h i i32Q8 Vbus o InitMcu Clock j32Q22 DeltaThetaTs 0 31501 pe InitMcu PeripheralUnit E i32Q22 DeltaThetaKTs 0 L 502 driver InitMcu_Nvic i i32Q8 TargetSpeedW 0 s03 module re im o pu i32Q22 TargetSpeed 0 HO C1s04 app n EA sj pale 7 L 132022 TargetWmlncTs 0 adc sample c 3 e E La m sk S pl nu m 132022 TargetWmDecTs IO deadtime comp Inithcu_DA Se E field weaken c InitMcu_Adc Motor_u16CarrierFreq m i32Q22 ElecAngleErro Cintas u8SpeedPiEn do 0x00 3 Matar trel Thnit Matar ul Iess anarErrnart i EN ru EM A E E A int Jas eeh Figure 6 10 Motor Run by J link Eg fm _ servo motor IAR Embedded Workbench IE Fi Edit View Project Debug Disassembly Line Tools Window Help Dsl Ba ER 5 cs Y Sp Fi 10 Je EEZ zix Wo spe
6. Restart Debugger to connect the J link and pass the global structure Qprc_RunPars into the Live Watch in the IAR debug online Connect PC and hardware with J LINK and give motor any target speed more than 0 to run motor Wait until motor stops running find structure Qprc_RunPars in file observer encoder h and record value of variable Qprc RunPars i8_Swapbit and Qprc_RunPars i32Q22 AngleToZerolnx Table 6 8 Global Structure for Encoder Check B Qprc RunPars ern y i8 Swapbit 10 0x00 Encoder A B order bit i8 RtMode V exeo RN i32 InitRotDir 132_ZeroMatchFlg 132 CounterValPre E 132 Counterval AAA 32022 AngleToZerolhx i32 MaxCountVal 132 LineNumCalc 13200 EstimWmHz Modify SWAPBIT definition in hardware config h set it the same value as Qprc_RunPars i8_Swapbit Modify QPRC ZERO ANGLE definition in hardware config h Set it the same value as Qprc RunPars i32Q22 AngleToZerolnx Redefine ZEROMATHCEN to 1 Encoder check is complete 6 2 3 Run Motor When the encoder angle has been checked the motor can be started for the demo show 1 Check the basic motor and HW parameter setting in the user interfaces If the setting does not match the real HW and washing machine parameter there will be an unexpected running error in the motor running 2 Compile project and download program to inverter board by the J link 1 Click button A that is shown in Figure 6
7. Y p o E A AA er encoder c main c manQ x veWaxh A F Welue Files 2 BER ii E 0 fm4_servo_motor e Ji ccr I Oht global E mM i32TargetSpeed3pmlVlax Ha Choe driver Trei XXXXXX z i32TaigetSpeedRpmMn 5000 Fi PRES RE Figure 6 11 Motor in Running Status Jan 26 2015 AN709 00011 1v0 E 23 TAN SPANSION 6 2 4 USER MANUAL Table 6 9 Running Status by the Command Speed MotorCtrl stcRunPar i16TargetSpeedRpm Running Status gt 0 6 3 Troubleshooting 6 3 1 24 Protection define NORMAL RUNNING 0x00 define OVER VOLTAGE 0x01 define UNDER VOLTAGE 0x02 define SW_OVER_CURRENT 0x04 define MOTOR OVER CURRENT 0x08 define MOTOR LOSE PHASE 0x10 4 Watch the important variable MotorCtrl i32Q8 EstimWmHzf to check whether motor is achieved the command speed and running speed is stable Speed Acceleration and Deceleration After run motor normally you can run motor in any speed 5000rpm 5000rpm The negative or positive indicates rotational direction When the motor is stopped without the normal stop command the protection fault may appear you can see the value of the variable MotorCtrl_stcRunPar u16FaultCode in the watch window and the code is assigned by the bit OR operation The fault codes for each protection are shown as below You can match the value with these fault codes to find what protection is performed no error DC bus over voltage DC bus under voltag
8. 9 to connect the J link and download the FW into the MCU 2 Click button B shown in Figure 6 10 to run the FW online 3 You can enter the none zero speed value to start the motor in the structure that is shown as C in Figure 6 11 For example when the variable MotorCtrl stcRunPar i16TargetSpeedRpm 90 by your online input the speed of the servo motor will run to 90rpm Do not click button D in Figure 6 11 while motor in running status 22 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL A N E fm servo motor IAR Embedde Fe Edit View E Tools Window Help Files D E Fi fmd servo motor Debug v f 3h01_global 3E cE cb cb EEE GE Gb GE EE EEE Gb Gb GE EE GE GE GE Gb Gb GE Gb GE GE GE GE Gb Gb GE EE EEE Gb Gb GE Gb GE GE GE GE Gb GE GE GE GE EEE h02 driver brief xxxxxx h03 module S 250 h04_ app param xxxxxx H F ade sample h larg XXXXXX I Mi brake h refurn xxxxxx hi H abba bb h deadtime_ compens hi field_weaken h void main void I F limitation h HB LE motor_ctrl h InitMcu Clock E motor startup enco InitMcu PeripheralUnit m m Ini tMcu Nvic D protect h InitMcu_Gpio Eege InitMcu Qprc DE ee InitMcu Uart InitMcu Basetimer InitNcu DA InitMcu Adc Motor ul16CarrierFreq MotorCtrl Init Motor dep E nit BtSpeedParst amp E Deedgr Figure 6 9 Download and debug by J link File Edit View
9. Disable Flag Explanation 0 disable fast braking when target speed is set Motor BrakeCtrlEn Switch on or off controlling for fast braking to O to stop motor running function 1 enable fast braking when target speed is set to O to stop motor running 6 2 2 Encoder Check When the basic setting has been finished the encoder information zero position A B order can be self check by the encoder check module Here take one servo motor for example And if the encoder information has been known this section can be ignored and the motor can be normal started now and taken the reference at section O Modify SWAPBIT definition in hardware contig h set it the same value as Qprc RunPars i8_Swapbit Modify QPRC ZERO ANGLE definition in hardware config h Set it the same value as Qprc RunPars i32Q22 AngleToZerolnx Redefine ZEROMATHCEN to 1 Encoder check is complete Run Motor 6 2 2 1 FW Setting Set the variable as shown Figure 6 8 to make the control system in debug mode QPRC ZEROMATCH 0 O not match 1 matched QPRC SWAPBIT 1 QPRC ZERDANGLE 3406141 Figure 6 8 Macro Define for encoder QPRC ZEROMATCH 0 set encoder searching mode QPRC_ZEROMATCH 1 encoder searching mode end QPRC SWAPBIT 0 no change A B order QPRC SWAPBIT 1 exchange A B order QPRC ZEROANGLE zero position IS SPANSION h N USER MANUAL 6 2 2 2 Encoder Check Run gb eb m Click the debugger button Make
10. EEA Wink Link Debug and Load FW by JTAG and Load FW by JTAG SPANSION FLASH Flash download program N A N A LOADER 6 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL 4 System Firmware Design This chapter introduces the FW structure of the inverter servo motor project 4 1 FW Feature The features of the servo motor speed control solution are shown in Table 4 1 Table 4 1 Feature List of servo motor speed control No Feature Gegen Remake Encoder Zero Check Match encoder zero signal with electrical position EM Hardware Self check Check offset of current sampling Adjustable Carrier Carrier frequency can be set by the corresponding variable in Frequency user interface Rapid speed H pe Motor can be accelerated from Orpm to 5000rpm within 200ms acceleration Rapid speed Motor can be decelerated from 5000rpm to Orpm within deceleration 200ms FOC Control Using FOC control algorithm 7 Sneed eie This function is used to speed up or slow down a motor by the command from host via UART or debugger Speed precision Accurate speed controlling with less than 196 target error Stop motor by brake down Brake Slow down a motor by brake 10 WW Current sample Three phase hall sensor for current sampling EE DC voltage protect EE 11 A D offset protect E Protect 2 3 4 CH a Lock rotor protect EE Over Current Protect EMEN Bi directional rotating Motor can run in both directio
11. FW Interface Configuration and chapter 5 Interrupt Function The sub files in each folder are shown in Figure 4 2 and the structure of header files is the same with C files 8 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL ua s03 module C coordinate transform c c filter c E math c Ash pid_regulation asm Asm sypwm asm aD g fm4_servo_motor IAR Embedd File Edit View Project Tools D c d ES s Ss e TEES D Files s04_app E Cj fm4 servo motor Debug E e adc_sample c 3h01 global 7 2 brake c 3 1h02 driver 3 3h03 module 3 3h04 app 4 y 2 3h05 user ee 4 3501 global gt um C deadtime compensation c c feld weaken c H limitation c KO motor cd e 7 motor startup encoder c C observer encoder c c protect c E qprc zero search c e speed calculate c 1505 user Ha 2 customer interface c Ha c init mcu c EEE Ha E main c L amp startup mb9xfxxx s Figure 4 2 Sub files in Each Layer E Jan 26 2015 AN709 00011 1V0 E IS SPANSION h N USER MANUAL The relationship between each layer is shown as the diagram in Figure 4 3 User Layer User interface Main program entrance Interrupt vectors Initialization Int event App Laver Motor Start up Motor Speed Set Speed Calculation Current sample Voltage and Current Limit Field weaken Encoder zero check Dead time compensation s Y l l l l l l
12. acility and equipment such as redundancy fire protection and prevention of over current levels and other abnormal operating conditions If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan the US Export Administration Regulations or the applicable laws of any other country the prior authorization by the respective government entity will be required for export of those products Trademarks and Notice The contents of this document are subject to change without notice This document may contain information on a Spansion product under development by Spansion Spansion reserves the right to change or discontinue work on any product without notice The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy completeness operability fitness for particular purpose merchantability non infringement of third party rights or any other warranty express implied or statutory Spansion assumes no liability for any damages of any kind arising out of the use of the information in this document Copyright 2014 Spansion All rights reserved Spansion the Spansion logo MirrorBit MirrorBit Eclipse ORNAND and combinations thereof are trademarks and registered trademarks of Spansion LLC in the United States and other countries Other names used are for informational purposes only a
13. current 6 2 1 6 UI 06 Motor edita Parameters 05 1 0 1 5 1 0 1 08 2 0 GE cw Hotor_11608 CloseLoopIsMax 08 2 5 Hotor 1160283 CloselLoopIqRefHax 03 2 5 int16 t Hotor ul6S5pdHax int16 t Motor_u16spdMin float32_t Hotor f325pdAccelerationHz 600 OT float32 t Hotor f325pdDecelerati onHz 400 OT Table 6 5 Motor Close Loop Parameters SE Motor_u16CloseLoopTargetSpdHz Initial target speed when getting in close OHz Orpm loop Q85 25A 08 2 5 2 58 2000 9000 6 2 1 7 9 07 Protection Parameters Motor_11608CurrentMax Motor ul amp 6 0verCurrentTimeSec Hotor ul6VvbusHax Motor ul6VbusHin Motor Error ime 20 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL Table 6 6 Protection Parameters Explanation Motor_i16Q8CurrentMax Soft current protection happens when peak of current Q8 3 5 is higher than this value 3 5A Motor_u16OverCurrentTimeSec Define times of current continuously overpassing 1 time Motor it6Q8CurrentMax When times of overpassing higher than Motor ul6OverCurrentTimeSec soft over current protection happens Motor_u16VbusMax Define over voltage protection point 400V Motor_u16VbusMin Define under voltage protection point 200V Motor_ErrorTime Time for error flag maintaining Motor error flag will be 10s set and will be cleared after Motor_ErrorTime 6 2 1 8 UI 08 Brake Enable 1nt3 t Motor BrakeCtrlEn Table 6 7 Brake Enable or
14. d 74 CYPRESS PERFORM il The following document contains information on Cypress products Although the document is marked with the name Spansion and Fujitsu the company that originally developed the specification Cypress will continue to offer these products to new and existing customers Continuity of Specifications There is no change to this document as a result of offering the device as a Cypress product Any changes that have been made are the result of normal document improvements and are noted in the document history page where supported Future revisions will occur when appropriate and changes will be noted in a document history page Continuity of Ordering Part Numbers Cypress continues to support existing part numbers To order these products please use only the Ordering Part Numbers listed in this document Worldwide Sales and Design Support We look forward to partnering with you to provide solutions that will help make your systems successful Cypress maintains a worldwide network of offices solution centers manufacturer s representatives and distributors To find the office closest to you visit us at Cypress Locations About Cypress Cypress NASDAQ CY delivers high performance high quality solutions at the heart of today s most advanced embedded systems from automotive industrial and networking platforms to highly interactive consumer and mobile devices With a broad differentiated product portfolio that i
15. e over current over current of HW motor lose phase define NO CONECT COMPRESSOR 0x20 no motor connected define AD MIDDLE ERROR 0x40 current sample 2 5V offset error define SF_WTD_RESET 0x80 define MOTOR LOCK 0x100 define UNDEFINED INT 0x200 define HW WTD RESET 0x400 FW watch dog reset motor lock undefined interrupt HW watch dog reset There may be different processing logic about the protection The fault code may not be cleared except the DC bus voltage protection for the inverter DEMO That is the FW may not run again when the protection fault happens You can access the variable Motor stcRunParam u16FaultCode to make your own protection processing logic Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL ae 7 Additional Information For more Information on Spansion semiconductor products visit the following websites English version address http www spansion com Products microcontrollers Chinese version address http www spansion com CN Products microcontrollers Please contact your local support team for any technical question America Spansion Solutions Spansion com China mcu ticket cnOspansion com Europe mcu ticket deOspansion com Japan mcu ticket jp Ospansion com Other http www spansion com Support SES Pages Ask Spansion aspx Jan 26 2015 AN709 00011 1v0 E 25 SPANSION h N USER MANUAL 8 Reference Documents 26 Jan 26 2015 AN709 00011 1v0 E SPANSION
16. er H E customer interface h a C1 503 module 4 71804 app HaC s05 user alalcustomer interface E e init mcu c SEI isr c fm4 servo motor Figure 6 7 Interface File Diagram 6 2 1 1 UI 01 Motor Parameters int32 t Motor fT32PolePairs Set motor pole pairs Set it to 3 if motor with 3 pole pairs is being used 18 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL 6 2 1 2 Ul 02 Encoder Information 1nt32 t QPRC_LineNumber 360 int32 t Q FRC times 4 QPRC LineNumber indicating pulses per cycle for encoder signal A or B QPRC times indicating QPRC unit working mode for detecting encoder signal This is set to 4 by default For more information about it you can refer to MCU peripheral manual reading chapter QPRC for PC Mode2 setting 6 2 1 3 UI 03 Sample Resistor Amplification Carrier Frequency and Dead Time Motor f32lIuvwSampleResistor Motor 1i32lIuvwAmplifierFactor Motor 1321lIuvwOffsetNormal Motor i32lIuvwOffsetRange Motor 1i321IuvwOffsetCheckTi1imes Motor f32DeadTimeHMicroSec Motor u 6CarrierFreq Table 6 2 Sample Resistor Amplification Carrier Frequency and Dead Time Motor i32luvwOffsetRHange Define offset range 150 Offset range lt 2048 150 2048 150 gt Motor_f32DeadTimeMicroSec Motor ut6CarrierFreq Carrier frequency for PWM 15000Hz Sample resistor and amplification is related to hardware board they must be written correctly Dead time is depended on IPM
17. figuration 18 6 2 2 Bintener 21 6 2 3 Run ores NNNM n 22 6 2 4 Speed Acceleration and Deceleration VU 24 e 24 6 3 1 A 24 PEE ele io PPP A 25 8 Reference DOCUMEeN S NOE m 26 Figures Figure 4 17 Structure O FW einstein 8 Figure 4 2 Sub files in Each Layer 9 Figure 4 3 Servo motor FW Architecture oooonnncccncccccconnccnnncccononnnncnnnonononnnnnnnnnononnnnnnnnnnnnnnnnnnnnnnnnnnnnos 10 Figure 4 4 Diagram of the Control Flow eeesesessseseeeeeennnennnn nennen nnn nnn nnne nnn nns 11 Figure 5 1 Interrupt Priority Setting iii 12 Figure 5 2 Free Run Timer Interrupt iii 13 Figure 5 3 Encoder Capture with Base Timer ss 13 Foure A DIN ISO ET TE 14 Figure 6 1 System Connechon E EET E EOE EAEE a RAE E rE C EEEE rE Ea Eada 15 Figure 6 2 Encoder Signal Line Connection sisi 16 Figure 6 3 Motor Line Connection iii 16 Figure 6 4 JTAG Line CONNECTION nnne nnne nennen enhn n nnn ness n naar nnn scene 17 Ac A e E UU ECO nec Ge enact ececeenacteeetnestecte 17 Figure 6 6 Open the Workspace ccccccccococncccncccconononccnnononononnnnnnnnononnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnncnnnns 18 Figure 6 7 Interface File uagram 18 Figure 6 8 Macro Define for encoder sise 21 Figure 6 9 Download and debug by J Jmk ss 23 Figure 6 10 Motor Run by J link cc ccceeeccceeceeeeeeeeseeeeeeeeceeeeeee
18. mation of whole servo motor control system including hardware firmware initial functions basic motor setting functions and FOC drive modules When you have understood the provided information you can get an overview of a whole servo motor project And you can run a motor following the demo project step 1 2 Definitions Acronyms and Abbreviations API Application Programming Interface FOC Field Oriented Control FW Firmware HW Hardware I O Input and output CW Clockwise CCW Counter clockwise 1 3 Document Overview The rest of document is organized as the following Chapter 2 explains System Hardware Environment Chapter 3 explains Development Environment Chapter 4 explains System Firmware Design Chapter 5 explains Interrupt Function Chapter 6 explains Demo System Chapter 7 explains Additional Information Chapter 8 explains Reference Documents dan 26 2015 AN709 00011 1V0 E TAN SPANSION USER MANUAL 2 System Hardware Environment The below shows the brief information of MCU used in servo motor inverter board CPU chip Spansion MB9BF568R CPU Frequency 160MHz MCU pin number 120pin RAM Space 128Kbytes Code Space 1024Kbytes Demo HW version FSDC FM3 314 1 0015 01 FSDC FM4 560 2 071200050 Jan 26 2015 AN709 00011 1v0 E 5 IS SPANSION h N USER MANUAL 3 Development Environment Table 3 1 MCU Development Environment IAR bedded Workbench FW code edit compile and 7 ooo o
19. ncludes NOR flash memories F RAM and SRAM Traveo microcontrollers the industry s only PSoC programmable system on chip solutions analog and PMIC Power Management ICs CapSense capacitive touch sensing controllers and Wireless BLE Bluetooth Low Energy and USB connectivity solutions Cypress is committed to providing its customers worldwide with consistent innovation best in class support and exceptional system value Ma PMSM Servo Motor Speed Control User Manual 32 bit ARM Cortex M4F based Microcontroller MB9BF568x Series and S6E2HG Series User Manual Jan 26 2015 AN709 00011 1v0 E Sa SPANSION v TAN SPANSION USER MANUAL Y Table of Contents t A 4 El RUIDOSO riales 4 1 2 Definitions Acronyms and Abbreviations cccccccccseeeceeeeaeeeeeeeceeeeeeeesueeeceeesaeeeessaeeeeeees 4 EAS 4 2 System Hardware Environment 5 3 Development Environment ococcconcnccconnncoconnncccononononnnnononnnnonnnnnnnnnnnornnnnonannnnnnnnnnnnnnrnrenannnnnananenennros 6 4 System Firmware DeslOfi espontanea is 7 A 7 GT O EE 7 AS Files iB eio iT 10 A 11 SENS A SP II An 12 e WE ie A A 12 5 2 Interrupt Priority Settings 12 5 3 Interrupt Generation 13 5 3 1 APP 13 5 3 2 Beileed 13 5 3 3 A E 14 STI V ME 15 6 1 Demo System Introduction 15 6 1 1 Hardware Connection ss 16 62 Motor De rated Te 17 6 2 1 FW Interface Con
20. nd Deceleration 6 1 Demo System Introduction The servo motor solution can be adaptive to any type of servo motor speed control which uses the PMSM or BLDC motor The connection diagram for debugger is shown in Figure 6 1 Figure 6 1 System Connection Jan 26 2015 AN7O9 00011 1V0 E AB TAN SPANSION h N USER MANUAL 6 1 1 Hardware Connection It is necessary to connect below 4 lines 1 Connect motor s encoder signal to inverter board shown as below Figure 6 2 Encoder Signal Line Connection The connection of the encoder signal line follows the definition in the below table Table 6 1 Encoder Connection motorsiine inverter Board Circuit Pon AIN BIN ZIN 5V Vcc GND GND e Connection order between A and B is mixable e VCC and GND must be connected rightly otherwise the encoder won t work right and the motor will also not run 2 Connect motor s U V W phase lines to inverter board shown as below Motor s U V W line can be optionally connected to Inverter s output U V W It has no constant define Just connect it And it is also recommended to connect according to the UVW definition of the motor 3 Connect JTAG to Inverter shown as below 16 Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL ua Figure 6 4 JTAG Line Connection Note If there is no isolator between the J link and the HW you must unplug the AC power and use the battery of your laptop computer
21. nd may be trademarks of their respective owners Jan 26 2015 AN709 00011 1v0 E
22. ns Ech 4 2 FW Structure There are 5 layers in the FW structure of IAR which are shown in Figure 4 1 Jan 26 2015 AN709 00011 1v0 E 7 TAN SPANSION h N USER MANUAL ME fm4 servo motor IAR Embedded Workbench IDE File Edit View Project Tools Window Help D E LE E Workspace Debug Files El j fm4 servo motor Debug I 3h01 global h02 driver h03 module h04 app h05 user I E3501 global I 3502 driver s03 module s04 app a C1s05 user customer interface c E init mcu c E isr c man CTT Asm startup_mb9xhoxx s 3 Output Figure 4 1 Structure of FW The C source and Header files which are included in each layer are shown in Table 4 2 Table 4 2 Directory Description of Project Layer Folder Deepen OO h01_ global lobal MCU system fil s01 global mm h02_ driver driver MCU register setting function such as GPIO interrupt MFT AD s02 driver hO3 module Algorithm folder for basic motor control such as FOC frame transform DEER s03 module SVPWM math PID filter Application folder for the files of application functions such as speed and position generator by hall sensor protection motor start up field weaken brake and etc Seen h05 user Customer interface folder for the files for motor Configuration and HW s05 user setting Note if you want to quickly start the motor you can refer to the setting for user layer at 6 2 1
23. rithm Guns Speed Position Generate Protection High Priority Figure 4 4 Diagram of the Control Flow Jan 26 2015 AN7O9 00011 1V0 E AD TAN SPANSION USER MANUAL 5 Interrupt Function 5 1 Function List Table 5 1 System Used Interrupt Function Prototype Bescipton Remak root void HWD Handler void root void Sud srHandler vod root void MftO_FrtO_ZerolsrHandler void root void MftO Wfg lsrHandler void The HW over current ISR root void Adc O IsrHandler void The ADC unitO ISR trigger at the zero point for s05 user isr c the 3 shunts 5 2 Interrupt Priority Setting Each interrupt priority can be set by the function void InitMcu Nvic void which is located at the file s05 user init mcu c Users are not recommended to modify it The priority used for motor control is shown in Figure 5 1 The lower the number is the higher the priority is void InitMcu_Nvic void d exception priority NVIC_SetPriority WFGO_DTIFO_IROn 0 NVIC_SetPriority SWDT_IRQn 0 NVIC SetPriority ADCO IRQn 1 NVIC SetPriority FRTO ZERO IRQn 2 Figure 5 1 Interrupt Priority Setting 12 Jan 26 2015 AN709 00011 1v0 E AN SPANSION USER MANUAL 5 3 Interrupt Generation The diagram of the interrupt used for the motor control is briefly introduced in this section 5 3 1 MFT The multifunction timer is used to generate the interrupt for the motor control algorithm execution and
24. sseeseeeeeeeeeceeeseeeeeeeeseaeeeeeessaeeeeesaeeeseeeesnanes 23 Figure 6 11 Motor in Running Status enne nennen nnn nnne n nnns nnn nnn nnns 23 2 Jan 26 2015 AN709 00011 1v0 E TAN USER MANUAL SPANSION WW Tables Table 3 1 MCU Development Environment iii 6 Table 4 1 Feature List of Servo motor speed control 7 Table 4 2 Directory Description Of Project LL 8 Table 4 3 File Description of Project iii 10 Table 5 1 System Used Interrupt Function ooocccccccccnccccnnncccncnnnnoncnnononnnnnnnnnnononnnnonnnnnnonnnnnnnnnnnnnanennnnns 12 Table 5 1 Encoder CONE T tao 16 Table 6 2 Sample Resistor Amplification Carrier Frequency and Dead Time oocccccocccnnccccoccnncccnnnnncnnnns 19 Table 6 Cure PID and Speed PID nta RT 19 Table 6 4 Motor Startup Parameters iii 20 Table 6 5 Motor Close Loop barameiers 20 Table 6 6 Protection Parameters iii 21 Table 6 7 Brake Enable or Disable Flag 21 Table 6 8 Global Structure for Encoder Check 22 Table 6 9 Running Status by the Command Speed 24 Jan 26 2015 AN709 00011 1v0 E 3 IS SPANSION h N USER MANUAL 1 Introduction 1 1 Purpose This user manual describes the speed control solution of the SPANSION servo motor and how to use the inverter servo motor FW library This document will help you quickly learn how to build a servo motor project and how to debug the motor with SPANSION inverter servo motor FW library The document introduces the basic infor
25. trigger the AD sample at the zero point ISR_MFT_FRT Free run timer 0 UP DOWN mode PWM cycle 66 7 us 15K Hz Trigger AD unitO and FOC interrupt A D unt sample U V W current FOC interrupt to drive motor Figure 5 2 Free Run Timer Interrupt 5 3 2 Encoder Capture The PWC timer is used to capture the encoder A B signal and calculate pulse width of the edge of A B E A B si Volt High or Low ncoder A B signal Voltage High or Low leve One motor mechanical cycle H y y Measure completion Motor speed calculate and rotor phase angle Base timer Count Over Flow Figure 5 3 Encoder Capture with Base Timer Jan 26 2015 AN709 00011 1v0 E 13 TAN SPANSION h N USER MANUAL 5 3 3 DTTI The DTTIO is used to trigger the HW fault protection from the IPM When the phase current is large enough to trigger the HW over current fault the interrupt is got and all of the drive signals for the motor control will shut off immediately ISR_MFT_WFG IPM fault signal low voltage H Trigger over Current Interrupt PWM closed Figure 5 4 DTTI Interrupt Jan 26 2015 AN709 00011 1v0 E TAN SPANSION USER MANUAL a 6 Demo System This chapter introduces one example of inverter servo motor project and help you run a motor quickly The primary steps are shown as following e Hardware Connection e FW Interface Configuration e Encoder Check e Run Motor e Speed Acceleration a

Download Pdf Manuals

image

Related Search

Related Contents

Super Slim Cassette User ManualVersion  N8180-58 Expressパワーディストリビューションユニット取扱説明書 (No    JamMan Solo - HARMAN Professional  AG Neovo PS-55    RESERVE POWER Manuel d`installation, d - EnerSys  Embroidery Pattern Color Change Table Tabla  Manuale Tecnico Pompa di Calore AR-MT  BiB - Commune de Belin  

Copyright © All rights reserved.
Failed to retrieve file