Home

AN-8205 — AMC Library Hall Interface

image

Contents

1. 1uF H EP FSB50550U 22uF e Figure 10 Circuit Diagram ISP Port 5V 1uF 15V e L 33 vpP 0 1uF 10K 33 E V SCL 33 SDA 93 wWw rst OM mre 10K GND l 5V FO 4 7K 1KQ HA e W HB 9 HC W IIl CW CCW 7 5V a 5V w FAULT 2KQ 10KQ SPEED soko va IO Settings Please refer to Figure 10 and Table 6 Because designed for output signal P10 is set as Output direct drive and the pin name is FO Because designed for direction control signal input P25 is set as Open drain and pin name is DIR Because designed for LED control signal output P26 is set as Open drain and pin name is nLED 10 Configuration Pot Poti Pon2 File Pot Porti Port2 File Assign P2 configuration type P2 CFG Typed Assign INTL INTO locate of P2 Function P2 1 P2 0 INT1 INTO v Output direct drive PIG o Rx P1 P Onencrain Tx PinName Direction Function P12 P1 2 Open drain vio soL p13 P13 Open drain O SDA P1 4 PLA Open drain O SPSSN TDO P1 5 PIS Open drain O MOSUTDI P1 6 P16 Open drain sn MISO TMS Open drain PLZ PL 7 Open drain m SCK TCK Opan diaii Ss Open drain Figure 11 1 O Configuration Settings Timer Settings The TIMERO is used in the example program to be a base of acceleration deceleration slope whic
2. 3x1024 tsys 2x2048 3x2048 tsys 2x4096 3x4096 tsys X Cancel Figure 5 Hall Signal Settings Protection The protect options are set to determine whether an interrupt request is generated to notify the MCU when a Hall signal error or time out occurs Hall Error Event Enable When HA HB and HC signals are all HIGH level 111 or all LOW level 000 the Hall signal error is judged and the PWM output is immediately shut off If this option is selected the interrupt request EX8 is generated to notify the MCU once a Hall signal error occurs Hall Signal Time Out Hall Period Register HPER a 20 bit timer in the angle predictor is used to calculate the time interval of Hall signal APPLICATION NOTE changes A very long interval usually represents that the motor is in very low speed or has stopped If this option is selected the time of HPER is monitored If a time out occurs the HPER is larger than 1FFFFh 3FFFFh or 7FFFFh an interrupt request EX8 is generated to the MCU oc Hall Shot ISR Hall Error Event Enable H_ERR Hall Time Out Event Enable H_SLOW Hall Time Out interrupt HTMR_OUT when HPER gt 1FFFFh v p aO when HPER gt 3FFFFh when HPER gt 7FFFFh Event Function EX8 X Cancel Figure 6 Protect Settings Hall Signal Input The two optional Hall signal input pins listed in Table 1 Table 1 Hall Signal Input Configure 1 40h Configure 2 80h HA P
3. 0x0 0x50 After executing if the function return value is 0 data is successfully transmitted 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 APPLICATION NOTE Command Index Command and associated parameters are shown in Table 3 Table 3 Commands and Parameters Command Index Parameter 1 RUN CMD_RUN 0x10 0 FREE CMD_DUTY 0x12 Duty 07 511 CMD ANGLE SHIFT 0x14 Angle shift value 0 127 Hall Interface pin configuration CMD HALL PIN 0x80 0x40 HA HB HC P14 P15 P16 0x80 HA HB HC P24 P25 P26 Hall Interface Files After using MCDS IDE to generate a new project and generate code the MCDS IDE automatically generates two files for Hall interface Table 4 shows file names and functions of those files Table 4 Hall Interface Files File Name Descriptions Editable AMC Hallinterface c provides common functions such as WriteCmdToAMC AMC Halllnterface c ReadDataFromAMC Initial AMCToSpeedintegral and so on Users cannot No z modify the file Once the Generate Code function of the MCDS IDE is used the file is overwritten AMC Hallinterface h provides definitions of all commands and definitions of the AMC_Halllnterface h indexes when reading data Users cannot modify the file Once the Generate Code No function of the MCDS IDE is used the file is overwritten AMC_Halllnterface c For convenience AMC Ha
4. Hall signals and filter out noise on the input signals The PLL detects the Hall signal changes in every 60 degree of electrical angle to predict the rotor position The angle encoder sums the PLL results and leading angle shifter setting into one angle then the PWM engine outputs PWM signals according to the angle of the angle encoder For more information about each block refer to AN 8202 FCMS8531 User Manual Hardware Description The PWM Control Mode can be classified into two modes Sine Wave Mode and Square Wave Mode The Sine Wave Mode is the default When the motor is started in Sine Wave Mode the Square Wave PWM output is used to initially drive the motor Until the phase of the motor is locked by the PLL the Sine Wave PWM output is automatically switched to drive the motor Angle PWM Engine Angle Predictor Configurable Processing Figure 3 Angle Predictor Configuration Before the FCM8531 is used to drive the motor with the Hall sensor the AMC needs to be configured to the Hall interface Some parameters such as angle predictor setting PWM Hall signal protection and Hall Mode must be set in the MCDS IDE The operation of the MCDS IDE can refer to the document AN 8207 User Guide for MCDS IDE of FCM8531 APPLICATION NOTE PWM The PWM parameters shown in Figure 4 include output waveforms SAW type PWM frequency dead time etc Waveform There are two optional waveforms sinus
5. amp x 8 OCAH 43 Evt_OCHA 44 if bV amp Ox10 OCBH 45 Evt OCHB 46 if bV amp 0x20 OCCH 47 Evt OCHC 48 49 50 User program start here 17 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 APPLICATION NOTE 51 else 52 nLED 1 53 54 User program end here 17 55 MSFRADR bBackupADR 56 57 58 Fault ISR 59 INTERRUPT ISR Fault VECTOR_EX8 60 Ex8 61 U8 bBackupADR 62 U8 bV 63 User variable start here 24 64 65 User variable end here 24 66 67 bBackupADR MSFRADR 68 READ MSFR MSFR MSTAT bV 69 if bV amp Ox7F 70 71 User program start here 1B 72 73 User program end here 1B 74 if bv amp 0x20 Short A 75 Evt ShortA 76 if bv amp 0x10 Short B 77 Evt ShortB 78 if bv amp exes Short C 79 Evt ShortC 80 if bV amp x 4 Hall Error 81 Evt HERR 82 User program start here 18 83 84 User program end here 18 85 86 MSFRADR bBackupADR 87 Related Resources FCM8531 MCU Embedded and Configurable 3 Phase PMSM BLDC Motor Controller AN 8202 FCM8531 User Manual Hardware Description AN 8207 User Guide for MCDS IDE of FCM8531 DISCLAIMER FAIRCHILD SEMICONDUCTOR RESERVES THE RIGHT TO MAKE CHANGES WITHOUT FURTHER NOTICE TO ANY PRODUCTS HEREIN TO IMPROVE RELIABILITY FUNCTION OR DESIGN FAIR
6. detected The timeout value set by the TIMERO is about 26 2 ms When a time out is generated in the main program the count value is added by one If the count value is greater than or equal to the SPEED_LOOP_RATE the duty and AS are updated The complete source codes are located on the IDE installation disc under the following directory Fairchildsemi iMCDS Examples keilC Sample_Hall_Interface for Keil C FairchildsemiMCDS Examples SDCC Sample_Hall_Interface for SDCC Main c Main c is related to the system processing control The program explanation is listed below Line 4 Line 7 12 define constants in which MAX SPEED the maximum value of ADCO MIN SPEED the minimum value of ADCO SPEED_LOOP_RATE the time of updating duty unit in 26 2 ms MOTOR_RAMPUP_DUTY the motor starts to revolve when VSP is greater than the value AS GAIN Angle shift value AS OFFSET Sine wave PWM only AS OFFSET Angle shift offset value set system clock as 30 MHz duty AS GAIN Line 14 40 Define variables Line 43 46 initialize the MCU Line 48 50 initialize variables 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 APPLICATION NOTE Line 52 61 enable Interrupt and initialize AMC if MIN_SPEED the bCurrent_Duty is not AMC initialization or transmission is fail changes m AMG i ran again and toggle Line 95 97 update the duty and AS to
7. 0 the AMC has not completed the startup procedure b5 Al Rdy Al Rdyzl the AMC has completed the alignment procedure subsequent ramp up control can start Al Rdyz0 the AMC has not completed the alignment procedure b6 RST_Rdy RST_Rdy 1 the AMC has completed the reset action MCU can start to transmit and read data RST_Rdy 0 the AMC has not completed the reset action b7 SAFETY_Warning SAFETY_Warning 1 the AMC has occurred fault to UL60730 rules SAFETY_Warning 0 the AMC has not occurred fault to UL60730 rules MRX1 b0 b7 Data Hi Byte Store high byte of data transmitted from AMC MRX2 b0 b7 Data Lo Byte Store low byte of data transmitted from AMC 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 APPLICATION NOTE Table 2 Mailbox Registers Definitions ee isis Bit 7 Bite Bits Bit4 Bit 3 Bit 2 Bit 1 Bit 0 MTXO BOh Command Trigger MTX1 B1h Data High Byte MTX2 B2h Data Low Byte MTX3 B3h Reserved Forward MRXO B4h Reserved RST Rdy AL Rdy STR Rdy AMC Fault AMC Cal AMC Cmd Reserved MRX1 B5h Data High Byte MRX2 B6h Data Low Byte MRX3 B7h Reserved Communication Protocol Correct communication protocols and flows between the MCU and AMC must be properly executed to avoid transmission errors The correct steps of the communication protocols an
8. 14 P24 HB P15 P25 HC P16 P26 The subroutine btInitial AMCToHallSignal defines the AMC as Hall interface drive and the Hall signal input selection is set in it Before the subroutine is called by the main program the contents of the _bHall_Type need to be set and the default is HALL_PINCFG0 An example of the subroutine is listed below Initial Procedure User program start here 02 bHall Type HALL PINCFGO HA P14 HB P15 HC P16 bHall Type HALL PINCFG1 HA P24 HB P25 HC P26 User program end here 02 EA 1 btInit_AMCStatus btInitial_AMCToHallSignal Initial AMC The processing flow of the subroutine btInitial AMCToHallSignal is executed through subroutine bWriteCmdToAMC to send the Hall Mode to the AMC bWriteCmdToAMC CMD_HALL_PIN _bHall_Type 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 Communication Communication Interface Communications between MCU and AMC are carried through mailbox registers AMC receives the control commands and data from MCU via MTXO BOh MTX3 B3 and controls the motor accordingly and MCU reads data transmitted from AMC via MRXO B4h MRX3 B7h as shown in Figure 7 MCU SFR MTXO MTX1 MTX2 MTX3 AMC Interrupt INT 11 AMC Core MRXO MRX1 MRX2 MRX3 ti Figure 7 Communication
9. ADCCounterForSC 0 117 bShortCircuit Cnt 0 118 bADCCounterForSC Temp 0 119 btShortCircuit Protect 0 120 nLED 1 Fault LED off 121 122 123 User program end here 04 124 MCS51 c MCS51 c is related to initial I O port setting for the MCU Line 19 increase bSpeed_Count and interrupt request processing The program explanation is listed Melee The program codes are listed as follows In which the thin characters are the program codes generated by the MCDS Line 6 23 interrupt service routine of TIMERO timeout code generator 1 2 Interrupt Service Routine 3 l 4 Timer ISR 5 INTERRUPT ISR_T VECTOR_ET 6 7 U8 bBackupADR 8 UU16 V 9 User variable start here 39 10 11 User variable end here 39 12 13 bBackupADR MSFRADR 14 Initial Timero 15 V U16 INITIAL TO INTERVAL 16 THO V U8 MSB 17 TLO V U8 LSB 18 User program start here 13 19 bSpeed_Count 20 21 User program end here 13 22 MSFRADR bBackupADR 23 2013 Fairchild Semiconductor Corporation www fairchildsemi com Rev 1 0 1 1 9 14 16 AN 8205 MotorCtrl c MotorCtrl c is related to initial register setting for the MSFR and interrupt request processing generated from motor control The program explan
10. AMC and then the LED otherwise turn off the LED the PWM output is changed Line 64 send free command to AMC Line 98 99 clear bSpeed Count Hegga a ene iie P is Line 102 109 if the _bTarget_Duty is less than the MOTOR_RAMPUP_DUTY and AOT ORAU PU un a ae btShortcircuit Protect is active the btShortciircuit Protect is cleared if PWM output is t d off and th 1 Yes RUN bit and CW CCW bit of the n i pos Tue Mond mST OE MSFR are set according to DIR status and kac doen send run command to AMC Line 110 121 if btShortcircuit_Protect is active turn on Line 81 judge whether the duty and AS need to be BED I not clear varias updated The program codes are listed as follows In which the thin Line 83 94 increase or decrease the bCurrent_Duty ee ate ihe progres cenetated by the MEDS if the bCurrent_Duty is greater than the coce generator MAX_SPEED or less than the 1 11 2 E nnn RR 2 Initial Const 3 l 4 define INITIAL_SLEEP 0x04 5 6 User program start here 09 7 define MAX_SPEED 500 8 define MIN_SPEED 0 9 define SPEED LOOP RATE 2 1 step 26 21 ms 10 define MOTOR RAMPUP DUTY 10 11 define AS GAIN 128 AS DUTY AS GAIN AS OFFSET 12 define AS OFFSET 2 13 14 U8 bSpeed Count 0 15 UU16 wCurrent Duty 16 17 ifndef SDCC 18 extern SEG BIT btShortCircuit Protect 19 extern U8 PbShortCircuit Cnt bADCCounterFor
11. CHILD DOES NOT ASSUME ANY LIABILITY ARISING OUT OF THE APPLICATION OR USE OF ANY PRODUCT OR CIRCUIT DESCRIBED HEREIN NEITHER DOES IT CONVEY ANY LICENSE UNDER ITS PATENT RIGHTS NOR THE RIGHTS OF OTHERS LIFE SUPPORT POLICY FAIRCHILD S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF FAIRCHILD SEMICONDUCTOR CORPORATION As used herein 1 Life support devices or systems are devices or systems 2 A critical component is any component of a life support which a are intended for surgical implant into the body or device or system whose failure to perform can be reasonably b support or sustain life or c whose failure to perform expected to cause the failure of the life support device or when properly used in accordance with instructions for use system or to affect its safety or effectiveness provided in the labeling can be reasonably expected to result in significant injury to the user 2013 Fairchild Semiconductor Corporation www fairchildsemi com Rev 1 0 1 1 9 14 18
12. FAIRCHILD AN 8205 AMC Library Hall Interface Summary The FCM8531 is an application specific parallel core processor for motor control that consists of an Advanced Motor Controller AMC processor and a MCS 51 compatible MCU processor The AMC is the core processor specifically designed for motor control It integrates a configurable processing core and peripheral circuits to perform sensorless Field Oriented Control FOC motor control System control user interface communication interface and input output interface can be programmed through the embedded MCS 51 for motor applications The advantage of FCM8531 s parallel core processors is that the two processors can work independently and complement each other The AMC is dedicated for motor control applications such as motor control algorithms PWM control current sensing real time over current protection and motor angle calculation The embedded MCU provides motor control commands to the AMC to control motors through a communication interface This approach reduces software burdens and simplifies control system programs because complex motor control algorithms are executed in the AMC Fairchild provides the Motor Control Development System MCDS Integrated Development Environment IDE and MCDS Programming Kit for users to develop software execute In System Programming ISP and perform online debugging A typical FCM8531 development environment configuration is shown
13. Interface Mailbox Registers Definition This section describes each register used in communication Data Transmission of MCU MTXO MTX3 MTXO bO Trigger Bit The transmitted commands and data to the AMC are stored in the related registers bit transition at bO from 1 to 0 can start the transmission b1 b7 Command Storing the commands transmitted to the AMC MTX1 b0 b7 Data Hi Byte Storing the high byte of data transmitted to AMC MTX2 b0 b7 Data Lo Byte Storing the low byte of data transmitted to AMC MTX3 b0 ForwardFreeRun Determine motor forward wind startup 1 forward 0 not forward b1 ReverseFreeRun Determine motor reverse wind startup 1 reverse 0 not reverse b2 b7 Reserved Set to zero APPLICATION NOTE Data Read of MCU MRXO MRX3 MRXO b0 Reserved b1 AMC_Cmd AMC Cmd l the AMC is busy in processing a command and is not able to receive a new command AMC Cmd 20 the AMC is able to receive a new command b2 AMC Cal AMC_Cal 1 the AMC is busy and is not able to receive a new command AMC Cal 0 the AMC is not busy and is able to receive a new command b3 AMC Fault AMC_Fault 1 the AMC runs abnormally MCU can do a retry or a stop when an AMC Fault occurs AMC_Fault 0 the AMC runs normally b4 STR Rdy STR Rdy 1 the AMC has completed the startup procedure MCU is allowed to do general motor control subsequently STR Rdy
14. SC 20 extern U8 bADCCounterForSC Temp 21 extern UU16 wTarget Duty 22 endif 23 24 User program end here 09 25 260 f fnnn nnn nnn nn ne nn nn enn een nn nnn nnn enn nen een n nen e nee 27 Main Routine DB f fnnn nnn nnn nnn nn nn nn nnn nnn nn enn enn n nen n nena 29 if defined SDCC 30 SEG_BIT at 0x30 btInit_AMCStatus 31 else 32 SEG_BIT btInit_AMCStatus 33 endif 34 void main void 35 36 User variable start here A 37 if defined SDCC 38 SEG BIT at 0x31 btTrans Status 39 else 40 SEG_BIT btTrans_Status 41 endif 42 User variable end here A 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com 14 AN 8205 APPLICATION NOTE 43 CKCON 0 44 WRITE_MSFR MSFR_SLEEP INITIAL_SLEEP 45 46 Initial Procedure 47 User program start here 02 48 bHall Type HALL_PINCFG HA P14 HB P15 HC P16 49 _wTarget_Duty U16 0 50 _wCurrent_Duty U16 0 51 User program end here 02 52 EA 1 53 btInit_AMCStatus btInitial AMCToHallInterface 54 55 User program start here 3 56 if btInit AMCStatus 57 58 btInit_AMCStatus btInitial_AMCToHallInterface 59 nLED 1 60 61 nLED 1 62 63 User program end here 3 64 bWriteCmdToAMC CMD_AMC_CONTROL 0 0 65 for 66 67 User program start here 04 68 if wTarget Duty U16 MOTOR RAMPUP DUTY amp amp btShortCircu
15. ation is listed below Line 5 17 interrupt service routine of Hall signal APPLICATION NOTE Line 34 35 output theta to AOUT pin Line 40 52 OCP analysis routine Line 58 87 Fault interrupt service routine trigger The program codes are listed as follows In which the thin Line 13 toggle the FO pin characters are the program codes generated by the MCDS code generator Line 20 48 interrupt service routine of ADC trigger Line 30 32 store ADCO value 9 bit into _wTarget_Duty Do E ao enn nnn neem nnn n nn en 2 Interrupt Service Routine 30 JJ eani ia e EE 4 Hall ISR 5 INTERRUPT ISR Hall VECTOR EX10 6 Ex10 7 U8 bBackupADR 8 User variable start here 22 9 10 User variable end here 22 11 bBackupADR MSFRADR 12 User program start here 16 13 FO 1 14 15 User program end here 16 16 MSFRADR bBackupADR 17 18 19 ADC ISR 20 INTERRUPT ISR_ADC VECTOR EX9 21 EX9 22 U8 bBackupADR 23 U8 bV 24 User variable start here 23 25 U8 bAngle 26 27 User variable end here 23 28 bBackupADR MSFRADR 29 User program start here 1A 30 READ_MSFR MSFR_ADC H _wTarget_Duty U8 31 READ MSFR MSFR ADCOL _wTarget_Duty U8 1 32 _wTarget_Duty U16 gt gt 7 33 _bADCCounterForSC 34 READ_MSFR MSFR_ECL bAngle 35 WRITE MSFR MSFR DAC3 bAngle 36 37 User program end here 1A 38 39 READ MSFR MSFR OCSTA bV 40 if bV 41 42 if bV
16. d flows are described and shown below MCU Writes Commands to AMC Step 1 Check if AMC is busy If yes step 1 is repeatedly executed until TimeOut occurs If no execute step 2 Step 2 Store commands and data in the corresponding registers then transit bO of MXTO from 1 to O to start transmission Step 3 Wait for 20 us Step 4 Check if the AMC has commands namely finished processing AMC_Cmd 1 If yes step 4 is repeatedly executed until TimeOut occurs If no transmission completes lt TimeOut Sa AMC Busy Timeout Tho v MTXO Command 0x01 MTX1 Data Hi Byte MTX2 Data Lo Byte MTX0 Command amp OxFE Y Delay 20us Y No di j ms a N Timeout 75 5 AMC WriteCmd Err K x P s AMC_Cmd 1 2 T No Y r N AMC Completed Figure 8 Write Command Protocol Built In Functions For convenience the command transmit function is generated when a new project is created in the MCDS IDE software The function is used to transmit data from MCU to AMC to shorten coding time The functions are described below bWriteCmdToAMC U8 Command U8 Data_High_Byte U8 Data_Low_Byte In which Command the commands corresponding to the transmitted data Data High Byte high byte of the transmitted data Data Low Byte low byte of the transmitted data Example To set the PWM duty to 0x50 it should be written as bWriteCmdToAMC CMD DUTY
17. efinition in FCM8531 the Hall A B C input invert can be enabled to invert the Hall signal to ensure that the angle predictor is correct 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 Hall Signal Banking Time amp Debounce Time The Hall signal blanking and debounce times are used to prevent PLL malfunction from noise involved in the Hall signal The minimum values of the two times are the defaults Hall Interrupt Type HALL_INT Rising Falling Edge Trigger v Rising Falling Edge Trigger Rising Edge Trigger Falling Edge Trager Hall Signal Blanking Time HAL_BNK Disabled Disabled 5x1024 6x1024 tsys 9x1024 10x1024 tsys 17x1024 18x1024 tsys 33x1024 34x1024 tsys 65x1024 66x1024 tsys 129x1024 130x1024 tsys 257x1024 258x1024 tsys Hall ISR v Hall Signal Interrupt Enabled EX10 Hall Interrupt Type HALL INT Rising Falling Edge Trigger f O Hall A Input Invert HA INV O Hall B Input Invert HB INV O Hall C Input Inverted HC INV O Hall Regulation Enabled HAL REG V HPER Register Average Mode Enabled HAL AVG Hall Signal Blanking Time HAL_BNK Disabled Blanking Time 00 00uS Hall Signal De Bounce Time HAL DEB Disabled 2 3 tsys De Bounce Time 66 7 100 0nS Hall Signal De Bounce Time HAL_DEB Disabled 2 3tsys x Disabled 2 3tsys 2x64 3x64 tsys 2x1 283x128 tsys 2x56 3x256 tsys 2x512 3x512 tsys 2x1024
18. generated to read the ADCO VSP for controlling speed ADC DAC ADC DAC SR mac Interrupt Enable EX9 ADC trigger signal ADC_TP 4 ADC scan mode ADSCAN Default made v Sampling rate divider FS_DIV c 1 sampling rate v Pre Amp gain of abhi vw vahi mM Apc w IBxi m ve ia ancha v eha M yeki v i wv OK 6 cones ADC Tigger i n f j j Figure 14 ADC Configuration APPLICATION NOTE Firmware Example The initial subroutine of the main program is provided to set initial values of PWM frequency protection points interrupt parameters and so on Startup parameters of the AMC are reset and communication between the AMC and MCU is tested by the initial subroutine The initial subroutine is only executed in the beginning of the main program and then infinite loops are executed The ADC samples each PWM cycle and generates interrupt requests after conversion is completed In the interrupt service routine the ADCO value is stored to the _wTarget_Duty The main program judges whether the _wTarget_Duty is greater than the MOTOR_RAMPUP_DUTY If greater the PWM is turned on to run the motor The motor rotation direction is determined according to the DIR switch setting and the RUN bit of the MCNTL MSFR 00h is set If _wTarget_Duty is less than or equal to the MOTOR_RAMPUP_DUTY the MCTRL duty and AS are cleared and the motor maintains Free state and the ADCO value is continually
19. h is set to 26 2 ms Dreri Timer Timer2 ISR v Timer Interrupt Enable ETO Timer Mode TMOD TOMOD Model 16 bit Counter Timer SAL Mode Select C TO _ Timer Moet a Gating Control Enable GATED Timer Value B bit value THO 00 Hex 8 bit value H Timer over lfiw Time TF0 26 214m Sec Timer0 Settings S_OK Figure 12 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 12 www fairchildsemi com AN 8205 Interrupt Settings The Hall Interrupt function in the example program is used to generate the FO signal and the Hall Interrupt function INT10 has to be enabled and the trigger type is set to Rise Fall edge trigger ISR N signal interrupt enable EX10 HalLinteruatt ae H LINT Rise Fall edge trigger 2 Hall A input invert H IN Hall B input invert HB INV O Hall C input invert HC INV ia M Hall regulation enable HAL_REG HPER register average mode enable HAL_AVG Hall signal blanking time HAL_BNK Disable Blanking time 0 0 0 0uS Hall signal de bounce time HAL_DEB Disable 23 fsys De bounce time 66 7 100 0n8 Figure 13 Hall Configuration Settings ADC Settings The ADCO VSP in the example program is used for speed control input and the ADC interrupt INT9 has to be enabled and the sampling type is set to SAW top After the ADC conversion is completed the ADC interrupt INT9 is
20. ime if MRXO amp AMC PROCESSING CMD AMC CALCULATING 0x0 btAMCStandby Flag 1 break if btAMCStandby Flag Check Time Out return AMC BUSY TIMEOUT MTX bCommand MCU MAILBOX INTR STOP MTX1 bData HB MTX2 bData LB MTXO bCommand amp MCU MAILBOX INTR START Delay10us 2 for wWaitTime 0 wWaitTime lt 600 wWaitTime if MRXe amp AMC PROCESSING CMD 0 return AMC COMPLETED return AMC WRITE CMD ERROR eee OTS cas sce cessscsccssss e Delay time routine lI LLE ooccoonooccooocco Taaa a a a void Delayi0us U16 Counter Delay 10us U16 i k for i 0 i lt Counter i for k k lt 16 k void Delayims U16 Counter Delay 1ms U16 i for i 0 i Counter i Delay10us 110 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 8 www fairchildsemi com AN 8205 AMC_Hallinterface h AMC_HallInterface h includes commands parameters and indexes of AMC data The contents of AMC_HallInterface h are listed below In which Line 18 22 indicates status of MailBox Line 22 46 indicates commands of AMC Line 59 68 indicates status of AMC APPLICATION NOTE 1 ifndef AMC HallInterface h 2 define AMC HallInterface h 3 4 for IEC 60730 5 define LOCK ROTOR DELAY TIME 10 Resolution 1 sec step 1 means 1s 6 define OVER CURRENT MUTE TIME 10 Resolution 0 5 sec step 1 means 5
21. in Figure 1 The application board can be a FCM8531 evaluation board or a user defined circuit board referred to as a target board The FCM8531 evaluation board can be used with the MCDS IDE and MCDS Programming Kit offered by Fairchild to help develop products for motor applications FCM8531 Application Board FCM8531 wwwW fairchildsemi com The MCDS IDE can be operated under the Microsoft Windows operating system including functions of project management AMC library selection register setting and compiler linker debugger link to help develop software By using the AMC library provided by Fairchild users can more quickly and easily develop a sensorless motor drive and shorten development time of motor applications This document is a user guide of the AMC library For details of the MCDS IDE and MCDS Programming Kit refer to Fairchild s website at http www fairchildsemi com applications motorcontrol bld c pmsm controller html AMC Introduction The AMC is the core processor consists of several motor control modules such as configurable processing core PWM engine and angle predictor Depending on the application the processing core can be configured with the suitable AMC library to perform different motor control algorithms such as FOC or sensorless FCM8531 can drive the motor with Hall sensor or sensorless libraries The Hall interface library is an AMC library for driving the motor with a Hall sens
22. it Protect 69 70 if DIR 71 72 WRITE MSFR MSFR MCNTL MOTOR RUN MOTOR CW 73 74 else 75 76 WRITE MSFR MSFR MCNTL MOTOR RUN 77 78 79 bWriteCmdToAMC CMD AMC CONTROL 1 80 81 if bSpeed Count SPEED LOOP RATE 82 83 if _wCurrent_Duty U16 lt _wTarget_Duty U16 84 85 If current duty less than target current duty 1 86 if _wCurrent_Duty U16 lt MAX_SPEED 87 _wCurrent_Duty U16 88 89 else If current duty more than target current duty 1 90 if wCurrent Duty U16 gt wTarget Duty U16 91 92 if _wCurrent_Duty U16 gt MIN_SPEED 93 _wCurrent_Duty U16 94 95 btTrans Status bWriteCmdToAMC CMD ANGLE SHIFT 0 wCurrent Duty U16 AS GAIN 96 if btTrans Status 97 btTrans Status bWriteCmdToAMC CMD DUTY wCurrent Duty U8 0 _wCurrent_Duty U8 1 98 if btTrans Status 99 bSpeed Count 6 100 101 102 else 103 104 _wCurrent_Duty U16 0 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 15 www fairchildsemi com AN 8205 APPLICATION NOTE 105 WRITE_MSFR MSFR_MCNTL MOTOR_FREE 106 107 bWriteCmdToAMC CMD_AMC_CONTROL 0 0 108 btTrans Status bWriteCmdToAMC CMD ANGLE SHIFT 0 0 109 btTrans Status bWriteCmdToAMC CMD DUTY 0 110 if btShortCircuit Protect 111 112 nLED 0 Fault LED on release the flag after reset device 113 114 else clear protect flag 115 116 b
23. llInterface c includes several common functions described in Table 5 Table 5 AMC Hallsignal c Common Functions Function Name Descriptions AMC Reset Resetting the AMC Initial AMC and set AMC to Hall Interface Mode btlnitial AMCToHallinterface fas ear 1 AMC initial fail Transmitting data to the AMC bWriteCmdToAMC Commana Data H Data L Result 00 Pass 02 Transmission error Delay10 us value Waiting for the AMC in 10 us delay Delay1 ms value Waiting for the AMC in 1 ms delay The contents of AMC HallInterface c are listed as follows Line 13 Set Hall interface as Mode 0 Default HA P14 HB P15 HC P16 Line 18 22 Subroutine for reset AMC Line 27 49 Subroutine for initial AMC and check the AMC status 2013 Fairchild Semiconductor Corporation www fairchildsemi com Rev 1 0 1 1 9 14 6 AN 8205 Line 55 Line 72 68 Subroutine for send HALL MODE amp TRANS COMPLETE to AMC 99 Subroutine for send one command to AMC and check AMC status Line 104 110 Subroutine for delay 10 us Line 112 118 Subroutine for delay 1 ms APPLICATION NOTE WANA UBBWNPR UNKNUNUNUNBHRRPHRRPHRRPRRPRBPWWWWWWWWWWnNnnNnnNNNNNNNNRPRPRPRPRPRPRPRPRPB DAUBWNRFPOTOWNAUBPWNPOWOWANAUBPWNPOWOWANAUBRPWNEFAWOAWANAUBWNRO Copyright 2012 Fairchild Semiconductor http www fairchildsemi com include compiler define h include FCM8531 h include MSFR define h incl
24. oidal wave and square wave SAW Type There are three optional types up down type default up type and down type PWM Frequency The PWM frequency can be adjusted through the SPRD parameter which is recommended at 15 kHz to 20 kHz to obtain larger SAW resolution and keep out of audio range Pre scale and post scale are both selected to div 1 Dead Time Dead time needs to be adjusted depending on the power specification The setting value shown in Figure 4 is suitable for demonstration PWM Sinusoidal Wave File Waveform Sinusoidal Square O Interleave N Ag Tn LI L PWMb F DT q SAW Made Soft Switching Dead Time DT Up Down OUp O Down 60 tsys x ZN M NA DT Time 2 0 uS PWM Clock PWM Cycle System Clock Renca gt gt Post Scale gt gt saw nnfu divl ov divl w Duty v Auto SAW Alignment Function SAW Period SPRD 3E8 Hex PWM Frequency 15 00K Hz Figure 4 PWM Settings Hall Signal The options of the Hall signal filter can be set in the Hall dialog shown in Figure 5 Hall Signal Interrupt Enable EX10 When the Hall signal changes the Hall signal interrupt enable EX10 can be selected to generate the interrupt request to the MCU There are three interrupt trigger types rise edge trigger fall edge trigger and rise fall edge trigger Hall Invert If the polarity of the Hall signal is different from the d
25. or This document mainly describes usage of the Hall Interface Library and includes control theory configuration files and a firmware example For more detailed information on the AMC library for sensorless control please refer to the following website http www fairchildsemi com applications motorcontrol bld c pmsm controller html Embedded MCU MCS 51 core 12K Bytes Flash YAS AMC Advanced Motor U 3 Phase i GPIO 256 1K Bytes SRAM Controller ADC DAC 1 EIE Analog Input Figure 1 Typical Development Environment 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 www fairchildsemi com AN 8205 Hall Interface The Hall interface library is selected via a Project Setting window of the MCDS IDE as shown in Figure 2 Project Setting Project Copyright Notice 30MHz Operations 12K Bytes Flash ROM 256 1024 Bytes SRAM 17 I O Pin Device FCM8531 Xtal Hz Memory Model Large variables inXDATA AMC Library Hall Interface Speed Integral Sliding mode observer Hall Interface Figure 2 MCDS IDE Project Setting Control Theory The angle predictor see Figure 3 is the main processor of the Hall interface library it includes Hall signal filter Phase Lock Loop PLL leading angle shifter and angle encoder The Hall signal filter is used to handle the
26. s 7 8 MCU mail box status 9 define MCU MAILBOX INTR STOP 0x01 10 define MCU MAILBOX INTR START OxFE 11 12 MRX bit description 13 define AMC PROCESSING CMD 0x02 14 define AMC CALCULATING 0x04 15 define AMC FAULT 0x08 16 define AMC STARTUP READY 0x10 17 define AMC LOCK MOT READY 0x20 18 define AMC RESET READY 0x40 19 define SAFETY WARNING 0x80 20 21 MCU CMD list 22 Write data CMD 23 define CMD AMC CONTROL 0x10 24 define CMD DUTY 0x12 25 define CMD ANGLE SHIFT 0x14 26 define CMD ALIGNMENT TIME 0x16 27 define CMD ALIGNMENT WAIT TIME 0x18 28 define CMD ALIGNMENT DUTY OX1A 29 define CMD ALIGNMENT ANGLE x1C 30 define CMD_RAMPUP_START_DUTY Ox1E 31 define CMD_RAMPUP_END_DUTY 0x20 32 define CMD RAMPUP ACC TIME 0x22 33 define CMD FORWARD RUN SPEED 0x24 34 define CMD KP 0x26 35 define CMD KI 0x28 36 define CMD DIGITAL FILTER Ox2A 37 define CMD LOSS STEP Ox2C 38 define CMD_RESOLUTION Ox2E 39 define CMD MINIMUM SPEED 0x30 40 define CMD RAMPUP ID ERR 0x32 41 define CMD LOCK ROTOR DELAY TIME 0x34 42 define CMD OC MUTE TIME 0x36 43 define CMD SHUNT OFFSET 0x38 44 define CMD HALL PIN 0x80 45 define CMD ENABLE WATCHDOG OXxFA Watchdog enable command 46 define CMD TRANS COMPLETE OxFE 47 Read data CMD 48 define CMD MCU READ AMC DATA OxFC 49 50 MCU Read Data Index 51 define AMC DATA CORE ID 0x00 52 define AMC DATA CORE VERSION 0x01 53 define AMC DATA THETA 0x02 2013 Fairchild Semicond
27. sing the Hall interface library to control the motor with Hall sensor is explained in detail according to the attached l example program Sample_Hall_Interface in MCDS IDE HA Function HB The main functions in the example program are HC m Hall sensor input TLS T y Duty control by VR 0 4 V FO Sinusoidal wave current drive FO three pulses per revolution see Figure 9 Figure 9 FO Output m Direction control Current protection cycle by cycle limit i Short circuit protection Table 6 Pin Assignments Pin Type Function Description P14 Input HA Input P15 Input HB Input Input range 0 5 V P16 Input HC Input P10 Output FO FO output three pulses per revolution sns cis 0 CW P25 Input Direction Control 1 CCW Off System ready P26 Output Status LED On OCP protection Flash AMC initial fail Input Range 0 4 V ADCO Input Speed Control lt 0 156 V Motor stop gt 0 156 V Motor start AOUT Output Angle Output 0 4 V 2013 Fairchild Semiconductor Corporation www fairchildsemi com Rev 1 0 1 1 9 14 11 AN 8205 Hardware Circuit APPLICATION NOTE Besides the settings in the configuration section the used I O pins timers and interrupts in the example program also need to be set These are described below 5V FCM8531 0 1uF T 30 9KQ 310V 1 5M0 1 5MQ 1uF wm
28. uctor Corporation Rev 1 0 1 1 9 14 9 www fairchildsemi com AN 8205 APPLICATION NOTE 54 define AMC_DATA_KP 55 define AMC_DATA_KI 56 define AMC_DATA_ID_ERR 57 define AMC_DATA_FW_SPEED 58 59 AMC status code 60 define AMC_COMPLETED 61 define AMC_BUSY_TIMEOUT 62 define AMC_WRITE_CMD_ERROR 63 define AMC_RUNCMD_TIMEOUT 64 65 define AMC ERRCODE PASS 66 define AMC ERRCODE BUSY TOUT 67 define AMC ERRCODE CMD ERROR 68 define AMC ERRCODE RUNCMD TOUT 69 70 Motor Contril define 71 define MOTOR FREE 72 define MOTOR RUN 73 define MOTOR CW 74 define USER DEFINE SVM TABLE 75 76 define CW 77 define CCW 78 79 define HALL PINCFG1 0x80 80 define HALL PINCFGO 0x40 81 0x03 0x04 0x05 0x06 0x00 0x01 0x02 0x03 0x80 0x81 0x82 0x83 0x00 0x01 0x02 0x20 0x01 0x00 HA HA P24 HB P25 HC P26 P14 HB P15 HC P16 E 83 Export Function 85 extern U8 MbHall Type 86 extern SEG BIT btTransmit ParameterToAMC 87 88 extern SEG CODE U8 AS Table 89 90 extern SEG BIT btInitial AMCToHallInterface 91 extern U8 bWriteCmdToAMC U8 bCommand U8 bData HB U8 bData LB 92 extern void Delay1 us unsigned int Counter 93 extern void Delayims unsigned int Counter 94 95 endif 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 10 www fairchildsemi com AN 8205 APPLICATION NOTE Using Hall Interface U
29. ude Program h include MCS51 h include AMC HallInterface h U8 bHall Type HALL MODE8 void Reset AMC WRITE MSFR MSFR MCNTL 0x40 WRITE MSFR MSFR MCNTL 0x00 SEG BIT btInitial_AMCToHallInterface SEG_BIT btError_code U16 wWaitTime Reset_AMC Reset AMC Delayims 100 btError_code 1 for wWaitTime 0 wWaitTime lt 3000 wWaitTime if MRXO amp AMC RESET READY 0x40 btError_code 0 break if btError_code Check Time Out return btError code btError code btTransmit ParameterToAMC Delay1ms 1000 return btError_code SEG_BIT btTransmit_ParameterToAMC 2013 Fairchild Semiconductor Corporation Rev 1 0 1 1 9 14 7 www fairchildsemi com AN 8205 APPLICATION NOTE 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 U8 bWriteCMD Status bWriteCMD Status bWriteCmdToAMC CMD HALL PIN MbHall Type if bWriteCMD Status return 1 bWriteCMD Status bWriteCmdToAMC CMD TRANS COMPLETE 0 0 if bWriteCMD Status return 1 return U8 bWriteCmdToAMC U8 bCommand U8 bData HB U8 bData LB 1 U16 wWaitTime SEG BIT btAMCStandby Flag btAMCStandby Flag 0 for wWaitTime 0 wWaitTime lt 600 wWaitT

Download Pdf Manuals

image

Related Search

Related Contents

Samsung SMX-F40    Benutzerhandbuch  EN R-net - Handicare  User manual  取扱説明書Version 2.0  Tivoli Audio Speaker Model Ten  Tablones y Listones Sólidos de 3/4" (1,9 cm  Samsung Micro D320 manual de utilizador  Advanced Audio Cb Radio Kit Instruction Sheet - Harley  

Copyright © All rights reserved.
Failed to retrieve file