background image

 

Copyrights 

FM3 Family Math and Motor Control Library Quick Start Guide, Doc. No. 002-04766 Rev. *A 

© Cypress Semiconductor Corporation, 2014-2016. This document is the property of Cypress Semiconductor Corporation 
and its subsidiaries, including Spansion LLC (“Cypress”).  This document, including any software or firmware included or 
referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and treaties of the 
United States and other countries worldwide.  Cypress reserves all rights under such laws and treaties and does not, 
except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other 
intellectual property rights.  If the Software is not accompanied by a license agreement and you do not otherwise have a 
written agreement with Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-
exclusive, nontransferable license (without the right to sublicense) (1) under its copyright rights in the Software (a) for 
Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware 
products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end 
users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, 
and (2) under those claims of Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) 
to make, use, distribute, and import the Software solely for use with Cypress hardware products.  Any other use, 
reproduction, modification, translation, or compilation of the Software is prohibited. 

TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS 
OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this 
document without further notice. Cypress does not assume any liability arising out of the application or use of any product 
or circuit described in this document.  Any information provided in this document, including any sample design information 
or programming code, is provided only for reference purposes.  It is the responsibility of the user of this document to 
properly design, program, and test the functionality and safety of any application made of this information and any 
resulting product.  Cypress products are not designed, intended, or authorized for use as critical components in systems 
designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or 
systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or 
hazardous substances management, or other uses where the failure of the device or system could cause personal injury, 
death, or property damage (“Unintended Uses”).  A critical component is any component of a device or system whose 
failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety or 
effectiveness.  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.  You shall indemnify and 
hold Cypress harmless from and against all claims, costs, damages, and other liabilities, including claims for personal 
injury or death, arising from or related to any Unintended Uses of Cypress products. 

Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, 
F-RAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries.  For a 
more complete list of Cypress trademarks, visit cypress.com.  Other names and brands may be claimed as property of 
their respective owners. 

 

 

 

 

Summary of Contents for FM3 Series

Page 1: ... Microcontroller Math and Motor Control Library Quick Start Guide Doc No 002 04766 Rev A 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 2: ...MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE To the extent permitted by applicable law Cypress reserves the right to make changes to this document without further notice Cypress does not assume any liability arising out of the application or use of any product or circuit described in this document Any information provided in this document including any sample design information or programm...

Page 3: ...ev A 3 Contents 1 Demo System 4 1 1 Demo System Introduction 4 1 2 Hardware Connect 4 1 3 Run the Motor 7 2 Additional Information 9 Appendix 10 A 1 Common Used Structure 10 A 2 Firmware Parameter Setting 10 A 3 Motor Parameter 16 Revision History 17 Document Revision History 17 ...

Page 4: ...You can use this sample project to control the low voltage PMSM or BLDC This chapter introduces one example of inverter motor control project and help you run a motor quickly 1 1 Demo System Introduction The connection diagram for the MMCL sample project which is used to control the low voltage inverter motor is shown in Figure 1 1 The sample project can be adaptive to the any type of low voltage ...

Page 5: ...all A and B line can be only connected to the inverter s Hall A and Hall B port Don t connect on the Hall C port on the board VCC and GND must be connected rightly otherwise the hall won t work right and the motor will also not run 2 Plug the U V W phase lines to inverter board shown as below Figure 1 3 Motor Line Connection 3 Connect JTAG to adapter shown as below Motor Phase Line Hall port ...

Page 6: ...no isolator between the J link and the HW it is recommended to unplug the AC power and use the battery of your note book 4 Connect DC power 24V to Inverter board shown as below The DC voltage can be from 24 48V according to the rated voltage of the motor and the current of the board must be lower than 2A Figure 1 5 AC Plug J Link SWD DC Power ...

Page 7: ... Click the button A that is shown in Figure 1 6 to connect the J link and download the FW into the MCU Cick the button B to execute the sample project You can enter the none zero speed value to start the motor in the structure that is shown as C after the firmware is executed about 2s later For example when the variable Motor_stcRunPar i32TargetSpeedRpm 1000 by your online input the drum speed of ...

Page 8: ... for the reference at Table 1 2 Table 1 2 Typical Running Status by the Command Speed Motor_stcRunPar i32TargetSpeedRpm Drum Direction Description 300 500 CCW The motor runs at 300 500rpm 300 500 CW The motor runs at 300 500rpm 1000 CCW The motor runs at 1000rpm 2000 CCW The motor runs at 2000rpm 4000 CCW The motor runs at 1000rpm 0 Stop motor The motor will stop running If you want to change the ...

