background image

 
 

U S E R   M A N U A L  

 

Jan 26, 2015, AN709-00011-1v0-E 

 

11 

 
 
 
 
 
 
 

pid_regulation.c 

The PID module for current and speed PI 

svpwm.c 

The SVPWM module   

s04_app 

adc_sample.c 

The ADC process module based on the ADC ISR 

brake.c 

The brake module including motor stop by brake 

limitation.c 

The FOC current and voltage limitation module 

Dead-time compensation.c 

Dead-time compensation module() 

motor_ctrl.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_encoder.c 

The 

motor 

start-up 

module 

with 

encoder 

after 

zero-checking 

observer_encoder.c 

The Position Calculate module by encoder 

protect.c 

The Protect module 

speed_calculate.c 

The Speed Calculate module 

qprc_zero_seach 

Search encoder zero signal module 

s05_user 

customer_interface.c 

The motor parameter setting 

main.c 

Main function 

isr.c 

MCU interrupt vector list 

init_mcu.c 

Initialize MCU peripheral functions 

Startup_mb9xfxxx.s 

MCU startup file 

4.4 

FW Control Flow 

The control flow for the motor is shown as Figure 4-4. There are 4 interrupts that are red highlighted for the 

motor FOC control, hall capture, AD converter. The timer events are executed in the end-less loop and the 

timers are generated in the zero detect

ion interrupt ‘ISR_MFT_FRT’ of the free run timer 0.   

 

Figure 4-4: Diagram of the Control Flow 

Feed watchdog 

Start 

Current U\V\W sample 

FOC control 

Speed &Position Generate 

Protection

(High Priority) 

PID 

SVPWM 

Other Algorithm 

DC bus sample and calculate 

Current restoration 

ISR_ADC_unit0 

ISR_MFT_FRT 

End-less loop in Main.c 

Initialize peripheral 

Motor Start/Stop 

Summary of Contents for SPANSION FM4 MB9BF568 Series

Page 1: ...es and Design Support We look forward to partnering with you to provide solutions that will help make your systems successful Cypress maintains a worldwide network of offices solution centers manufact...

Page 2: ...PMSM Servo Motor Speed Control User Manual 32 bit ARM Cortex M4F based Microcontroller MB9BF568x Series and S6E2HG Series User Manual Jan 26 2015 AN709 00011 1v0 E 1...

Page 3: ...Run Motor 22 6 2 4 Speed Acceleration and Deceleration 24 6 3 Troubleshooting 24 6 3 1 Protection 24 7 Additional Information 25 8 Reference Documents 26 Figures Figure 4 1 Structure of FW 8 Figure 4...

Page 4: ...ble 5 1 System Used Interrupt Function 12 Table 6 1 Encoder Connection 16 Table 6 2 Sample Resistor Amplification Carrier Frequency and Dead Time 19 Table 6 3 Current PID and Speed PID 19 Table 6 4 Mo...

Page 5: ...FOC drive modules When you have understood the provided information you can get an overview of a whole servo motor project And you can run a motor following the demo project step 1 2 Definitions Acro...

Page 6: ...Environment The below shows the brief information of MCU used in servo motor inverter board CPU chip Spansion MB9BF568R CPU Frequency 160MHz MCU pin number 120pin RAM Space 128Kbytes Code Space 1024K...

Page 7: ...ment Name Description Part Number Manufacturer Remark IAR bedded Workbench 7 3 FW code edit compile and debug N A N A N A J Link Debug and Load FW by JTAG N A N A N A SPANSION FLASH LOADER Flash downl...

Page 8: ...pid speed acceleration Motor can be accelerated from 0rpm to 5000rpm within 200ms 5 Rapid speed deceleration Motor can be decelerated from 5000rpm to 0rpm within 200ms 6 FOC Control Using FOC control...

Page 9: ...ic motor control such as FOC frame transform SVPWM math PID filter app h04_app s04_app Application folder for the files of application functions such as speed and position generator by hall sensor pro...

