Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. 56F8346 BLDC Motor Control Application with Quadrature Encoder using Processor ExpertTM Targeting Document 56F8346 Hybrid Controller 8346BLDCQETD/D Rev. 1, 10/2003 MOTOROLA.COM/SEMICONDUCTORS For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Specifications BLDC Motor Control Application with Quadrature Encoder This application exercises simple control of the BLDC motor with the Quadrature Encoder on the 56F8346EVM board and the EVM Motor Kit. 1. Specifications Freescale Semiconductor, Inc... This application performs simple control of the BLDC motor with the Quadrature Encoder and closed-loop speed control on the 56F8346 processor. In the application, the PWM module is set to complementary mode with a 16kHz switching frequency. The masking and swapping of PWM channels is controlled by the PWM Channel Control Register. The content of this register is derived from Quadrature Encoder signals. The required voltage is set independently on the commutation by the speed PI controller. The speed is measured by the Quadrature Timer. The RUN/STOP switch enables/disables motor spinning. The allowable range of speed is from 50rpm to 1000rpm in both directions. The application can run on: • External RAM or Flash The BLDC Motor Control Application with Quadrature Encoder can operate in two modes: 1. Manual Operating Mode The drive is controlled by the RUN/STOP switch (S3). The motor speed is set by the UP (S2) and DOWN (S1) push buttons; Figure 1-1. If the application runs and motor spinning is disabled (i.e., the system is ready), the USER LED (LED2, shown in Figure 1-2) will blink. When motor spinning is enabled, the USER LED is on. Refer to Table 1-1 below for application states. Figure 1-1. RUN/STOP Switch and UP/DOWN Buttons on the Daughter Card 2 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com MOTOROLA Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Specifications Figure 1-2. USER and PWM LEDs on the Daughter Card Table 1-1. Motor Application States Application State Motor State Green LED State Stopped Stopped Blinking at a frequency of 2Hz Running Spinning On Fault Stopped Blinking at a frequency of 8Hz MOTOROLA 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com 3 Freescale Semiconductor, Inc. Specifications 2. PC master software (Remote) Operating Mode The drive is controlled remotely from a PC through the SCI communication channel of the device via an RS-232 physical interface. The drive is enabled by the RUN/STOP switch, which can be used to safely stop the application at any time. The following control actions are supported: • Set the Required Speed of the motor PC master software displays the following information: Freescale Semiconductor, Inc... • • • • • Required Speed Actual Speed Applied Voltage DCBus Voltage RUN/STOP Switch Status Application Mode Project files for the PC master software are located in project directory in: ..\pcmaster\sdm_external_memory.pmp, uses Map file to run in the small memory model of the external memory ..\pcmaster\ldm_external_memory.pmp, uses Map file to run in the large memory model of the external memory ..\pcmaster\sdm_pROM-xRAM.pmp, uses Map file to run in the small memory model of the internal memory ..\pcmaster\ldm_pROM-xRAM.pmp, uses Map file to run in the large memory model of the internal memory ..\pcmaster\sdm_xROM-xRAM.pmp, uses Map file to run in the small memory model of the internal memory ..\pcmaster\ldm_xROM-xRAM.pmp, uses Map file to run in the large memory model of the internal memory Start the PC master software window’s application, sdm_external_memory.pmp. Figure 1-3 illustrates the PC master software control window after this project has been launched. 4 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com MOTOROLA Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Specifications Figure 1-3. PC Master Software Control Window MOTOROLA 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com 5 Freescale Semiconductor, Inc. Hardware Set-up 2. Hardware Set-up 2.1 The Motor Freescale Semiconductor, Inc... The default hardware and software configuration is set up to support a BLDC motor with one wiring hole. Since there are two motor types that are in the field, please check to see if your BLDC motor has a single wiring hole in the motor housing from which the power stage and Hall Sensor connections are located (See motor photos in Figure 2-1). When using a BLDC motor with two wiring holes, it is necessary to turn over the yellow power stage connector from the position shown in Figure 2-2 (left picture) to inverted connection (right picture in Figure 2-2). Figure 2-1. Possible motor types Figure 2-2. Default (left picture) and inverted connections of the motor cable 6 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com MOTOROLA Freescale Semiconductor, Inc. Hardware Set-up 2.2 Application Hardware Setup Freescale Semiconductor, Inc... Figure 2-1 illustrates the hardware set-up for the BLDC Motor Control Application with Quadrature Encoder. Figure 2-3. Set-up of the BLDC Motor Control Application For detailed information, see the 56F8346 Evaluation Module Hardware Reference Manual. The serial cable is needed for the PC master software debugging tool only. 2.3 EVM Jumper Settings To Execute the BLDC Motor Control Application with Quadrature Encoder, the 56F8346 board requires the strap settings shown in Figure 2-4 and Table 2-1, and the 56F8346 Daughter Card requires the strap settings shown in Figure 2-5 and Table 2-2. MOTOROLA 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com 7 Freescale Semiconductor, Inc. Hardware Set-up JG1 JG11 JG5 JG2 1 1 4 3 JG6 3 J19 J18 J17 J14 JG15 JG11 J20 2 1 J5 J6 J9 J11 J10 PC0 PC1 PC2 PC3 PD6 PD7 3 JG5 J8 JG6 J7 JG10 DSP56F836EVM J2 PWMA0 PWMA1 PWMA2 PWMA3 PWMA4 PWMA5 JG16 J21 J16 J15 J1 S/N 1 3 U3 U2 U1 JG2 JG1 JG9 JG15 JG10 Y1 JG12 JTAG JG16 J12 3 1 JG7 JG14 JG13 JG9 J3 J13 JG3 JG4 U11 U10 U4 P2 Freescale Semiconductor, Inc... JG12 S3 S2 S1 RESET IRQA IRQB LED3 P1 P3 4 2 JG7 1 JG13 2 JG4 JG14 JG3 Figure 2-4. 56F8346EVM Jumper Reference Table 2-1. 56F8346EVM Jumper Settings Jumper Group 8 Comment Connections JG1 Use on-board EXTAL crystal input for CPU oscillator 1-2 JG2 Use on-board XTAL crystal input for CPU oscillator 1-2 JG3 Enable Internal Boot Mode 1-2 JG4 Enable A0 - A19 for external memory accesses NC JG5 Enable SRAM Memory Bank 0 (use CS0) 1-2 JG6 Enable SRAM Memory Bank 1 (use CS1 & CS2) JG7 Enable RS-232 Disable NC JG8 SPI #0 Daisy Chain (Optional--not populated on board by default) NC JG9 Enable on-board Parallel JTAG Host/Target Interface NC JG10 Connect Analog Ground to Digital Ground NC JG11 CAN termination selected 1-2 JG12 Pass RXD0 & TXD0 to RS-232 level converter JG13 Enable Crystal Mode 1-2 JG14 Pass Temperature Diode to ANA7 1-2 JG15 User Jumper #0 1-2 JG16 User Jumper #1 1-2 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com 1-2, 3-4 1-2, 3-4 MOTOROLA Freescale Semiconductor, Inc. Hardware Set-up Freescale Semiconductor, Inc... Note: When running the EVM target system in a stand-alone mode from Flash, the JG9 jumper must be set in the 1-2 configuration to disable the command converter parallel port interface. Figure 2-5. 56F8346EVM - Daughter Card Jumper Reference Table 2-2. 56F8346EVM Daughter Card Jumper Settings Jumper Group Comment Connections JG1 Primary PFC JG2 Secondary PFC NC JG3 Phase_IS / Over_I 1-2 JG4 Primary Zero-Crossing / Encoder 2-3, 5-6, 8-9 JG5 Secondary Zero-Crossing / Encoder 2-3, 5-6, 8-9 JG6 Primary Back-EMF / Phase-IS 1-2, 4-5, 7-8 JG7 Secondary Back-EMF / Phase-IS 1-2, 4-5, 7-8 JG8 Fault A Monitor 1-2, 3-4, 5-6 JG9 Fault B Monitor 1-2, 3-4, 5-6 JG10 Switch 1 1-2 JG11 Switch 2 1-2 JG12 Switch 3 (Run / Stop) 1-2 MOTOROLA 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com 1-2, 3-4, 5-6, 7-8, 9-10 9 Freescale Semiconductor, Inc. Build 3. Build Freescale Semiconductor, Inc... When building the BLDC Motor Control Application with Quadrature Encoder, the user can create an application that runs from internal Flash or External RAM. To select the type of application to build, open the bldc_encoder.mcp project and choose the target build type; see Figure 3-1. Selecting Build All will build all application build types. A definition of the projects associated with these target build types may be viewed under the Targets tab of the project window. Figure 3-1. Target Build Selection The project may now be built by executing the Make command, as shown in Figure 3-2. This will build and link the BLDC Motor Control Application with Quadrature Encoder and all needed Metrowerks and Processor Expert libraries. Figure 3-2. Execute Make Command 10 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com MOTOROLA Freescale Semiconductor, Inc. Execute For more information about these commands, see: <...>\CodeWarrior Manuals\PDF\Targeting_56800E.pdf 4. Execute To execute the BLDC Motor Control Application with Quadrature Encoder, select the Project\Debug command in the CodeWarrior IDE, followed by the Run command. For more help with these commands, refer to the CodeWarrior tutorial documentation in the following file, located in the CodeWarrior installation directory: <...>\CodeWarrior Manuals\PDF\Targeting_56800E.pdf Freescale Semiconductor, Inc... If the Flash target is selected, CodeWarrior will automatically program the device’s internal Flash with the executable generated during Build. If the External RAM target is selected, the executable will be loaded to off-chip RAM. Once Flash has been programmed with the executable, the EVM target system may be run in a stand-alone mode from Flash. To do this, set jumper JG9 to disable the JTAG port and JG3 to enable boot from internal Flash, then push the RESET button. Once the application is running, move the RUN/STOP switch to the RUN position, and set the required speed with the UP/DOWN push buttons. Pressing the UP/DOWN buttons should incrementally increase the motor speed until it reaches maximum speed. If successful, the BLDC motor will be spinning. Note: If the RUN/STOP switch is set to the RUN position when the application starts, toggle the RUN/STOP switch between the STOP and RUN positions to enable motor spinning. This is a protection feature that prevents the motor from starting when the application is executed from CodeWarrior. You should also see a lighted green LED, which indicates that the application is running. If the application is stopped, the green LED will blink with a 2Hz frequency. If an Undervoltage fault occurs, the green LED will blink at a frequency of 8Hz. MOTOROLA 3-Phase BLDC Motor Control with Quadrature Encoder For More Information On This Product, Go to: www.freescale.com 11 Freescale Semiconductor, Inc. HOW TO REACH US: USA/EUROPE/LOCATIONS NOT LISTED: Motorola Literature Distribution; P.O. Box 5405, Denver, Colorado 80217 1-303-675-2140 or 1-800-441-2447 JAPAN: Motorola Japan Ltd.; SPS, Technical Information Center, 3-20-1, Minami-Azabu Minato-ku, Tokyo 106-8573 Japan 81-3-3440-3569 Freescale Semiconductor, Inc... ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre, 2 Dai King Street, Tai Po Industrial Estate, Tai Po, N.T., Hong Kong 852-26668334 TECHNICAL INFORMATION CENTER: 1-800-521-6274 Information in this document is provided solely to enable system and software implementers to use Motorola products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume any HOME PAGE: http://motorola.com/semiconductors liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters which may be provided in Motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals” must be validated for each customer application by customer’s technical experts. Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part. Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark Office. digital dna is a trademark of Motorola, Inc. This product incorporates SuperFlash® technology licensed from SST. All other product or service names are the property of their respective owners. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2003 8346BLDCQETD/D For More Information On This Product, Go to: www.freescale.com