Page 9: ...ore information on MMCL visit our website http www cypress com applications home appliances math and motor control library For more Information on Cypress semiconductor products visit the following website http www cypress com cypress microcontrollers Please contact your local support team for any technical question ...

Page 10: ...for the hall sensor capture Posi_stcCalHall The structure for the rotor position calculation for the hall sensor capture Motor voltage and current Motor_stcIuvwSensed 3 phase stationary axis current Motor_stcIabSensed Alpha beta axis current Motor_stcIdqSensed D Q axis current Motor_stcIdqRef D Q axis reference current Motor_stcVdqRef D Q axis voltage Motor_stcVabRef Alpha beta axis voltage PID Mo...

Page 11: ...function with hall sensor AdcSample The ADC process module based on the ADC ISR InitMcu c MCU system init include interrupt priority list ISR c The ISR file for all of the interrupt routine of the MCU MotorCtrl c The main file of the motor control including the main function of FOC process of motor and the start stop function of motor Motor_Startup c The motor start up module with hall sensor or s...

Page 12: ...2_t Motor_f32SpdAccelerationHz 10 1 0f acceleration speed UI_0102 ADC port and coefficient set float32_t Motor_f32IuvwSampleResistor 0 02 Iuvw sample resistor ohm float32_t Motor_i32IuvwAmplifierFactor 5 0 Iuvw calculation factor int32_t Motor_i32IuvwOffsetNormal 2048 the middle value of 12 bits ADC int32_t Motor_i32IuvwOffsetRange 100 ADC offset range of Iuvw sampling int32_t Motor_i32IuvwOffsetC...

Page 13: ... current at closeloop UI_0105 Filter float32_t Motor_f32BemfLpfkMinSpd 6 Hz float32_t Motor_f32BemfLpfkMaxSpd 120 Hz int32_t Motor_i32Q12_BemfLpfkMin Q12 0 05 int32_t Motor_i32Q12_BemfLpfkMax Q12 0 8 UI_0104 PID Parameter float32_t Motor_f32LowSpdKi 0 0002f 0 0003f speed PI regulator integral constant float32_t Motor_f32LowSpdKp 0 043f 0 15f speed PI regulator proportion constant float32_t Motor_f...

Page 14: ..._i16Q8CurrentMax Q8 Motor_f32IsMax motor phase current peak A uint16_t Motor_u16OverCurrentTimeSec 1 motor over current timer PWM uint16_t Motor_u16VbusMax 27 the maximum value of DC voltage uint16_t Motor_u16VbusMin 21 the minimum value of DC voltage uint8_t Motor_ErrorTime 10 s UI_0107 running control of open loop float32_t Motor_f32BemfLpfkMinSpd 6 Hz uint8_t Motor_u8RunLevel 4 1 orientation 2 ...

Page 15: ... 0 timer 0_0 define HALL_B_PORT PORT4 Port 4 define HALL_B_PIN PIN10 P4A define HALL_B_TIMER BT_CH_1 timer 1 define HALL_B_TIMER_CH 0 timer 1_0 define HALL_C_PORT PORT6 Port 6 define HALL_C_PIN PIN1 P61 UI_0201 ADC port and coefficient set define CLK_XTAL_FREQ 4 MHz define CLK_SYS_FREQ 9 System clock frequency CLK_XTAL_FREQ CLK_SYS_FREQ 1 define APB0_CLK_DIV APBx_CLK_DIV0 define APB1_CLK_DIV APBx_...

Page 16: ...re shown in the following table Pole pairs 2 D axis Inductance 0 65mH Q axis Inductance 0 85mH Resistance line to line 0 94 ohm Inductive voltage constant line to line 2 86 V krpm Saturation current 2A Speed range 360rpm 4000rpm Hall Number 3 Hal line definition Red Vcc Black GND Yellow Hall A Green Hall B Blue Hall C Motor phase definition Yellow U Green V Blue W ...

Page 17: ...ry Document Revision History Document Title FM3 Family 32 bit Microcontroller Math and Motor Control Library Quick Start Guide Document Number 002 04766 Revisio n ECN Issue Date Origin of Change Description of Change 09 19 2014 BOZH Initial release A 5275832 08 29 2016 BOZH Migrated to Cypress format ...

Reviews: