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.
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.
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...
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...
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...
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 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...
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...
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...
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.
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...
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...
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...
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...
Need help?
Do you have a question about the FM3 S6E1A1 Series and is the answer not in the manual?
Questions and answers