Cypress FM3 S6E1A1 Series User Manual

Fan motor control

Advertisement

Quick Links

THIS SPEC IS OBSOLETE
Spec No: 002-04392
Spec Title: MB9AF132K, S6E1A1 FM3/0+ FAMILY FAN
MOTOR CONTROL USER MANUAL
Replaced by: NONE

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FM3 S6E1A1 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for Cypress FM3 S6E1A1 Series

  • Page 1 THIS SPEC IS OBSOLETE Spec No: 002-04392 Spec Title: MB9AF132K, S6E1A1 FM3/0+ FAMILY FAN MOTOR CONTROL USER MANUAL Replaced by: NONE...
  • Page 2 MB9AF132K S6E1A1 FM3/0+ Family Fan Motor Control User Manual Doc. No. 002-04392 Rev. *B Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone (USA): 800.858.1810 Phone (Intnl): +1 408.943.2600 www.cypress.com...
  • Page 3 Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress products.
  • Page 4: Table Of Contents

    Contents Introduction ..................................4 Purpose ................................. 4 Definitions, Acronyms, and Abbreviations ......................4 Document Overview .............................. 4 System Environment ..............................5 Hardware Environment ............................5 Software Environment ............................5 System Firmware Design .............................. 6 Firmware Architecture ............................6 IAR Project File Architecture ..........................6 Firmware Flow Chart .............................
  • Page 5: Introduction

    This manual describes document architecture, demo connection, and motor debug of the Cypress DC Indoor Fan Motor solution. It can help you to understand and use Cypress Cortex M3/M0+ series MCU better. It can also provide some references to customers for development of new products.
  • Page 6: System Environment

    2. System Environment 2.1 Hardware Environment Table 1. MCU Hardware Development Environment System Description S6E1A1 Hardware FAN_Motor_SOLU-V0.2.1 Emulator J-Link V8 Fan motor 2# (RS:80 Ω Ke:120; Ls:620) Motor type 2.2 Software Environment Table 2. MCU Software Development Environment Type Description PC System Windows 7 (64-bit) Software developing IDE...
  • Page 7: System Firmware Design

    3. System Firmware Design 3.1 Firmware Architecture Figure 1. Relationship of the Files in Each Layer User layer Application layer Module layer Driver layer Down Global layer Each layer is independent. If the performance and independence will not be affected, the files in the lower layer can call the files in the upper layer.
  • Page 8 System Firmware Design Folder names are shown in Figure 2. The project includes five header folders and five source folders. The file in each folder is shown in the following table. Table 3. Project File Architecture Folder Name Description H01-Global Global function declaration, global variables and macro definition folder H02-Driver MCU function declaration, variables and macro definition folder...
  • Page 9: Firmware Flow Chart

    System Firmware Design Firmware Flow Chart The flow chart of main functions is shown in Figure Figure 3. Main Loop Flow Chart WdgHwCallback Start Start Initial Gpio Set fault flag and stop motor Initial PWM Time Delay WdgSwCallback Start Initial ADC Set fault flag and stop motor Motor Parameters Set Initial WDT...
  • Page 10: Event Function

    4. Event Function Function List Table 4. Function List Table Prototype Description Remark Clark Transform Clarke transform Park Transform Park transform InverseClackeTransform Inverse clarke transform InverseParkTransform Inverse park transform Sensor_Parameter_Initial Current sensor parameters initialization Motor1_Sensor_Offeset_Detect Current sensor offset detect Motor1_Sense Current sensor function DT_Compensation Dead time compensation algorithm function...
  • Page 11 Event Function Prototype Description Remark Motor1_Protect Motor protect event function Motor1_Run Motor run and start up event function NoStop_Start No stop to restart function Current_PI Current loop PI controller function Speed_PI Speed loop PI controller function u32Q22_ArcTan Arctan function lookup algorithm i32Q12_Sin Sine function lookup algorithm i32Q12_Cos...
  • Page 12: Function Prototype

    Event Function Function Prototype 4.2.1 void ClarkeTransform() Prototype void ClarkeTransform(UVWAxiahCS *Input, AlphaBetaCS *Output); U-V-W stator coordinate variables, α-β stator coordinate variables Parameter Return Description Clarke transform Remark 4.2.2 void ParkTransform() Prototype void ParkTransform(AlphaBetaCS *Input, dqAxialCS *Output); α-β stator coordinate variables, d-q rotating coordinate variables Parameter Return Description...
  • Page 13 Event Function 4.2.6 void Motor1_Sensor_Offeset_Detect() Prototype void Motor1_Sensor_Offeset_Detect(void) Parameter void Return void Description Current sampling offset detect Remark 4.2.7 void Motor1_Sense() Prototype void Motor1_Sense(void) Parameter void Return void Description Current sampling event function Remark 4.2.8 void DT_Compensation() Prototype void DT_Compensation(void) Parameter void Return...
  • Page 14 Event Function 4.2.11 void FieldWeaken() Prototype void FieldWeaken(FieldWeakenS * FieldWeakenPar, signed long Q8_Vbus, AlphaBetaS *Motor_2sVoltage, signed long *Motor_idref, unsigned char MotorRunningStage) Parameter Field weaken parameters Return void Description Field weaken algorithm function Remark 4.2.12 int32_t LogicRightShift() Prototype int32_t LogicRightShift(int32_t Qmdata, uint32_t Shiftbits) Parameter Data input/Data output, data shift digits Return...
  • Page 15 Event Function 4.2.16 void Initial_Motor1_FieldWeakPar () Prototype static void Initial_Motor1_FieldWeakPar(uint32_t sample_freq) Parameter Carrier frequency Return Void Description Field weaken function initialization Remark 4.2.17 void Initial_Motor1_BEMF_EstimPar () Prototype static void Initial_Motor1_BEMF_EstimPar(uint32_t sample_freq) Parameter Carrier frequency Return Void Description Position Estimator function initialization Remark 4.2.18 void Initial_Motor1_RunPar () Prototype...
  • Page 16 Event Function 4.2.21 void Motor1_Stop() Prototype void Motor1_Stop(void) Parameter Void Return void Description Motor stop function Remark 4.2.22 Motor1_Speed_Regulate () Prototype void Motor1_Speed_Regulate (void) Parameter Void Return void Description Motor speed regulate function Remark 4.2.23 void Motor1_Limit_Calc () Prototype void Motor1_Limit_Calc (void) Parameter Void Return...
  • Page 17 Event Function 4.2.26 void PositionObserver () Prototype void PositionObserver(stc_observer_t *pstcEstParams, AlphaBetaS *pstc2sV, AlphaBetaCS *pstc2sC) Parameter Position estimator parameters Return Void Description Position Estimator event function Remark 4.2.27 void Motor1_HandleError () Prototype void Motor1_HandleError(stc_Protect_t *pstcProtectParams) Parameter Motor protection parameters Return Void Description Motor error status handler function Remark...
  • Page 18 Event Function 4.2.31 void Current_PI () Prototype void Current_PI(int32_t Ref, int32_t Input, int32_t *Output, stc_pid_t *PID_Par) Parameter Reference current, feedback current, PI output, PI parameters Return void Description current loop PI controller function Remark 4.2.32 void Speed_PI () Prototype void Speed_PI(int32_t Ref, int32_t Input, int32_t *Output, stc_pid_t *PID_Par) Parameter Target speed, feedback speed, target torque Return...
  • Page 19 Event Function 4.2.36 void Motor1_Res_Measure() void Motor1_Res_Measure(void) Prototype void Parameter void Return Motor resistance measure function Description Remark 4.2.37 void Single_Shunt() Prototype void Single_Shunt(void) Parameter void Return void Description Single shunt algorithm Remark 4.2.38 void Comm_Duration_Calc() Prototype void Comm_Duration_Calc(SVPWM_CalculateS *Motor_SVPWMPar) Parameter SVPWM parameters Return...
  • Page 20 Event Function 4.2.41 void SVPWM_Calc() Void SVPWM_Calc(SVPWM_CalculateS *SVPWMPar ,AlphaBetaS *_2sV, Prototype UVWAxiahS *_3sV, AlphaBetaS *_2sV_Real) Parameter SVPWM parameters Return void Description SVPWM algorithm event function Remark 4.2.42 void Write_Motor1_MFT_Register() void Write_Motor1_MFT_Register(SVPWM_CalculateS *SVPWM_Par) Prototype Effective Vector value Parameter void Return MFT register value assignment Description Remark 4.2.43 void InitNVIC ()
  • Page 21 Event Function 4.2.46 void InitSysTime () Prototype void InitSysTime (void) Parameter void Return void Description System timer initialization Remark 4.2.47 void InitWDT () void InitWDT (void) Prototype void Parameter void Return Watch dog mode initialization Description Remark 4.2.48 void Motor1_configPWM () Prototype void Motor1_configPWM(uint32_t parameter) Parameter...
  • Page 22 Event Function 4.2.51 void Motor1_SVPWM_Dis () void Motor1_SVPWM_Dis (void) Prototype void Parameter void Return Disable SVPWM mode Description Remark 4.2.52 void Speed_Feedback() void Speed_Feedback (stc_speedfeedback_t *pstcSpeedParams) Prototype Pulse count value Parameter void Return Disable SVPWM mode Description Remark 4.2.53 void Thermal_Protect() Prototype void Thermal_Protect (stc_thermalprotection_t *pstcThermalParams) Parameter...
  • Page 23 Event Function 4.2.56 void CAP_Charge () void CAP_Charge(stc_capparams_t *charge) Prototype CAP charge function parameters Parameter void Return Disable SVPWM mode Description Remark 4.2.57 void Main () void Main(void) Prototype void Parameter void Return Main loop function Description Remark FM3/0+ Family Fan Motor Control User Manual, Doc. No. 002-04392 Rev. *B...
  • Page 24: User Interface

    5. User Interface Customer Interface Variable List Motor1: (Fan) Motor Parameters Parameter Description Motor1_Pole_Pairs Motor pole pairs Motor1_Ld PMSM d axis phase inductance Motor1_Lq PMSM q axis phase inductance Motor1_Rs PMSM line resistor Motor1_Ke PMSM Back Electromotive Force coefficient Motor1_Kt PMSM torque const Motor1_Kj PMSM moment of inertia...
  • Page 25 User Interface Parameter Description Motor1_Inverse_Rotor_Brake_TimeS Brake time of motor reversion Motor1_Pre_CloseLoop_TimeS Time before closed loop Motor1_Pre_CloseLoop_Current_MinA Minimum current before closed loop Motor1_Pre_CloseLoop_Current_MaxA Maximum current before closed loop Motor1_Inc_SpeedAcc_TimeS Acceleration interval Motor1_Inc_Speed_MAX_Hz Maximum speed acceleration Motor1_PWM_Brake_Inc_TimeS PWM brake mode brake duty ratio pulse increase time Motor1_Stop_Brake_CurrentA Motor braking stops when the motor braking current is low Motor1 Protection Parameters...
  • Page 26: Variable Definition

    User Interface Variable Definition 5.2.1 Motor1_Pole_Pairs Data type: unsigned char Description: PMSM pole pairs Unit: none Measure method: Turn motor rotor manually, test motor three-phase terminal line voltage waveform, record turning revolution N and sine wave period number M, so Motor1_pole_pairs = M/N 5.2.2 Motor1_Ld...
  • Page 27 User Interface When motor braking, the phase current waveform detail is shown in Figure 5. Figure 5. Motor Current Waveform Detail Considering Ke, Rs and Motor1_pole_pairs is known, record the following data when motor is braking: The frequency of current waveform: F The current falling time: T The current amplitude changes in falling time: A The peak-peak current: A0...
  • Page 28 User Interface 5.2.7 Motor1_Kj Data type: float Description: PMSM moment of inertia Unit: Kg·m2 5.2.8 Motor1_dki Data type: float Description: D axis current loop integral parameter Unit: none Range: about 0.3 5.2.9 Motor1_dkp Data type: float Description: D axis current loop proportion parameter Unit: none Range: about 0.3 5.2.10 Motor1_qki...
  • Page 29 User Interface 5.2.14 Motor1_Speed_Inc_Acceleration_Hz Data type: float Description: Acceleration of speed loop Unit: Hz 5.2.15 Motor1_Speed_Dec_Acceleration_Hz Data type: float Description: Deceleration of speed loop Unit: Hz 5.2.16 Motor1_OpenLoop_Inc_Current_APS Data type: float Description: Current vary step in open loop Unit: A 5.2.17 Motor1_OpenLoop_CurrentA Data type: float Description: Current value in open loop...
  • Page 30 User Interface 5.2.22 Motor1_Detect_Direction_TimeS Data type: float Description: Detection time of rotational direction. If set the value to zero, system will close brake function by default. Unit: s 5.2.23 Motor1_Inverse_Rotor_Brake_TimeS Data type: float Description: PMSM rotor break duration, which is based on the motor current and the speed in the breaking moment.
  • Page 31 User Interface 5.2.30 Motor1_Stop_Brake_CurrentA Data type: float Description: Motor braking stops when the motor braking current is smaller than “Motor1_Stop_Brake_CurrentA”. Unit: S 5.2.31 Motor1_Over_CurrentA Data type: float Description: Software over current point Unit: A 5.2.32 Motor1_max_dcvoltageV Data type: unsigned short Description: DC bus over voltage point Unit: V 5.2.33 Motor1_min_dcvoltageV...
  • Page 32 User Interface 5.2.39 Motor1_PWM_Carry_Frequency Data type: unsigned short Description: PWM carrier frequency Unit: Hz 5.2.40 Motor1_Current_Carry_Frequency Data type: unsigned short Description: Motor control algorithm frequency Unit: Hz 5.2.41 Motor1_speed_Max_RPM Data type: unsigned short Description: Maximum speed Unit: RPM 5.2.42 Motor1_speed_Min_RPM Data type: unsigned short Description: Minimum speed Unit: RPM...
  • Page 33 User Interface 5.2.47 AD_OFFSET_NUM Data type: macro definition Description: Stationary phase current will be sampled 2 AD_OFFSET_NUM times, before the AD middle voltage is calculated. Unit: None 5.2.48 AD_OFFEST_MAX_VALUE Data type: macro definition Description: AD middle voltage maximum offset Unit: None 5.2.49 Motor1_Control_mode Data type: macro definition Description: Motor1 control mode switch...
  • Page 34 User Interface 5.2.55 PULSE_FEEDBACK_ENABLE Data type: macro definition Description: motor speed count uses pulse counting model or not, if the parameter is enabled, there are 12 PWM cycle feedbacks from pin ‘P61’ in one motor mechanical cycle. Unit: none Range: 0 – disable; 1 – enable. 5.2.56 MOTOR1_IDENTIFICATION_ENABLE Data type: macro definition Description: motor parameters identification function enable flag.
  • Page 35 User Interface 5.2.62 MOTOR1_SPEED_PIN Data type: macro definition Description: AD channel to sample sliding rheostat to control motor speed Unit: MCU pin Range: ANXX 5.2.63 ADC_Digit Data type: macro definition Description: AD converter resolution Unit: bit Range: 1-bit, 12-bit 5.2.64 ADC_REF Data type: macro definition Description: ADC reference voltage Unit: V...
  • Page 36 User Interface 5.2.66 Motor1_Current_Rs Data type: macro definition Description: Current sampling resistance of Motor1 Unit: Ω Note: the shunt connect to IPM in circuit as shown in Figure 7; if use built-in shunt, please refer to IPM datasheet to get the shunt resistance. Figure 7.
  • Page 37 User Interface 5.2.70 MOTOR1_BEMF_LPFK_MIN Data type: macro definition Description: the minimum of motor1 estimate filters K value Unit: None Range: according to motor characteristic, hardware and sensor circuit performance 5.2.71 MOTOR1_BEMF_LPFK_MAX Data type: macro definition Description: the maximum of motor1 estimate filters K value Unit: None Range: according to motor characteristic, hardware and sensor circuit performance 5.2.72 MOTOR1_BEMF_LPFK_MIN_HZ...
  • Page 38: Interrupt Function

    6. Interrupt Function Function List Table 5. Interrupt Function Table Function Prototype Description Remark WdgHwCallback Hard watch dog interrupt WdgSwCallback Soft watch dog interrupt ISR_MFT0_FRT FRT interrupt DtifIntCallback DTTI interrupt ISR_ADC_unit0 ADC0 interrupt RtUnderflowIntHandler Base timer interrupt Interrupt Priority Configuration 6.2.1 Interrupt Priority Map Figure 9.
  • Page 39 Interrupt Function 6.2.2 Interrupt Priority List Table 6. Interrupt Priority Table Priority Interrupt Vector DtifIntCallback WdgHwCallback Or WdgSwCallback ISR_ADC_unit0 ISR_MFT0_FRT RtUnderflowIntHandler 6.2.3 Interrupt Priority Configuration Location Figure 10. Interrupt Priority Configuration Diagrammatic Sketch (FM0+) FM3/0+ Family Fan Motor Control User Manual, Doc. No. 002-04392 Rev. *B...
  • Page 40: System Debug Sample

    7. System Debug Sample System Build 7.1.1 Demo Board Connect When you get a Fan Motor board as shown in Figure 11, connect as follows: ① Power supply interface ② Emulator debug interface ③ Motor three phase line interface ④ GUI debug interface Figure 11.
  • Page 41 System Debug Sample 7.1.2 Open Project Firstly, run IAR Embedded Workbench, click “File > Open > Workspace”, choose the project name “ArmInverterPlatform.eww”; the opened project interface is shown in Figure Figure 12. IAR Project Interface 7.1.3 Configure Hardware and Software Configure Motor Interface Location When you change the motor or hardware, modify the related file as shown in Figure...
  • Page 42 System Debug Sample Configure hardware parameters as shown in Figure 14 Figure 14. Hardware Parameters Configuration Configure MCU Register, Interrupt, and motor parameters location as shown in Figure 15 Figure 15. Configure MCU Register, Interrupt, and Motor Parameters File Structure Configure MCU Frequency, Interrupt, Watchdog, AD and MFT and so on.
  • Page 43 System Debug Sample 7.1.4 Configure User Interface 7.1.4.1 Configure Motor Type Define the motor type in file “Customer_Interface.c”, For example: define the motor name to “Fan_Motor_Type_2”, as shown in Figure Figure 16. Define Motor Name Copy and paste a data set as shown in Figure 17.
  • Page 44 System Debug Sample 7.1.4.2 Configure PI Parameters You do not need to modify the default PI parameters, when the motor is running; system can modify the PI parameters of speed loop and current loop automatically according to motor running state. The PI parameters of speed loop are based on motor inertia, and the PI parameters of current loop are based on the resistance and inductance.
  • Page 45 System Debug Sample 7.1.4.4 Configuration Protection Parameters Configuration principles: according to the characteristics of motor, the threshold of current and voltage cannot cause damage to motor. Figure 20. Motor Protection Parameters 7.1.4.5 Configure Running Parameters Set the field weaken current: If the voltage of power supply and back electromotive force can run the motor at maximum speed, set the field weaken current to zero Otherwise, set the field weaken current according to your requirements.
  • Page 46: Motor Start Up

    System Debug Sample Motor Start up 7.2.1 Code Rebuild In IAR environment, select the project name “ArmInverterPlantform”, and right-click. Then select “Rebuild All”, or click “Project > Rebuild All”, as shown in Figure 22 Figure Figure 22. Code Rebuild (1) Figure 23.
  • Page 47 System Debug Sample 7.2.3 Program and Motor Running or press “F5” to run the program; in this status, program can respond to your As shown in Figure 25 click command and return the status and data. Figure 25. Run Button Right-click “View >...
  • Page 48 System Debug Sample 7.2.4 Debug Motor Running Status 7.2.4.1 Debug Start up Set different parameters according to start up modes, for example: Prepare Close Loop Start up Mode (default mode) Set the parameters as shown in Figure Figure 27. Parameters Watch Figure 28.
  • Page 49 System Debug Sample Start up with orient and open loop mode 31. (Modify the “Motor1_OpenLoop_Inc_Current_APS” value on Set the parameters as shown in Figure the basis of Figure 29). Figure 31. Start up with Orient and Open Figure 32. Start up with Orient and Open Loop Loop Mode Parameters Current Waveform (100mA/1s/scale) 7.2.4.2 Debug PI Parameters...
  • Page 50 System Debug Sample Current Loop Set a group over large D and Q Axis PI parameters, as shown in Figure 37, the motor current waveform is shown in Figure 38, the current ripple and electromagnetic noise is very heavy. Figure 38. Motor Current when D and Q Axis PI Figure 37.
  • Page 51 System Debug Sample 7.2.5 VSP Modify Motor Speed To achieve the VSP modify motor speed, you need to follow below steps: Step 1: Define the parameters “SPEED_FROM_OUT” and “VSP_MOTOR_START_V” in ‘Hardware_Congig.h’ file, as shown: #define SPEED_FROM_OUT #define VSP_MOTOR_START_V Step 2: “Rebuild All” the project and “Download and Debug”, close the IAR workbench. Step 3: Twist the resistance knob clockwise or anti-clockwise slowly, as shown in Figure 43 to record the...
  • Page 52: System Error Code Definition

    8. System Error Code Definition Table 7. Error Code Table Error Code Error Type Remark 0x00 Motor initial state or status normal none 0x01 Over DC voltage none 0x02 Under DC voltage none 0x04 Soft over current none 0x08 Hardware over current none 0x10 Motor Loss phase...
  • Page 53: Additional Information

    9. Additional Information For more information on Cypress Inverter Fan Motor, visit our website: http://www.cypress.com/applications/home-appliances/inverter-fan-motor For more information on Software and Sample program, visit our website: http://www.cypress.com/products/fm3-mb9bx10t-series-arm-cortex-m3-microcontroller-mcu-family Please contact your local support team for any technical question: http://www.cypress.com/cypress-solutionsnetwork FM3/0+ Family Fan Motor Control User Manual, Doc. No. 002-04392 Rev. *B...
  • Page 54: Revision History

    Document Number: 002-04392 Revision Issue Date Origin of Description of Change Change 08/03/2015 ZHFA Initial release Migrated Spansion User Manual “AN710-00004-1v4-E” to Cypress format. 07/04/2016 ZHFA 10/02/2018 SSAS Obsoleted FM3/0+ Family Fan Motor Control User Manual, Doc. No. 002-04392 Rev. *B...

This manual is also suitable for:

Fm0+ s6e1a1 seriesMb9af132k

Table of Contents