Page 10: ...U S E R M A N U A L Jan 26 2015 AN709 00011 1v0 E 9 Figure 4 2 Sub files in Each Layer...

Page 11: ...rily s03_module coordinate_transfrom c FOC axis convert filter c One order low pass filter math c The math module including the function such as SQRT COS SIN User Layer App Layer Module Layer Drive La...

Page 12: ...The Speed Calculate module qprc_zero_seach Search encoder zero signal module s05_user customer_interface c The motor parameter setting main c Main function isr c MCU interrupt vector list init_mcu c I...

Page 13: ...R for the motor control s05_user isr c __root void Mft0_Wfg_IsrHandler void The HW over current ISR s05_user isr c __root void Adc_0_IsrHandler void The ADC unit0 ISR trigger at the zero point for the...

Page 14: ...re 5 2 Free Run Timer Interrupt 5 3 2 Encoder Capture The PWC timer is used to capture the encoder A B signal and calculate pulse width of the edge of A B Figure 5 3 Encoder Capture with Base Timer H...

Page 15: ...otection 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 Figu...

Page 16: ...imary steps are shown as following Hardware Connection FW Interface Configuration Encoder Check Run Motor Speed Acceleration and Deceleration 6 1 Demo System Introduction The servo motor solution can...

Page 17: ...rt Encoder A AIN Encoder B BIN Encoder Z ZIN 5V Vcc GND GND Note Connection order between A and B is mixable VCC and GND must be connected rightly otherwise the encoder won t work right and the motor...

Page 18: ...laptop computer 4 Connect AC power to inverter board shown as below Figure 6 5 AC Plug 6 2 Motor Debug After the hardware connection with the motor is completed you can debug the new motor as describe...

Page 19: ...f the variables reserved for the user interfaces are located in the file s05_user customer_interface c and the macro definitions are located in the file h05_user customer_interface h Figure 6 7 Interf...

Page 20: ...icroSec Dead time 2 5us Motor_u16CarrierFreq Carrier frequency for PWM 15000Hz Sample resistor and amplification is related to hardware board they must be written correctly Dead time is depended on IP...

Page 21: ...Motor_u16OpenLoopLoopIqRef Set current in open loop stage Q8 2 0 2A Current setting in orientation and open loop stage is related to motor electrical parameter Ensure that not exceeding motor rated c...

Page 22: ...en target speed is set to 0 to stop motor running 1 enable fast braking when target speed is set to 0 to stop motor running 6 2 2 Encoder Check When the basic setting has been finished the encoder inf...

Page 23: ...onfig h Set it the same value as Qprc_RunPars i32Q22_AngleToZeroInx Redefine ZEROMATHCEN to 1 Encoder check is complete 6 2 3 Run Motor When the encoder angle has been checked the motor can be started...

Page 24: ...U S E R M A N U A L Jan 26 2015 AN709 00011 1v0 E 23 Figure 6 9 Download and debug by J link Figure 6 10 Motor Run by J link Figure 6 11 Motor in Running Status A B D C...

Page 25: ...tion are shown as below You can match the value with these fault codes to find what protection is performed define NORMAL_RUNNING 0x00 no error define OVER_VOLTAGE 0x01 DC bus over voltage define UNDE...

Page 26: ...p www spansion com Products microcontrollers Chinese version address http www spansion com CN Products microcontrollers Please contact your local support team for any technical question America Spansi...

Page 27: ...U S E R M A N U A L 26 Jan 26 2015 AN709 00011 1v0 E 8 Reference Documents...

Page 28: ...L Jan 26 2015 AN709 00011 1v0 E 27 AN709 00011 1v0 E Spansion Application Note FM4 Family 32 BIT MICROCONTROLLER PMSM Servo Motor Speed Control User Manual Jan 2015 Rev 1 0 Published Spansion Inc Edit...

Page 29: ...tection 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 expo...

Reviews: