Home

FM3 Inverter Sensor Washing Machine Firmware User Manual

image

Contents

1. No Feature Description Remark Hall status self check Hall Self check Hall phase angle Check whether the hall circuit in hardware part is normal gt Hardware Self check whether the current sample by A D is right 3 Adjustable Carrier Carrier frequency can be set by the Frequency corresponding variable in user interface Hall Angle Control Rotor phase angle was corrected by hall edge jump interrupt 5 Motor Speed Calculate Calculate speed by hall signals 6 Field Weaken Control Run motor in field weaken area to raise speed 7 FOC Control Using FOC control algorithm 8 Self adaption Start Up Adaptive to different load to start up motor This function is used to speed up or slow down 9 Speed regulate a motor by the command from host via UART or debugger Stop motor by braking down 10 Brake Speed Slow down by braking algorithm 11 Cuneo eame Dua shunts sample Single shunt sample algorithm DC voltage protection A D offset protection Lock rotor protection 12 Power protection Protect Hall single line lost protection IPM temperature protection Motor phase lost protection Over Current Protection 13 OOB Out of balance OOB load detection 14 Weight The weight of the load detection Uia Siop Bunning Motor can switch running direction CCW and CW without stopping motor 16 UART Receive and tran
2. a Weight_stcCtrl struct Weight start flag cstart 0x00 Start detecting the power in weight cPowsrDetscStart Ex Flag for the speed acceleration finish cReachSpdN2 0x00 usvtFinish dram 0x00 Sig t finis ag 1 5 welg t over time uBWiStage 0x00 Weight stage u32PowerN1 array Average power in one drum cycle at stable running N1 u32PowerAcce Sum power at weight speed up ulbAcceCycle 0 Drum cycle at weight speed up u32WtvalueTemp 0 Original weight result of the load u32Wtvalue 0 Weight result of the load by the DC voltage compensation ul bLoadValue 0 Weight result of the load u3ewWtTimeOut 960000 EUER E Max weight time unit s OOB stcCtrl The structure is used for OOB detect The detailed information can be found in the comments for each variable OOB stcCtrl struct cOOBEn 0x00 OOB detect start flag u8BOOBStage 0x00 OOB detection stage 4 means OOB finished u3200bData 0 Original OOB data of the load ul amp OOBValue 65535 OOB result to host UnStop stcParam The structure is used for un stop running The detailed information can be found in the comments for each variable UnStop stcParam cStart be cStop cForceRunning cFirstCompose m cAngleComposeStart be i32022_AngleError L 32022 AngleComposeDth struct 0x00 Start unstop running 0x00 Sto
3. nennen nnne nennt rent nnnr nnne 30 Figure 9 5 AG PIUO pe J 30 Figure 9 6 Open the Workspace 31 Figure 9 7 Interface File 442444440 nnne nnn nnne 31 Figure 9 8 Motor Parameter 56 32 Figure 9 9 Washing Machine Parameter Setting ccceesceeeeeeeeeeeeeneeeeeeseeeseaeeseaeeeeaeeseaeesneeseeeeeeenes 32 Figure 9 10 Inverter Parameter nenn 33 Figure 9 11 ADC Port 444 444444 nnnm nnne nnne ite 33 Figure 9 12 GPIO Port Set OH EE ERE EON 33 Figure 9 13 Hall Port 2 0 2444454 nennen nnne rint nennt tinte 34 Figure 9 14 Function Selection 34 Fig re 9 15 MCU Clock Setting iconic ciere re hune ra anu xara CERE e 34 Figure 9 16 A D Converter Setting 35 Figure 9 17 Variables Setting for Motor 35 Figure 9 18 Pl Parameter retten RR REGE NER RE Spo SER eai 35 Figure 9 19 Field Weaken and Limitation 5 36 Figure 9 20 VART RO
4. 38 Table 9 3 Global Structure for Hall Check 39 Table 9 4 Drum Running Status by the Command Speed sse 41 Table 9 5 Typical Running Status by the Command Speed sse 42 4 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL EN 1 Introduction 1 1 Purpose This user manual describes SPANSION inverter sensor washing machine solution and describes how to use inverter washing machine FW library This document will help you acquire a quick understanding of how to build a washing machine project and how to debug the motor with SPANSION inverter sensor washing machine FW library The document introduces the basic information of the washing machine solution including hardware firmware initial functions basic motor setting functions and FOC drive modules When you have understood these contents you can get an overview of a whole washing machine project And you can run a motor following the demo project steps 1 2 Definitions Acronyms and Abbreviations API 5 Application Programming Interface FOC Field Oriented Control FW Firmware HW Hardware Input and output CW Clockwise CCW Counter clockwise WM Washing Machine 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
5. uint32 t UnderVoltageProtectTime 30 2000 configure the under voltage protect max time 2000ms uint32 t RecoverVoltageProtectTime 2000 configure the voltage back normal from error s time 2000ms Figure 9 24 Protection Parameter Setting 9 2 2 HW Check The HW performance can be self checked by the HW check module If the HW has been already used for a long time this module can be ignored And the motor can be normally started as shown in section 9 2 4Run Motor Note The HW performance must be validated and the related FW setting must be also correctly set otherwise the hall self check and the motor may not run well Jan 26 2015 AN706 00095 1v0 E 37 SPANSION a USER MANUAL 9 2 2 1 FW Setting Set the variable FW_TEST_MODE TRUE to 1 to make the control system run in debug mode Set the real DC bus that is measured by multi meter between the PN points on the HW to the macro definition as following define DC_INPUT 310 the DC input voltage to inverter board in test mode unit V 9 2 2 2 HW Check Run 9 2 3 eb eb e Click the debugger button Make Restart Debugger to connect the J link and paste the global structure HwCheck_sitcPar into the Live Watch the IAR debug online Enable the HW check function by the variable cStart that is shown in Table 9 2 the HW performance such as DC sample and HW over current point can be self checked by this function Table 9 2 G
6. 12 Jan 26 2015 AN706 00095 1v0 E USER MANUAL SPANSION a End less loop in Main c InitPowerOn FeedWDT Motor Start Stop Uart_Communicate 15 FOC control Current Speed amp Position restoration Generate ISR Hall Hall Interrupt Hall status check Hall correct angle generate Speed Calculate from Hall ISR ADC unit1 IPM temperature sample and calculate Current U V W sample DC bus sample and calculate ISR ADC unitO SVPWM Other algorithms Weight amp Protection High Priority Figure 4 4 Diagram of the Control Flow Jan 26 2015 AN706 00095 1v0 E 13 lt SPANSION AN USER MANUAL 5 System Function This chapter introduces the system function of the macro definition global structure definition and function definition in detail 5 1 Macro Definition The macro definition for the user will be described in section 9 2 1FW Interface Configuration 5 2 Global Structure and Variable Definition The variable for user interface can be found in section 9 2 1FW Interface Configuration Any structure or variable that you want to watch can be pasted into the Live Watch window of IAR as shown in Figure 5 1 IAR Embedded Workbench IDE File Edit View Project Debug Disassembly J Link Tools Window Help Dag 588 oo x Debug 33 Disclaimer V1 2 Expres
7. u8StableTime 4 stable run time before OOBDetect stage unit s UI 02010 weight parameter setting 7 16 tWeight il6WtSpdN1 90 stable running at weight speed nl 16 tWeight il6WtSpdN2 130 speed accelerate to n2 char t Weight cEn TRUE weight function enable float Weight fCoe 7 0 coefficient of the weight data with DC bus BLDC default acceleration for debug mode Figure 9 22 OOB and Weight Parameter Setting Un Stop Setting UI 02011 UnStop parameter setting 2 uint8_t UnStopCCW_EleCycle 10 configure the unstop CCW running ele cycle uint8 t UnStopCW EleCycle 10 configure the unstop CW running ele cycle 16 t il6UnStopSpd 45 configure the unstop running spd Figure 9 23 Un Stop Parameter Setting Protection Setting The protection setting is just the prompt The detailed information can be found in the FW Charit LockRotorProtectEn TRUE uint32 t LockMinspd 10 configure the locked min speed 10r min uint32 t LockMaxTime 4000 configure the check lock max time 4000ms char t DCVoltageProtectEn TRUE uintl6 t DCVoltageMax 400 configure the over voltage protect value 400V uintl16 t DCVoltageMin 200 150 configure the under voltage protect value 150V uint32 t OverVoltageProtectTime 50 200 configure the over voltage protect max time 200ms
8. 9 1 1 Hardware Connection It is necessary to connect below 4 lines 1 Connect motor s hall signal to inverter board shown as below Figure 9 2 Hall Signal Line Connection The Hall signal line connection is defined in the following table Table 9 1 Hall Connection Motor s line Inverter board circuit port Hall A Hall A Hall B Hall B Hall C Hall C 5 VCC GND GND Note e f there are only 2 hall signals on the motor the hall and B line be only connected to the inverter s Hall A and Hall B port Don t connect to the Hall C port on the board e VCC and GND must be connected rightly otherwise the hall won t work properly and the motor will also not run 2 Connect motor s U V W phase lines to inverter board shown as below Figure 9 3 Motor Line Connection Motor s U V W line can be optionally connected to Inverter s IPM s output U V W 3 Connect JTAG to Inverter shown as below Jan 26 2015 AN706 00095 1v0 E 29 USER MANUAL Figure 9 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 note book 4 Connect AC power to Inverter board shown as below Figure 9 5 AC Plug 9 2 Motor Debug The debug method on the new motor is described in this section when you finish the hardware connection with the motor Click the IAR program to open the IAR and o
9. dba per 36 Figure 9 21 Speed Setting 0422222 4 0000 0 nennen nennen nenne nnns nnne ntes nnne nnns nnne 36 Figure 9 22 and Weight Parameter Setting 37 Figure 9 23 Un Stop Parameter 37 Figure 9 24 Protection Parameter 37 Figure 9 25 Macro Definition for the Test 38 Figure 9 26 Hall Check 2 4 42444444 inre tnnt nnns entren 39 Figure 9 27 Configure Parameter to Test the Hall Phase 40 Figure 9 28 Motor Run by eet eria RE RERO RH RENE 41 Tables Table 3 1 MCU Development Environment 7 Table 4 1 Feature List of Sensor WM Solution 8 Table 4 2 Directory Description of 9 Table 4 3 File Description 12 Table 5 1 System Function List 21 Table 6 1 Event Function List by the Motor Process 2 22 Table 6 2 Event Function List by the Timer Event 23 Table 7 1 Driver FUMGHION LISt es A 24 Table 4 1 System Used Interrupt Function 25 Table 9 1 lt moo Se DEM EE EE RED 29 Table 9 2 Global Structure for HW Check
10. Chapter 5 explains System Function Chapter 6 explains Event Function Chapter 7 explains Driver Function Chapter 8 explains Interrupt Function Chapter 9 explains Demo System 1 4 Reference Documents HW User Manual MCU UM 510115 E 12 WM EVB_HW pdf Jan 26 2015 AN706 00095 1v0 E 5 USER MANUAL AN M 2 System Hardware Environment The following lists the MCUs used in washing machine inverter board CPU chip Spansion MB9AF111K MB9AF312K CPU Frequency 40MHz MCU pin number 48pin RAM Space 16Kbytes Code Space 128Kbytes Demo HW version WM MAINBORAD VO 3 1 6 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL AN 3 Development Environment Table 3 1 MCU Development Environment Name Description Part Number Manufacturer Remark IAR bedded FW code edit compile and N A N A N A Workbench6 40 debug J Link Debug and Load FW by JTAG N A N A N A SPANSION FLASH N A Flash download program N A N A LOADER Source Insight V3 50 Source code edit N A N A Editor Eclipse Source code edit N A N A Editor Jan 26 2015 AN706 00095 1v0 E 7 a gt lt SPANSION Cw USER MANUAL 4 System Firmware Design This chapter introduces the FW structure of inverter washing machine project 4 1 FW Feature The features of the sensor inverter washing machine solution are shown in Table 4 1 Table 4 1 Feature List of Sensor WM Solution
11. Free Run Timer Interrupt 8 3 2 Hall Capture The PWC timer is used to capture the hall status change and the pulse of the edge of the hall signal ISR Hall Hall signal Voltage High or Low level kK One motor electrical cycle Y Trigger Hall interrupt Hall Edge Motor speed calculate change interrupt and and rotor phase angle base timer 2 over flow interrupt Base timer Count Over Flow Figure 8 3 Base Timer Interrupt 26 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL 8 3 3 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 8 4 DTTI Interrupt Jan 26 2015 AN706 00095 1v0 E 27 USER MANUAL 9 Demo System This chapter introduces one example of inverter washing machine project and help you run a motor quickly 9 1 Demo System Introduction The sensor washing machine solution can be adaptive to any type of washing machine which uses the PMSM or BLDC motor The connection diagram for debugger is shown in Figure 9 1 Ea d Figure 9 1 System Connection 28 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL
12. 0x00 Counter for the field weaken u8ExeCycle Ox00 The cycle of field weaken PI unit 1ms u32BaseSpd 0 The base drum speed of motor without filed weaken cForceOut 0x00 Exit the field weaken by the load disturbance usForceOutCycle 0x00 The cycle of field weaken unit 1ms u32BaseSpdRecord 0 The recorded base speed of drum speed ul6DCYoltageRecord 0 The recorded DC bus voltage when enter the field weaken 5 2 3 Variables for Speed and Position Angle_stcGenerate The structure is used for rotor position generation The detailed information can be found in the comments for each variable Angle stcGenerate struct i32022 Rotor ngle 3495000 Rotor s output angle i32022 RotorDtheta 0 Rotor s forward angle every PWM 132022 RotorDthetaMin 830 Rotor s min forward angle every PWM i32Q25 RotorDthetaKts 1328 Rotor s forward angle calculated factor u8StartPassHallNumber 0x00 Rotor pass hall number when start up Jan 26 2015 AN706 00095 1v0 E 17 SPANSION USER MANUAL Spd stcPar The structure is used for outputting the rotor speed calculation result The detailed information can be found in the comments for each variable Spd stcPar i32MotorRpmLpt i32MotorRpmRt 2 2 SpdLpfParam 5 i32MotorEleSpd struct i32012 ImA MMRatio 428 struct The output motor average speed The o
13. HW If the motor phase is not correctly connected the Hall status list and angle must be re checked and modified to the motor parameter shown in section 9 2 3Hall Check 9 3 4 High Power Consumption If the power or the phase current is bigger than other solution and you can watch the value of d axis voltage Motor_2rVoltage Q8_d on the rotating frame at the speed of 45rpm If the variable s value is out the range of 10V to 10V which indicates the rotor angle corrected by the hall may not be so accurate You can do as follows e The Hall status list and angle must be re checked and modified to the motor parameter shown in section 9 2 3Hall Check e Ifthe power consumption is still higher you can make the same offset on correct angle for each hall status the array is Motor HallAngleCCW 7 Motor HallAngleCW 7 that is located at file 505 user Customerlnterface c Re compile the projection and debug at the same working condition and you can find the best angle list when the power is the best Jan 26 2015 AN706 00095 1v0 E 43 SPANSION USER MANUAL 10 Additional Information For more Information on Spansion semiconductor products visit the following websites English version address http Awww 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
14. PORT PIN defineHALL ER CH 0 define HALL define HALL defineHALL defineHALL define HALL define HALL defineHALL defineHALL PORT4 PINS Port P49 BT CH 0 timer timer 0 0 PORT4 Port PIN10 P4A 1 timer timer 1 0 PORT6 Port P61 BT CH 2 timer timer 2 2 Figure 9 13 Hall Port Set The hall I O is recommended to connect to the port the same as HW demo due to the special MCU peripheral usage Selectable Function Setting UI 0304 Function set wf char t FW TEST MODE FALSE HW Hall check set TRUE FALSE work in debug mode for testing HW and Hall work in normal mode and disable Hall check Figure 9 14 Function Selection The advanced functions are set in this part if you want to run the hall and HW check functions the variable FW TEST MODE can be set to TRUE to run these functions 9 2 1 2 Advanced Variables Setting If the motor runs well in any working condition the settings in this section do not need to be changed The settings can be changed to improve the corresponding performance of the module Advanced Setting for MCU These parts are not recommended to modify for the inverter washing machine solution in the file HO5 user Customerlnterface h MCU Clock Setting The MCU on the Demo Board is MB9AF111K The maximum machine fre
15. Spansion Solutions Spansion com China mcu ticket cn spansion com Europe mcu ticket de spansion com Japan mcu ticket jp gt spansion com Other http www spansion com Support SES Pages Ask Spansion aspx 44 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL AN706 00095 1v0 E SpansioneApplication Note FM3 Family 32 BIT MICROCONTROLLER Washing Machine 3 Phase BLDC FOC Control With Hall Sensor User Manual Jan 2015 Rev 1 0 Published Spansion Inc Edited Communications Jan 26 2015 706 00095 1 0 45 SPANSION 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
16. not recommended to modify it The priority used for motor control is shown Figure 8 1 voidInitNVIC void UND CONF PrIonityEOr CONF PLIOrICYEOE ConEPriorityror ContPriorityror DonfPrioritvFor LConfPrioritvRor LonfPrioritvrFot ConfPrioritvPor ConfPrioritvEor ConfPrSOTIEVREOr 5 IRQn 4 PRI LEVEL 6 UART receive MFS3TX IRQn 4 PRI LEVEL 6 WFG IRQn 4 PRI LEVEL 0 EXINTO 7 IRQn 4 P SWDT IRQn 4 PRI LE ADCO IRQn 4 1 IRQn 4 FRTIM IRQn 4 OUTCOMP IRQn BTIMO 7 IRQn UART Transmit watchdog LEVEL 0 outside int EL 1 software watch dog adcO adcl IEEE PRI LEVEL 2 EVEL 4 LEVEL 3 LEVEL 6 LEVEL 5 PRI PRI 4 P 4 P outcompare hall Cc Oi OF Oi Oi Ov Gi O Or Figure 8 1 Interrupt Priority Setting Jan 26 2015 AN706 00095 1v0 E 25 SPANSION USER MANUAL 8 3 Interrupt Generation The diagram of the interrupt used for the motor control is briefly introduced in this section 8 3 1 MFT The multifunction timer is used to generate the interrupt for the motor control algorithm and trigger the AD sample at the zero point ISR MFT FRT Free run timer 0 UP DOWN mode PWM cycle 62 5 us 16K Hz Trigger AD unitO and FOC interrupt A D 0 sample U V W current FOC interrupt to drive motor Figure 8 2
17. 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 facility 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 i
18. 6 KHz The phase current AD sample frequency is 16 KHz And the dead time of the SVPWM is 2us B Basic setting for HW The basic settings for the HW can be set in the H file 05 user Customerlnterface h ADC Port and Coefficient Setting UI 0301 ADC port and coefficient set MOTOR SHUNT NUMBER 2 current sample resistor CURRENT RS 0 02 Iuvw sample resistor unit ohm Current Amplifier Multiple 10 calculation factor VDC Amplifier Multiple 96 0 Vde calculation factor define define define define define define define define define DCV RIN ADC CH 2 Vdc sample channel MOTOR U PIN ADC CH 0 Iu sample channel MOTOR V PIN ADC CH 1 Iv sample channel MOTOR W PIN Iw sample channel IPM EMP PIN ADC CH 3 IPM temperature sample channel Figure 9 11 ADC Port Setting The Demo Board s current sample resistor is 0 020 current amplification factor is 10 times DC Bus voltage sample factor is 96 Relay and Other GPIO Setting UI 0302 configure relay and other GPIO Relay port setting define RELAY PORT PORTS define RELAY PIN PIN2 other G PIO setting Figure 9 12 GPIO Port Set Other GIPO used by customer can be set in this part Jan 26 2015 AN706 00095 1v0 E 33 SPANSION a USER MANUAL Hall 1 0 and Pin set IS OS conbuguse halls AO ee E E define HAL define HAL defineHALL A
19. 7 Interface File Diagram Jan 26 2015 AN706 00095 1v0 E 31 SPANSION USER MANUAL 9 2 1 1 Basic Setting The motor can be started easily after basic setting So the basic variables and macro definitions must be correctly set for the motor demo running All of the HW settings in this section must be based on Hardware User Manual A Basic Variables Setting The basic variables can be set in the c source file 505 user Customerlnterface c Motor Parameter Configuration The motor parameter must be correctly set except the hall related parameters that is red highlighted in Figure 9 8 When the hall related parameter is self checked by hall check module it must be set correctly according to 9 2 3 3 Motor Parameter 0101 configure motor parameter define MOTOR ID 0 motor ID number 0 new motor param gt 1 already debug motor add at the end of this file if 0 MOTOR ID new motor param gt LS BLDC uint8 t Motor pole pairs 12 the rotor uint8 t Motor HallNumber THREE HALL 3or 2 hall number of the motor float Motor CurrentMax 6 0 max peak phase current unit A float Motor Rs phase resistor of motor unit ohm float Motor Ls 24 phase inductance of motor unit mH uint8 t Motor HallStatuList 7 0 3 1 5 4 6 2 hall status change sequence int32 t Motor HallAngleCCW 7 0 DEGREE 210 DEGREE 90
20. 8 9 2 4 RUN MO tO Fics PET 40 9 2 5 Speed Acceleration and Deceleration 42 9 3 Troubleshooltitig iiit 42 9 3 1 Motor Star UD 42 9 3 2 Protection EXE 42 9 3 3 Drum Direction 43 9 3 4 Power Consumption 2 8 43 10 Additional Informatio eosar eiaa eaa NRA EE eei 44 Figures Figure 4 1 Structure of 9 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL ww Figure 4 2 Sub files in Each 10 Figure 4 3 Sensor WM FW 11 Figure 4 4 Diagram of the Control Flow 13 Figure 5 1 Diagram of Live Walch eiae nt EROR 14 Figure 8 1 Interrupt Priority Setting 25 Figure 8 2 Free Run Timer 22442 4 nnne 26 Figure 8 3 Base Timer 220444442 0 NEEE anaE EAE Eai 26 Figure 8 4 DT TI Interrupt err eire a e REX 27 Figure 9 1 System 28 Figure 9 2 Hall Signal Line 29 Figure 9 3 Motor Line 29 Figure 9 4 JTAG Line Connection 44441 0
21. DEGREE 150 DEGREE 330 DEGREE 270 DEGREE 30 int32 t Motor HallAngleCW 7 0 DEGREE 90 DEGREE 330 DEGREE 30 N DEGREE 210 DEGREE 150 DEGREE 270 Figure 9 8 Motor Parameter Set WM Parameter Setting UI 0102 configure WM parameter char t WM cType DD washer type DD DDM BLDC BLDCMjust copy it float Wm TransRate 1 TransRate of washer DD gt 1 BLDC gt TBD int32 t WM MinSpd j min speed of drum unit rpm Figure 9 9 Washing Machine Parameter Setting e washing machine type must be correctly set the drum running direction maybe reversed by the incorrect setting e transmission ratio of the motor for the washing machine must be correctly set also Otherwise the drum speed will be incorrect Wm TransRate 1 for the DD and DDM washing machine 32 Jan 26 2015 AN706 00095 1v0 E U SPANSION SER MANUAL Inverter Parameter Configuration The inverter carrier frequency can be set by the reserved variable but the variables in this part are not recommended to modify for the washing machine application UI 0103 configure inverter parameter 860003 67 frequency Of motor driver nts uint32 t RelayDelayOnTms 2000 time delay for relay switched on unit ms Figure 9 10 Inverter Parameter Set The carrier frequency of the washing machine is 1
22. Diagram of Live Watch 14 Jan 26 2015 706 00095 1 0 SPANSION USER MANUAL 5 2 1 Variables for Motor Running Motor stcRunParam The structure is used to control motor run or stop and the basic running information for the motor such as real running speed DC bus voltage washing machine work mode etc Detailed information can be found in the comments for each variable typedefstruct online uni intl speed PI u intl intl intl il6WmCommandSpdRpm the command speed of drum from UART or debugger il WmTargetSpdRpm the middle speed for the reference speed of rpm il6WmSpdRpmRt the real time drum speed of washing machine il6WmSpdRpmLPF the filtered drum speed of washing machine il6MotorSpdRpmRt the real time motor speed of washing machine il6MotorSpdRpmLPF the filtered motor speed of washing machine char tcWorkMode wash or spin work mode char tcRunStatus Site etu Sis 0 gt stop SS Run char tcRunDir run direction CW or CCW uint16 t ul6FaultCode protection fault code uint8 t u8InitStage the start initial state machine uintl16 t ul6Vbus the DC bus voltage unit V uintl16 t ul6VbusLpf the DC bus voltage lpf value uint32 t u32022 RotorEleTheta the rotor position angle uint16 t ul6BrakeTime brake time unit 1ms char tcStartupcomplete flag for motor startup finish charstecloseloop f
23. ER CURRENT 0x0008 over current of HW define MOTOR LOSE PHASE 0x0010 motor lose phase define CONECT COMPRESSOR 0x0020 motor connected define AD_MIDDLE_ERROR 0x0040 sample 2 5V offset error define SF_WTD_RESET 0x0080 A FW watch dog reset define MOTOR_LOCK 0x0100 motor lock define UNDEFINED_INT 0x0200 undefined interrupt define HW_WTD_RESET 0x0400 HW watch dog reset vashing machine fault code define POWER OVER 0x0800 over power define IPM TEMPOVER 0 1000 over current define HALL LOST 0x2000 Hall lost fault define COMM ERROR 0 4000 communicate error code define SINK ERR 0x8000 circuit fault 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 9 3 3 Drum Direction Reversed If the running direction of the drum does not match the requirement of washing machine there are two possibilities for this trouble e type of washing machine is not correctly set as section WM Parameter Setting The CCW direction of motor and drum are different from DD or DDM for the belt drive washing machine e The U V W of the motor phase is not correctly connected on the corresponding port on the
24. FT ISR TimerEvent c void Timer Event void The timer event for the motor control or the advanced TimerEvent c function Jan 26 2015 AN706 00095 1v0 E 21 a gt lt SPANSION USER MANUAL 6 Event Function The primary functions for the motor inverter control are introduced in this chapter 6 1 Function List The functions for the motor control that are called the MFT ISR Motor Process and timer Timer Event are shown in Table 6 1 and Table 6 2 Table 6 1 Event Function List by the Motor_Process Prototype Description CaptureOn The hall status check at the first electrical cycle of the motor by the query mode when the power is on UnStop Run The main function for the un stop running Spd EstimateCalculate The speed calculate function by the estimator Spd Calculate The speed calculate function by the estimator and hall module Motor Sense The phase current restoration from ADC converter ClarkeTransform amp Motor 3sCurrent The function of the Clarke frame transform amp Motor 2sCurrent ParkTransform amp Motor 2sCurrent The function of the Park frame transform amp Motor 2rCurrent Posi Estimate The function of the rotor position estimator Posi Calculate The function of the rotor position calculation from the estimator and hall module Angle Generate The function of the rotor position generation Curren
25. Motor emen 15 5 2 2 Variables for FOG ie ier 16 5 2 3 Variables for Speed and 17 5 2 4 Variables for PID 18 5 2 5 Variables for Washing Machine 19 SES EMEB SUIS E EROR DU eles toes lag E A eaaa aE ESAE 21 6 Event FUNCION ees 22 6 1 2 ee E 22 PI daipei eee 24 7 1 met 24 8 Interrupt FUFIgCIUOTD iri te Lina o FR LER Eo dre e 25 8 1 EEUU 25 8 2 Interrupt Priority 0 nennen nennen neret 25 8 3 Interrupt Generation 26 8 3 1 id I 26 8 3 2 Halll T 26 8 3 3 27 9 Demo Systemes iad S 28 91 Demo System 28 9 1 1 Hardware eese Pan e aret 29 9 2 DDU e 30 9 2 1 FW Interface 31 9 2 2 ab AMO 0 V 37 9 2 3 Halli Gh6Ck e Aaland 3
26. Motor 2rVoltage struct 0 200 36 Angle stcGenerate struct 0x200 37 Add description here Motor 2rCurrentRef struct 0x200 38 Motor 2rCurrent struct 0 200 39 History Motor stcRunParam R ct 0x200 40 2013 10 14 V0 4 4 First i16WmCommandSpdRpm CE 0x200 41 4 Author Einar He i16WmTargetSpdRpm 0 0 200 42 dXXd i16 WmSpdRpmRt 0x200 0 i18WmSpdRpmLPF 0 0 200 Toast p APPS il amp BMotorSpdRpmLPF 0 0 200 47static char t cRelay pen 0 cWorkMode 1 ea 48 void InitPowerOn cRunStatus Avoid main void cRunDir 200 50 ul amp FaultCode 0 0000 0 200 51 InitPowerOn initial u amp lnitStage 0x00 0x200 52 while TRUE ulbVvbus 306 0x200 53 4 ul amp VbusLpf 306 0x200 54 32022 RotorEleTheta 0 0 200 55 FeedWDT SUDT ul6BrakeTime 0 0x200 56 if FALSE cRelay pen cStartupcomplete 0x00 0x200 57 1 cCloseloop 0x00 0 200 ure 9 28 Motor Run by J link And you can take the Table 9 4 for your detailed reference for the speed command Table 9 4 Drum Running Status by the Command Speed Motor Drum Direction Motor s status i16WmCommandSpdRpm gt 0 CCW Running lt 0 CW Running 0 Stop Stop Note e All of the command speed from the debugger or UART is defined as the drum speed e Do not click the button D to break the FW r
27. able 9 3 Global Structure for Hall Check 3 HallCheck stcPar struct Hall check start command pe cStart 0200 ie cStop 00 00 Hall check stop command cOver Ox0D ae finished flag m cStage 0x00 all check stage cError 0x00 Flag for Hall check error 0x00 Flag for Hall number error p cNumberError cStatusError 0x00 for Hall status error cTimeOverError 0x00 Flag for Hall check time out error Em u8HallSensorNumber 0 00 The hall number of the motor uBStatusTable The status list table x 132022 array The CCW angle table 1320122 AngleCw array The CW angle table u8StatusTable de 0 0x00 1 0x04 2 2 Qd 3 2 0x02 4 RD US 5 ODD 6 2 0x05 7 0x00 4 132022 array 0 E 2 149 3 209 4 29 5 329 6 89 7 0 gt 132022 array 0 0 1 149 2 29 3 89 4 270 5 209 6 330 7 0 Figure 9 26 Hall Check Result Jan 26 2015 AN706 00095 1v0 E 39 SPANSION USER MANUAL 9 2 3 3 Motor Parameter Configuration The data output by the hall check function in the Figure 9 26 must be filled into corresponding variables or array for the motor s normal running in the file 505 user Customerlnterfac
28. ake CV Limit c The FOC current and voltage limitation module FieldWeaken c The Field Weaken module Hall Capture c Hall capture module Hall Check c Hall check module HW Check c HW check module Initial c MCU system initialization including interrupt priority list ISR c The ISR file for all of the interrupt routine of the MCU Motor Run c The main file of the motor control including the main function of FOC process of motor and the start stop function of motor S04 app Motor Startup c The motor start up module OOB c The OOB detect module PID Control c PID control module that including the Speed current PI parameter self changing Position Calulate c The position calculate module Protect c The protect module SingleShunt c The single shunt module Speed Calculate c The speed calculate module SpeedSet c The speed setting module Timer Event c Timer event module UART c The UART module UnStop c The Unstop running module Weight c The electrical weight module S02 Driver Ignored Customerlnterface c The motor parameter setting S05 User Main c Main function Vector Table c MCU interrupt vector list 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 and AD converter The timer events are executed in the end less loop and the timers are generated in the zero detection interrupt SR of the free run timer 0
29. dSpdRPM 0 the brak nd speed of drum unit rpm Figure 9 17 Variables Setting for Motor Running Parameter Setting UI 0204 PI parameter setting uintl6 t PI SPD Doing Cycle 1 speed PI cycle unit 1ms float Spd Kp Min 15 float PI Spd Kp Max 50 float PI Spd Ki Min 0 2 float PI Spd Ki Max 0 5 float PI Idq Kp Wash 12098 float PI Idq Kp Spin 5 0 float Idq Ki Wash 0 03 float PI Idq Ki Spin 0 03 uintl6 t PI Field Doing Cycle 60 Field weaken PI cycle unit ims float PI FieldWeaken Ki Init float PI FieldWeaken Kp Init Figure 9 18 Parameter Setting Jan 26 2015 AN706 00095 1v0 E 35 USER MANUAL b Field Weaken and Limitation Setting The minimum field weakening running current the FOC current and the voltage limit can be set in this part UI 0205 Field Weaken variables setting float FieldWeaken IsMin 0 05 min current in field weak unit A IsMax Motor CurrentMax Limit IdUsage calculate on line unit A joie TE float Limit VsUsage 1 00 DC voltage usage rate for FOC float Limit VdUsage 0 98 d axis voltage usage rate for FOC float Limit IsUsage 0 95 d and q axis current usage rate for the FOC float Limit IdUsage 0 8 d axis current usage rate in the field weaken Figure 9 19 Field Weaken and Limitation Setting UART Setting UI 0207 UART setting uf
30. e motor pole pairs according to the motor SPEC from manufacturer to the flowing variable UI 0101 Configuration motor parameter uint8 t Motor pole pairs 12 the pole pairs of rotor float Motor CurrentMax 6 0 max peak phase current unit A float Motor Rs 6 phase resistor of motor unit ohm float Motor_Ls 24 phase inductance of motor unit mH Motor Rs This parameter is used for the hall check validation and it can be measured by multi meter Motor_Ls This parameter is used for the hall check validation 38 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL EN Set the washing machine parameters according to the following variables UI 0102Configuration WM parameter char t WM _cType DD washing machine type DD DDM BLDC BLDOM just copy it float Wm TransRate 1 TransRate of washing machine DD gt 1 BLDC gt TBD 9 2 3 2 Hall Check Run eb eb e Click the debugger button RestartDebugger to connect the J link and paste the global structure stcPar into the Live Watch in the IAR debug online Enable the hall check function by the variable cStart as Table 9 3 and the hall information of the motor can be self checked by this function When the hall check finished flag cOver is set to 1 the hall information is output by the global structure as Table 9 3 and Figure 9 26 Note the load in the drum must be empty for the hall check T
31. e c as following char FW TEST MODE TRUE HW Hall check set 2 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 40 Jan 26 2015 AN706 00095 1v0 E USER MANUAL SPANSION 3 Compile project and download program to inverter board by the J link Click button A that is shown in Figure 9 28 to connect the J link and download the FW into the MCU 2 button B to run the FW online After two seconds the relay is switched on you can enter none zero speed value to start the motor in the structure that is shown as C For example when the variable Motor_stcRunParam i16WmCommandSpdRpm 90 by your online input the drum speed of the washing machine will CCW run to 90rpm E IAR Embedded Workbench IDE File Edit View Project Debug Disassembly J Link Tools Window Help Files o C WM Platform Debug C3H01 global C1H02 driver C3H03 module L3H04 app user S01 global 1802 driver 503 module 1804 app 1505 user Customerlnterface c Main c E Vector Table c Output Fig a foi A D B wo Se gt NEA 33 Disclaimer Vi 2 Expression Value Locati 34 45444444 4444444 4k 444444444 44444445 2 SpdSt stcSpdSet struct 0x200 35 44 file Main c
32. e c as follows UI 0101 configure motor parameter define MOTOR ID 0 motor ID number 0 new motor parameter gt 1 already debug motor add at end of this file if 0 MOTOR ID new motor param gt LS BLDC Wines Motor pole 1 2 the pole pairs of rotor uint8 t Motor HallNumber THREE HALL 3or 2 hall number of the motor float Motor CurrentMax 6 0 max peak phasecurrent unit A floatMotor Rs 6 phase resistor of motor unit ohm float Motor Ls 24 phase inductance of motor unit mH uint8 t Motor HallStatuList 7 0 4 6 2 3 1 5 hall status change sequence int32 t Motor HallAngleCCW 7 0 DEGREE 270 DEGREE 150 DE EE 210 DEGREE 30 DEGREE 330 DEGREE 90 int32 t Motor HallAngleCW 7 0 DEGREE 150 DEGREE 30 DEGREE 90 N DEGREE 270 DEGREE 210 DEGREE 330 Figure 9 27 Configure Parameter to Test the Hall Phase Angle MOTOR D The motor ID for user if the new motor is used for the debug the motor can be set in the region tif 0 MOTOR ID and set the MOTOR 10 0 If the motor runs well with these motor parameters these parameters can be fixed and added at the end of the S05 user Customerlnterface c And you can Switch the motor debug more conveniently and quic
33. e dead time of the Initial c SVPWM max duty void Brake On void Porting setting for motor brake Brake c void Brake Off void Release the port to finish the brake Brake c 24 Jan 26 2015 AN706 00095 1v0 E 510 USER MANUAL AN 8 Interrupt Function 8 1 Function List Table 4 1 System Used Interrupt Function Prototype Description Remark root void ISR_HardWatchdog void The HW watch dog ISR S04 app ISR c root void ISR_SoftWatchdog void The software watch dog ISR S04 app ISR c root void ISR Hall void Hall interrupt S04 app ISR c root void ISR FRT void The MFT zero detect ISR for the motor control S04 app ISR c root void ISR WFG void The HW over current ISR S04 app ISR c root void 5 ADC unitO void The ADC unitO ISR trigger at the zero point for the 3 shunts S04 app ISR c root void 5 unit1 void The ADC unit1 ISR for the IPM temperature sample S04 app ISR c root void Isr_UartRx void UART receive interrupt by MFS3 S04 app ISR c root void Isr UartTx void UART transmit interrupt by MFS3 S04 app ISR c root void DefaultlRQHandler void MCU exception interrupt S04 app ISR c 8 2 Interrupt Priority Setting Each interrupt priority can be set by the function void InitNVIC void which is located at the file 504 app lnitial c Users are
34. ed Variables Setting If you want to change the default acceleration you can disable the UART macro definition UARTEN in UART h and set the default acceleration DefaultAcce or the maximum acceleration SpdSet_u16AcceLmt as you want When the motor needs to reverse the running direction you should stop the motor and then restart the motor to run in another direction 9 3 Troubleshooting 9 3 1 9 3 2 Motor Start up When the motor can t start up normally there may be 2 reasons 1 The Hall Angle found in debug mode is fault Even if the washing machine s load is empty it also can t Start up 2 The startup parameter is not set correctly User should change the parameter in 505 user Customerlnterface c and refer to the section Motor Start up Protection When the motor is stopped without the normal stop command the protection fault may appear you can see the value of the variable Motor stcRunParam 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 42 Jan 26 2015 AN706 00095 1v0 E USER MANUAL en define NORMAL RUNNING 0 0000 error define OVER VOLTAGE 0x0001 DC bus over voltage define UNDER VOLTAGE 0x0002 DC bus under voltage define SW OVER CURRENT 0 0004 over current define MOTOR OV
35. iguration and chapter 5 System Function The sub files in each folder are shown in Figure 4 2 and the structure of header files is the same as C files Jan 26 2015 AN706 00095 1v0 E 9 USER MANUAL SPANSION a Hafa S01 global 8 05504 E 604 Cm3 c ba E Sample c IUE P Angle Generate c Debug E D03 global Ha D03_BaseTimer c Limitc C1H02 driver Ha eld Was Ha FieldWeaken c 1 0 module 003 DualTimer c Ha Hall_Capture c 31H04 app Lac 003 GPIO c Ha H05 Hall_Check c 05 user Ha 003 Interrupt c r e 1003 ADC E HW Checkc Main h Ha E 003_MFT_FRT c Initial c D03_MFT_OC c Ha DISRc Ha 3 Ha D Motor_Run c D03 WFG c e 003 E Motor Startup c D03 Others c 0082 asi app N E D03 QPRC c Control c Ha 003 E Position Calulat 003 WDT c E Protect c E Main c a Hall Drive c Ha SingleShuntc E Vector N 42 71503 module Speed Calculat N EquTrans c SpeedSetc Platform o A TimerEvent c Math c UART c D poc UnStop c Weightc 1505 user E Customerinterfac Main c E Vector Tab
36. kly if you have the debugged parameter Motor pole pairs It must be got by the manufacturer Motor CurrentMax It can be got by the manufacturer or determined by the phase peak current at the motor brake stable stage Motor The parameter of motor phase resistor it can be measured by the multi meter Motor Ls The parameter of motor phase inductance Motor HallStatuLisi 7 The hall status change sequence it can be self checked and filled sequentially according to buffer HallCheck stcPar u8StatusTable 8 that is shown in Figure 9 26 Motor HallAngleCCW 7 The hall angle matched with each hall status for CCW running it can be self checked and filled sequentially according to buffer HallCheck stcPar 132022 AngleCCWT 8 that is shown in Figure 9 26 Note e Due to the check error the angle can be set to the integrate number nearby f HallCheck stcPar i32Q22 AngleCCW 1 269 is shown in Figure 9 26 we fill the buffer Motor Hall ngleCCW 1 270 as Figure 9 27 Motor HallAngleCW 7 The hall angle matched with each hall status for CW running it can be self checked and filled sequentially according to buffer HallCheck stcPar 132022 AngleCW 8 that is shown in Figure 9 26 9 2 4 Run Motor When the hall angle and status list have been checked and the HW performance check is correct by the FW TEST MODE the motor can be started for the demo show 1 Reset the variable FW TEST MODE macro definition in S05 user Customerlnterfac
37. lag for the motor closed loop running stc MotorRunParam t externstc MotorRunParam t Motor stcRunParam SpdSt stcSpdSet The structure is used to set the drum speed It is the global structure for the SpeedSet module that is realized in file 504 app SpeedSet c Detailed information can be found the comments for each variable the variables in this structure are not recommended to modify Jan 26 2015 AN706 00095 1v0 E 15 USER MANUAL typedefstruct stc SpdSet dmt ont il6SetSpeed setting speed of drum unit rpm il6SetSpeedPre previous setting speed of drum unit rpm ul6SpdChgTime speed change time from spd to uintl6 t ul6CommandSpeed the command speed of drum unit rpm char t cWorkMode the WM working mode wash or spin titime lG 6 ul6SpdChgCounter the speed regulate counter WMO u8SpdChgStep the speed change step for speed regulate char E cMotorStartFlag motor start flag Qa cMotorStopFlag motor stop flag cRotateDir motor running direction ul6AcceLmt the acceleration limit at speed up uintl6 t ul6DeceLmt the acceleration limit at speed down ipae bs ul6SpeedMax the maximum speed limit of drum speed uintl6 t ul6SpeedMin the min speed limit of drum speed Spdsec stc SpdSet t SpdSt stcSpdSet 5 2 2 Variables for FOC The variables for the FOC co
38. le c Figure 4 2 Sub files in Each Layer The relationship between each layer is shown as the diagram in Figure 4 3 10 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL User Layer User interface Main program entrance Interrupt vectors App Layer A D Offset Protect Over Current Protect Lock Rotor Protect Lose Phase Protect Hall Lost Protect Temperature Protect Voltage Protect Module Layer Clarke Transformer Inverse Clarke Transformer Park Transformer Inverse Park Transformer Drive Layer Global Layer Figure 4 3 Sensor WM FW Architecture Jan 26 2015 AN706 00095 1v0 E 11 a gt lt SPANSION a USER MANUAL 4 3 Files Description The detailed descriptions for each file are shown in Table 4 3 Table 4 3 File Description of Project Folder File Description S01_global G04_Cm3 c The file for MCU driver G04_Debug c Debug information for MCU driver EquTrans c FOC axis convert Filter c One order low pass filter S03 module Math c The math module including the function such as SQRT COS and SIN PID c The PID module for current and speed PI PWM c The SVPWM module ADC Sample c The ADC process module based on the ADC ISR Angle Generate c The rotor angle generation module Brake c The brake module including the speed down by br
39. lobal Structure for HW Check HwCheck_stcPar lt struct gt cStart 0x00 HW check start command cStop 0x00 HW check stop command 2 0x00 HW check finished flag cError 0x00 Flag for HW check error cDCEror 0x00 Flag for DC voltage check error cSampleError x00 Flag for current sample check error 208 OCPoint 0 Value of the HW over current protection When the HW check finished flag cOver is set to 1 the HW check result is output by the global structure as shown in Table 9 2 Hall Check When the basic setting has been finished the hall information can be self checked by the hall check module if the hall information is not known take one of the DD motor for top loading washing machine for example And if the hall information has been known this section can be ignored and the motor can be normally started and then take the reference at section 9 2 4Run Motor 9 2 3 1 FW Setting Set the variable FW TEST MODE TRUE according to Figure 9 25 to make the control system run in debug mode E CP WM Platform Debug 92 define C PORT PORTE m 93 define C PIN PINI E 94 define C TIMER BT CH 2 module 95 define C TIMER CH 2 H04 app 96 Ha C1H05 user 97 UI 0304 Function set m 98 define FU TEST Lien Figure 9 25 Macro Definition for the Test Mode Set th
40. n 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 and may be trademarks of their respective owners 46 Jan 26 2015 AN706 00095 1v0 E
41. ning power protection Protect Voltage The function of the DC bus over and under protection Protect IpmTemperature The function of the IPM temperature protection Debug Watch The basic variable assignment for the motor running 50ms Uart_Protect The function of the UART lost protection Jan 26 2015 AN706 00095 1v0 E 23 SPANSION a USER MANUAL 7 Driver Function The MCU peripheral resources used for motor control are introduced in this chapter 7 1 Function List MCU peripheral driver functions are mainly located in the file SO 4 app lnitial c Table 7 1 Driver Function List Prototype Description Remark void InitNVIC void The interrupt enable and the priority set that used in Initial c the motor control void InitClock void MCU clock initialization Initial c void InitWDT void Watch dog initialization Initial c void InitGPlO void The used GPIO initial user can add the GPIO for Initial c other usage void Motor_SVPWM_Init void The SVPWM initial such as the FRT mode and cycle Initial c AD trigger source OCCP mode etc void Motor SVPWM En void Enable the SVPWM output Initial c void Motor SVPWM Dis void Disable the SVPWM output Initial c void InitADC unsigned short The AD initial such as the port setting converter Initial c Motor Sample freq time setting trigger point etc void Motor configPWM void Configuration the PWM such as th
42. ntrol are introduced in this section D amp Q axis Current and Voltage Reference current value on the 2 axis rotation frames Kon curent MET Reference current on 28808 Q8 d 0 Reference current Q axis Iqref Q8 q 0 Cosine value of the rotor position used for the Q12 Cos 0 frame transform um Q12 Sin 0 Sine value of the rotor position used for the frame transform current value on the 2 axis rotation frames z Motor 2rCurrent struct Real time current on D axis Id Q8 d 0 Real time current on Q axis Iq ps Q8 q 0 Cosine value of the rotor position used for the E 012 Cos 2062 frame transform 012 Sin 3538 Sine value of the rotor position used for the frame transform Voltage value on the 2 axis rotation frames Motor ervoltage struct Real time voltage on D axis Vd Q8 d 0 Real time voltage on Q axis i Q8 q D Cosine value of the rotor position used for the pe 012 Cos 2062 frame transform 012 5 3538 Sine value of the rotor position used for the frame transform Motor Offset The AD middle points of amplifier part on the HW are got in this structure If the middle voltage of the amplifying circuit for the phase current is changed the AD offset result will also be changed 16 Jan 26 2015 706 00095 1 0 SPANSION USER MANUAL Motor Offset Motor Offset struct AD middle point for cu
43. out of speed Q16 format Dout of speed Q16 format Input error of speed Q8 format Previous input error of speed Q8 format Output of speed PI Q8 format Max output limit of speed Q8 format Min output limit of speed Q8 format 18 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL AN Pid_stclqPI The structure is used for the q axis current Iq PI regulator The detailed information can be found in the comments for each variable 5 2 5 Pid stclqPl struct 012 kp 45056 Kp parameter for Iq Q12 format a1 122 Ki parameter for Iq Q12 format Q20 Pout 315392 Pout of Iq 020 format 020 lout 21592088 Pout of Iq 020 format Q8 Error 5 Input error of Ig Q8 format Q8 Out 5290 Output error of Iq Q8 format Q8 46100 Max output limit of Iq Pl Q8 format Q8 Outmin 0 Min output limit of Q8 format Pid stcldPI The structure is used for the d axis current Id PI regulator The detailed information can be found in the comments for each variable Pid stcldPl struct Q12 kp 45056 Q12 ki 122 020 90112 020 lout 1380918 Q8 Error 4 Q8 353 Q8 Outmax 45061 Q8 45027 Kp parameter for Id 012 format Ki parameter for Id Q12 format Pout of Id 020 format Pout of Id Pl Q20 format Inpu
44. p unstop running 0x00 Run in force status flag 0x00 0x00 Angle compose start flag 0 Angle error between rotor and hall Compose angle speed 20 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL AN 5 3 Function List The functions for the system control are shown in Table 5 1 Table 5 1 System Function List Prototype Description Remark void main void Main function of the whole project Main c InitPowerOn The initial function for all the MCU resource initial and Main c key variable initial after the power is on Motor Runinit Motor CARRY FREQ The function for the motor start control but not for the Motor Run c motor start up Motor StopControl The function for the motor stop control Motor Run c Uart Communicate The main function for the UART communication UART c static void The key variable and the register initial at the motor Motor Run c Initial Motor RunPar unsigned short start sample freq void Motor Process void The main function of the motor control that is called Motor Run c each of the MFT zero detect ISR void Debug Process void The main function of the test mode for the hall and HW Motor Run c check and is also called in each of the MFT zero detect ISR void Debug Watch void The basic variable assignment for the motor running Motor Run c void Timer Counter void The 1ms 5ms 50ms timer generated by the M
45. pen the EWW file of the inverter washing machine work space as shown in Figure 9 6 30 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL AN l IAR Embedded Workbench IDE Edit View Project Tools Window Help New call RDP Sh WHS e Close asas d Workspace Save Workspace Close Workspace ave 5 jave 5 Look in O EWARM Save All Debug L 2 C3 settings My Recent WM Platform Recent Files Documents Recent Workspaces Type EWW File Date Modified 10 17 2013 9 43 Size 165 bytes Desktop My Documents My Computer File name WM Platform v My Network Files of type Workspace Files eww Figure 9 6 Open the Workspace 9 2 1 FW Interface Configuration All of the variables reserved for the user interfaces are located in the file 505 user Customerlnterface c and the macro definitions are located in the file 05 user Customerlnterface h Both files are highlighted as shown in Figure 9 7 Workspace Debug v Files ez Bg E C9 WM Platform Debug v C3 H01 global 3H02 driver C3H03 module 04 app 1 8 C1H05 user L i Customerlntertace h 1501 global 802 driver 2503 module 3804 app 1 8 1805 user I Customerlnterface c E Main c Vector Table c Output Figure 9
46. quency is 40MHz UE O40 MCU clock setting define FREQ XTAL 41 MHz Main Frequency 40M define SYS Figure 9 15 MCU Clock Setting 34 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL A D Converter Setting UI 0402 A D sample setting define ADC Digit12 define ADC 1 lt lt ADC Digit define ADC REF SoC define MOTOR ADC FORWARD TIME define AD OFFEST MAX VALUE 200 100 define CURRENT NORMAL OFFEST ADE c define CURRENT OFFEST CURRENT NORMAL OFFEST AD OFFEST MAX VALUE define CURRENT OFFEST MIN CURRENT NORMAL OFFEST AD OFFEST MAX VALUE Figure 9 16 A D Converter Setting Advanced Setting for FW These variables in this part can be modified if the performance of corresponding module is not so good or you want to change the setting for a different washing machine and you can find the file 505 user Customerlnterface c Motor Start up and Start stop Setting The parameter for the motor start up and the brake stop to end speed can be set in this part UI 0201 Motor start up variables setting int32 t Motor StartSpd 20 start up drum speed unit rpm float Startup 0 27 initial startup current unit A float Startup IncCur 0 2 initial startup current unit A 202 EMO EO TENES isa tss serei nog 7 16 t BrakeEn
47. r Mz INVERTER SENSOR WASHING MACHINE FIRMWARE 32 BIT MICROCONTROLLER FM3 Family USER MANUAL SPANSION Publication Number AN706 00095 1v0 E Revision 1 0 Issue Date Jan 26 2015 SPANSION USER MANUAL a Target products This user manual describes the following products Series Product Number FM3 Series MB9AF111K MB9AF312K MB9BF121J 2 Jan 26 2015 AN706 00095 1v0 E USER MANUAL SPANSION ww Table of Contents HBEOCIHICHOTI I LUE 5 1 1 Purpose 5 1 2 Definitions Acronyms and Abbreviations 5 1 8 Document 5 1 4 Reference 5 2 System Hardware 6 3 Development 7 4 System Firmware Design 44441 40 nennt einn tenter einn sinn nnne 8 4 1 FW HOT 8 4 2 a Eun 9 4 3 PileS D SCriptlon ec 12 44 FW Control 12 MES CCEPIT 14 5 1 Macro RR 14 5 2 Global Structure and Variable 14 5 2 1 Variables for
48. rrent lu AD sample U 2073 AD middle point for current Iv AD sample V 2040 AD middle point for current Iw AD sample Ww 0 2048 2 5V the offset error threshold is set by OFFEST MAX VALUE Startup stcCtrl The structure is used for the motor start up control The detailed information can be found in the comments for each variable Startup_stcCtrl struct Flag for motor startup complete 1 start finished Em cClosedLoop UN D Flag for motor closed loop running 1 speed closed loop few cRunStage eee Flag for the motor startup stage cRunLevel I Flag for the motor startup and running level Limit stcCalc The structure is used for the FOC current and voltage limitation to ensure the reliability of the inverter The detailed information can be found in the comments for each variable Limit stcCalc struct i3208 VedLmt 0 D axis voltage limit 3208 46192 Q axis voltage limit 13208 ldLmt 0 D axis current limit especially in field weaken 13208 lqLmt 0 Q axis current limit i32Q8 IsLmt 0 Saturate phase current FieldWeaken stcCtrl The structure is used for filed weaken control The detailed information can be found in the comments for each variable Field Weaken stcCtrl struct cExeFlag 7 0x00 Flag for the field weaken execution uBExeCnt 42
49. sform data to Host Jan 26 2015 AN706 00095 1v0 E 5 5 USER MANUAL AN 4 2 FW Structure There are 5 layers in the FW structure of IAR which are shown in Figure 4 1 x Debug v Files ez BR E CJ WM Platform Debug global 02 driver H03 module 04 app Ha 13H05 user L Customerlnterface h 501 global S02 driver S03 module S04 app 1 8 1805 user Customerlnterface c Main c E Vector Table c 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 Description 01 global lobal 7 MCU system fil ind 501 global 02 driver S02 driver MCU register setting function such as GPIO interrupt MFT AD mod l H03_module Algorithm folder for basic motor control such as FOC frame transform S03_module SVPWM math PID filter a Application folder for the files of application functions such as speed and app 50 5 position generator by hall sensor protection motor start up field app weaken brake weight OOB UART and etc USER H05 User Customer interface folder for the files for motor Configuration and HW S05 User setting Note if you want to quick start the motor you can refer to the setting for user layer at 9 2 1FW Interface Conf
50. sion Value a Sia SpdSt_stcSpdSet lt struct gt 0 20000 Ellas 35 44 file Main c Motor_2rVoltage struct 36 Angle stcGenerate struct 0x20000 ETTA 2 37 Add description here amp Motor 2rCurrentRef struct 0x20000 9 Li C3H03 E HH 44 amp Motor 2rCurrent struct 02000077 EL EET 39 History amp Motor stcRunParam struct 0x20000 Ce GI Hos vce 40 4 2013 10 14 V0 4 4 ilBWmCommandSpdRpm 0 iS EER REET 41 Author Einar He i16 WmTargetSpdRpm 0 0x20000 a ST rx 42 il 6 WmSpdRpmRt 0 0x20000 La 21502 di E M E i16WmSpdRpmLPF 0 0x20000 Laso E bh Er i16MotorSpdRpmRt 0 0x20000 MESES E o S T i18MotorSpdRpmLPF 0 20000 9 Eas cWorkMode 0x01 020000 Haasis user 47static char t cRelay pen EUN v 000 0220000 uciemenntcracee 48 void InitPower0n void s 1 49 void mai id cRunDir 0x00 0x20000 Main c void nain void ul 6FaultCode 0 0000 0x20000 Vector Table c e E Output 51 InitPover n ZA u lnitStage 0x00 20000 P 52 while TRUE ul6Vbus 303 0x20000 53 ul6 busLpt 303 9200104 54 FeedWDT HUDT u32Q22 RotorEleTheta 0 0 20000 55 FeedWDT SWDT ul amp BrakeTime 0 20000 56 if FALSE cRelay cStartupcomplete 0x00 020000 57 cCloseloop 0x00 0200004 L 58 if TRUE Sys j mS 58 2 WM Platform men gt Livewatch lcs Figure 5 1
51. t The d q current PI regulator Startup HallMotor The motor start up function for the hall sensor motor InvertParkTransform The function of the inverse Clarke frame transform InvertClackeTransform The function of the inverse Park frame transform SVPWM_Calc The SVPWM function Write_MFT_OCCP The function for the OCCP register setting according to the SVPWM calculate result Weight LoadMeasure The function for the weight OOB Detect The function for the OOB Protect HallLost The protection function for the hall lost detect Protect The protection function for the open phase detect 22 Jan 26 2015 AN706 00095 1v0 E USER MANUAL e Table 6 2 Event Function List by the Timer Event Prototype Description Remark SpdSt_SpeedSet The speed set function used for the motor speed acceleration or 1ms deceleration timer SpdSt_SpeedRegulate The speed regulation function for the middle speed generation FieldWeaken Control The main function for the field weaken Brake SpeedDown The function of the speed down by brake PID ParameterChange The function of the PID Parameter Change Speed The function of the speed PI regulator Limit Calculate The function of the FOC current and voltage limitation 5ms Protect LockRotor The function of the motor lock protection Protect Power The function of the motor run
52. t error of Id PI Q8 format Output of Id Q8 format Max output limit of Id Q8 format Min output limit of Id Q8 format FieldWeaken stcPiParam The structure is used for field weaken PI regulator The detailed information can be found in the comments for each variable Field Weaken stcPiParam struct Q8 kp 0 Q8 ki 12 Q8 kd 0 Q15 Pout 0 Q16_lout 0 Q16_Dout 0 Q8 Error 0 Q6_ErrorPre 0 Q8 Qut 0 Q8 Outmax 1433 Q8 12 Kp parameter for Field Weaken Q8 format Ki parameter for Field Weaken Q8 format Kd parameter for Field Weaken Q8 format Pout of Field Weaken Q16 format lout of Field Weaken PI Q16 format Dout of Field Weaken PI Q16 format Input error of Field Weaken Q8 format Previous input error of Field Weaken Q8 format Output of Field Weaken Q8 format Max output limit of Field Weaken PI Q8 format Min output limit of Field Weaken PI Q8 format Variables for Washing Machine Application The variables for the advanced application of the washing machine are introduced in this section Weight stcCtrl The structure is used for the weight control The detailed information can be found in the comments for each variable The weight result and the inner data can be observed in this structure Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL
53. uintl6 t ul6Baudrate Baud rate of UART unit bps char t cParityEn TRUE Parity check enable FALSE Disable char t cParitySel ER PARITY ODD NUMBER PARITY EVEN NUMBER PARITY uintl16 t ul6DataLen 2 data length default 8bit uint8 t u8StopBitLen 1 stop bit default TOE uint8 t u8Direction 5 cite et oTt USB FIRST low bit tirst MSB FIRST high bit first t8 t Uart u8CommErrTime 6 time delay for the comm error or resume unit s t8 t Uart u8CommDelay 0 time delay between Rx and Tx switch unit ms PORT and other macro setting in UART h Figure 9 20 UART Setting Speed Setting UI 0208 Speed set parameter setting DA int32 t Wm SpinSpd 70 switch drum speed between wash and spin state unit rpm float SpdSet BaseTime 0 1 the time unit of the speed change time from UART unit s range 0 1 uinti6 t SpdSet ul6AcceLmt 100 maximum acceleration of drum speed unit rpm s uintl6 t SpdSet ul6DeceLmt 20 maximum deceleration of drum speed unit rpm s Figure 9 21 Speed Setting 36 Jan 26 2015 AN706 00095 1v0 E SPANSION USER MANUAL AN OOB and Weight Setting The OOB detect speed and the weight speed can be set in this part UI 0209 parameter setting 7 uintl16 t ul6OobSpd 89 00 detect speed uintl16 t 160 90 the Second OOB detect speed uint8 t
54. unning the HW over current or DC over fault may appear and damage the HW if you do that 4 Watch the important variable to check the motor running performance such as whether the real motor is achieved the command speed and running speed is stable Detailed meaning about the important variable is shown in the previous section 5 2Global Structure and Variable Definition for your reference Jan 26 2015 AN706 00095 1v0 E 41 SPANSION 9 2 5 USER MANUAL Speed Acceleration and Deceleration After run motor normally you can run motor in any speed and the type speed of the drum for front loading washing machine can be taken for the reference at Table 9 5 Table 9 5 Typical Running Status by the Command Speed Motor stcRunParam Drum Description i16WmCommandSpdRpm Direction 30 50 CCW The Drum speed runs at 30 50rpm for the wash mode 30 50 CW The Drum speed runs at 30 50rpm for the wash mode The Drum speed runs at 89rpm for the OOB detection before 89 CCW 4 the spin mode 400 CCW The Drum speed runs at 400rpm for the pre spin The Drum speed runs at 100rpm to drain away water by the 100 CCW host after the pre spin 1000 CCW The Drum speed runs at 1000rpm for the spin mode 1200 CCW The Drum speed runs at 1200rpm for the spin mode 0 Stop motor The motor will stop working The default speed changing time is 10 which means 1s as shown in 9 2 1 2Advanc
55. utput motor real time speed The output WM average speed The output WM real time speed 1 trans ratio Motor s real time electrical speed 5 2 4 Variables for PID Control The structures used for PID control are introduced in this part Pid_stcCtrl The structure is used for PID control that enables or disables the corresponding PI regulator The detailed information can be found in the comments for each variable Pid stcCtrl CIdEN cSpdEN cFaWkEN cFaWkPIExe cSpdPlExe u8ldPlCyc ualqPiCyc ul6SpdPiCyc ul 6FdWkPICyc lt struct gt oo 0201 ee aub nisu 01 Je Ts 65 Tu iE soo TU Id PI Enable Iq PI Enable Speed PI Enable Field weaken Enable Field weaken execution flag Speed PI execution flag Execute cycle of Id PI Execute cycle of Iq PI Execute cycle of speed unit ms Execute cycle of field weaken unit ms Pid The structure is used for the speed PI regulator The detailed information can be found in the comments for each variable Pid stcSpdPl Q8 kp Q8 ki Q8 kd Q15 Pout Q16_lout Q16_Dout Q8 Error Q8 Q8 Out Q8 Outmax Q8 QOutmin struct 3030 25 1696 Kp parameter for speed Q8 format Ki parameter for speed Q8 format Kd parameter for speed Q8 format Pout of speed Q16 format l

Download Pdf Manuals

image

Related Search

Related Contents

Salicru SLC-3000-Twin Pro  Aspectos Clínicos  Operating Instructions Digital Cellular Phone EB-G60  STERLING 950C-32S Use and Care Manual  HP StorageWorks DAT Tape Drives  MANUAL DO UTILIZADOR  観光シティループバス製造請負 入札説明書等 (PDF:4868KB)  Bedienungsanleitung 2 mode d'emploi 8 instructies 13    RV-S340HI  

Copyright © All rights reserved.
Failed to retrieve file