Spansion FMO+ Series User Manual

Low voltage 3-phase bldc/pmsm control 32-bit microcontroller
Table of Contents

Advertisement

Quick Links

Low Voltage 3-Phase BLDC/PMSM Control
32-BIT MICROCONTROLLER
FM0+ Family
USER MANUAL
Publication Number: S6E1A1_AN710-00002 Revision 1.0
Issue Date Apr 2, 2015

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FMO+ Series and is the answer not in the manual?

Questions and answers

Summary of Contents for Spansion FMO+ Series

  • Page 1 Low Voltage 3-Phase BLDC/PMSM Control 32-BIT MICROCONTROLLER FM0+ Family USER MANUAL Publication Number: S6E1A1_AN710-00002 Revision 1.0 Issue Date Apr 2, 2015...
  • Page 2 U S E R M A N U A L Target products This user manual describes the following products: Series Product Number FM0+ Series S6E1A1 Apr 2, 2015, S6E1A1_AN710-00002...
  • Page 3: Table Of Contents

    U S E R M A N U A L Table of Contents Introduction ............................. 5 Purpose 5 Definitions, Acronyms and Abbreviations ................5 Document Overview ......................5 Reference Documents ......................5 System Hardware Environment ...................... 6 Development Environment ......................7 System Firmware Design .......................
  • Page 4 U S E R M A N U A L Figure 8-1: Interrupt Priority Diagram ....................... 18 Figure 8-2: Free Run Timer Interrupt ......................19 Figure 8-3: Base Timer Interrupt....................... 19 Figure 8-4: DTTI Interrupt ......................... 20 Figure 9-1: System Connection ........................ 21 Figure 9-2: Open the Workspace ......................
  • Page 5: Introduction

    M A N U A L 1. Introduction Purpose This user manual describes SPANSION low voltage 3-phase BLDC/PMSM solution, and describes how to use the FW library. The document introduces the basic information of the solution including hardware, firmware, initial functions, basic motor setting functions and FOC drive modules.
  • Page 6: System Hardware Environment

    U S E R M A N U A L 2. System Hardware Environment The following lists the MCUs used in LVBP inverter board CPU chip: Spansion FM0+ S6E1A1 series CPU Frequency: 40MHz MCU pin number: 48pin RAM Space: 88 Kbyte...
  • Page 7: Development Environment

    Description Part Number Manufacturer Remark IAR bedded Workbench FW code edit , compile and debug J-Link Debug and Load FW by JTAG SPANSION FLASH Flash download program LOADER Source Insight V3.50 Source code edit Editor Eclipse Source code edit Editor...
  • Page 8: System Firmware Design

    U S E R M A N U A L 4. System Firmware Design This chapter introduces the FW structure of low voltage 3 phase motor project. FW Feature The features of the low voltage 3 phase motor solution are shown in Table 4-1. Table 4-1: Feature of LVBP Solution Feature Description...
  • Page 9: Figure 4-1: Structure Of Fw

    U S E R M A N U A L 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 H01_global, global...
  • Page 10: Files Description

    U S E R M A N U A L Figure 4-2: Sub-files in Each Layer Files Description The detailed descriptions for each file are shown in Table 4-3. Table 4-3: Description of Project Files Folder File Description coordinate_transform.c FOC axis convert filter.c One order low pass filter s03_module...
  • Page 11: Fw Control Flow

    U S E R M A N U A L FW Control Flow The control flow for the motor is shown as Figure 4-3. 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 ‘Mft_Frt_IsrHandler ‘of the free run timer 0.
  • Page 12: System Function

    U S E R M A N U A L 5. System Function This chapter describes the global structure, variables, and system functions. 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’...
  • Page 13: Variables For Foc

    U S E R M A N U A L typedef struct int32_t i32CommandSpdRpm; //user set speed int32_t i32TargetSpdRpm; //speed pi reference speed int32_t i32CommandSpdRpmMax; //speed max defined in customerinterface.c int32_t i32CommandSpdRpmMin; //speed min defined in customerinterface.c int32_t i32MotorSpdRpmRt; //motor's real time speed int32_t i32MotorSpdRpmRtf;...
  • Page 14: Variables For Pid Control

    U S E R M A N U A L D&Q axis Current and Voltage MotorCtrl_stcIdqRef Reference current value on the 2 axis rotation frames Reference current on D-axis ‘Idref’ ->i32Q8_Xd; Reference current on Q-axis ‘Iqref’ ->i32Q8_Xq; ->i32Q12_Cos Cosine value of the rotor position used for the frame transform ->i32Q12_Sin Sine value of the rotor position used for the frame transform MotorCtrl_stcIdqSensed...
  • Page 15: Function List

    U S E R M A N U A L MotorCtrl_stcIdqRef Reference current value on the 2 axis rotation frames ->cIdEN Id PI Enable ->cIqEN Iq PI Enable ->cSpdEN speed PI Enable ->cFdWkEN; field weaken PI Enable -> u16SpdPICyc execute cycle of speed PI ->...
  • Page 16: Event Function

    U S E R M A N U A L 6. Event Function The primary functions for the motor inverter control are introduced in this chapter Function List The functions for the motor control that are called in the MFT ISR ‘Mft_Frt_IsrHandler ()’ and timer .c ‘Timer_Event()’...
  • Page 17: Driver Function

    U S E R M A N U A L 7. Driver Function The MCU peripheral resources used for motor control are introduced in this chapter. Function List Most of the MCU peripheral driver functions are located in the file ‘S05_user/init_mcu.c’ Table 7-1: Driver Function List Prototype Description...
  • Page 18: Interrupt Function

    U S E R M A N U A L 8. Interrupt Function Function List Table 8-1: System Used Interrupt Function Prototype Description Remark __root void HWD_Handler (void) The HW watch dog ISR S05_user/isr.c __root void Swd_IsrHandler (void) The software watch dog ISR S05_user/isr.c __root void Bt_0_7_IsHandler (void) PWC interrupt for Hall interrupt...
  • Page 19: Interrupt Generation

    U S E R M A N U A L Interrupt Generation The diagram of the interrupt used for the motor control is briefly introduced in this section. 8.3.1 The multifunction timer is used to generate the interrupt for the motor control algorithm and trigger the AD sample at the zero point.
  • Page 20: Dtti

    U S E R M A N U A L 8.3.3 DTTI The DTTI0 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 be shut off immediately.
  • Page 21: Demo System

    U S E R M A N U A L 9. Demo System This chapter introduces one example of low voltage 3-phase motor project and help you run a motor quickly. Demo System Introduction The low voltage 3-phase motor solution can be adaptive to any type of PMSM or BLDC motor. The connection diagram for debugger is shown in Figure 9-1.
  • Page 22: Motor Debug

    U S E R M A N U A L The Hall signal line connection is defined in the following table. Table 9-2: Hall Connection Motor Line Inverter Board Circuit Port Hall A Hall A Hall B Hall B Hall C Hall C Note: ...
  • Page 23: Fw Interface Configuration

    U S E R M A N U A L 9.2.1 FW Interface Configuration All of 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/hardware_config.h’. Both files are highlighted, as shown in Figure 9-3.
  • Page 24: Figure 9-4: Motor Parameter Configuration

    U S E R M A N U A L /** UI_00 define which should be used in this project*/ #define MOTOR_ID //define which motor could be used in this project /** UI_01 define the used motor parameter in this project*/ 0 == MOTOR_ID #define MOTOR_IMAX...
  • Page 25: Figure 9-5: Adc Port Setting

    U S E R M A N U A L the performance difference of the motor. Basic Setting for HW The basic settings for the HW can be set in the H file ‘h05_user/ hardware_config.h’. Other settings in this file are not recommended to modify for the FM0+ series. Note: ...
  • Page 26: Figure 9-7: Adc Coefficient Setting

    U S E R M A N U A L Hardware Coefficient Setting /** UI_03 define the hardware's a/d sample information, carry wave frequency and dead time*/ float32_t Motor_f32IuvwSampleResistor = 0.1; //Iuvw sample resistor (ohm) float32_t Motor_i32IuvwAmplifierFactor = 5; //Iuvw calculation factor int32_t Motor_i32IuvwOffsetNormal = 2048;...
  • Page 27: Figure 9-9: Variables Setting For Acceleration

    U S E R M A N U A L Acceleration Setting The acceleration and deceleration can be set in this part /** UI_05 configure the acceleration and deceleration speed */ uint16_t SpdSt_u16AccMaxRpm = 2000; //maximum acceleration speed,unit:rpm/s uint16_t SpdSt_u16DecMaxRpm = 2000; //maximum deceleration speed,unit:rpm/s uint16_t SpdSt_u16DefaultAccRpm = 500;...
  • Page 28: Hall Check

    U S E R M A N U A L 9.2.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 angle and status information is not known. If the hall information has been known or the FW runs in the sensor-less mode, this section can be ignored and the motor can be normally started.
  • Page 29: Figure 9-13: Hall Check Result

    U S E R M A N U A L Figure 9-13: Hall Check Result The data output by the hall check function in the Figure 9-13 must be filled into corresponding variables or array for the motor’s normal running in the file ‘s05 user/customer_interface.c’ as shown below. /** UI_0101 configure motor parameter */ #define MOTOR_ID...
  • Page 30: Run Motor

    U S E R M A N U A L 9.2.3 Run Motor When the hall angle and status list have been checked by the hall check mode, the motor can be started for the demo show. (1) Reset the variable to the normal work mode in section ’Motor Parameter Configuration’. The setting is as the following.
  • Page 31: Debug With Dac

    U S E R M A N U A L  Do not click the button D to break the FW running, the HW over-current or DC over fault may appear and hardware may be damaged if you do that. ...
  • Page 32: Protection

    U S E R M A N U A L 9.3.2 Protection When the motor is stopped without the normal stop command, the protection fault may appear, you can see the value of the variable ‘MotorCtrl_stcRunPar.u16FaultCode’ in the watch window and the code is assigned by the bit OR operation.
  • Page 33 U S E R M A N U A L You can do as follows:  The Hall status list and angle must be re-checked and modified to the corresponding motor parameters shown in section Hall Check.  Recheck motor parameters when the motor is sensor-less as described in section Motor Parameter Configuration ...
  • Page 34: Additional Information

    U S E R M A N U A L 10. Additional Information For more Information on Spansion semiconductor products, visit the following websites: English version address: http://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: Spansion.Solutions@Spansion.com...
  • Page 35 U S E R M A N U A L AN710-00002-1v0-E SpansionUser Manual FM0+ Family 32-BIT MICROCONTROLLER Low Voltage 3-Phase BLDC&PMSM Control User Manual Apr 2015 Rev. 1.0 Published: Spansion Inc. Edited: Embd System Plat Dev-Embd Solution Apr 2, 2015, S6E1A1_AN710-00002...
  • Page 36 Spansion assumes no liability for any damages of any kind arising out of the use of the information in this document.

Table of Contents