ETC 832XBLDCQETD

56F832x BLDC Motor Control Application
with Quadrature Encoder using Processor ExpertTM
Targeting Document
56F8300
16-bit Hybrid Controllers
832xBLDCQETD
Rev. 0
09/2004
freescale.com
Document Revision History
Version History
Rev 0
Description of Change
Initial release
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
2
Freescale Semiconductor
Preliminary
BLDC Motor Control Application with
Quadrature Encoder
This application exercises simple control of the BLDC motor with the Quadrature Encoder on the
56F8323EVMboard and the EVM Motor Kit.
Applications developed for this demonstration board were not designed for the 56F8100 devices. The
56F8300 demonstration board does, however, fully support 56F8100 software development.
1.
Specifications
This application performs simple control of the BLDC motor with the Quadrature Encoder and closed-loop
speed control on a 56F8322 or 56F8323 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:
•
Internal Flash
The BLDC Motor Control Application with Quadrature Encoder can operate in either of two modes; this
EVM does not support both modes at the same time.
1. Manual Operating Mode
The drive is controlled by the RUN/STOP switch (S3). The motor speed is set by the UP (S1) and DOWN
(S2) push buttons; see Figure 1-1. If the application runs and motor spinning is disabled (i.e., the system is
ready), the USER LED (LED18, shown in Figure 1-2) will blink. When motor spinning is enabled, the
USER LED is on. Refer to Table 1-1 for application states.
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
3
UP / DOWN
Buttons
RUN / STOP
Switch
Figure 1-1 RUN/STOP Switch and UP/DOWN Buttons on the Daughter Card
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
4
Freescale Semiconductor
Preliminary
User LEDs
Yellow
Green
PWM Output
LEDs
Red Status
LED
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
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
5
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:
•
•
•
•
•
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:
..\PC_Master\sdm_pROM-xRAM PCMaster.pmp, which uses the Map file to run in the small memory
model of the internal flash memory
..\PC_Master\sdm_xROM-xRAM PCMaster.pmp, which uses the Map file to run in the small memory
model of the internal flash memory
Start the PC master software window’s application, sdm_pROM-xRAM PCMaster.pmp. Figure 1-3
illustrates the PC master software control window after this project has been launched.
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
6
Freescale Semiconductor
Preliminary
The Motor
Figure 1-3 PC Master Software Control Window
2.
Hardware Set-up
2.1 The Motor
The default hardware and software configuration is set up to support a BLDC motor with one wiring hole.
Since there are two available motor types, 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 photo) to the
inverted connection (right photo in Figure 2-2).
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
7
Figure 2-1 Possible Motor Types
Figure 2-2 Default (left picture) and Inverted (right picture) Motor Cable Connections
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
8
Freescale Semiconductor
Preliminary
Application Hardware Setup
2.2 Application Hardware Setup
Figure 2-3 illustrates the hardware set-up for the BLDC Motor Control Application with Quadrature
Encoder.
BLDC Motor
Encoder Connector
Power Motor
Connector
EVM Motor Board
Controller Board
Power Supply
Serial Cable to PC
Parallel Cable to PC
Figure 2-3 Set-up of the BLDC Motor Control Application
For detailed information, see the 56F8323 Evaluation Module Hardware User’s Manual. The serial
cable is needed for the PC master software debugging tool only.
2.3 EVM Jumper Settings
For jumper settings, see the 56F8323 Evaluation Module Hardware User’s Manual.
To execute the BLDC Motor Control Application with Quadrature Encoder, the 56F8300 Daughter Card
requires the strap settings shown in Figure 2-4 and Table 2-1.
Note: When running the EVM target system in a stand-alone mode from Flash, the JG3 jumper on the
56F8323EVM must be set in the 1-2 configuration to disable the command converter parallel port
interface.
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
9
Figure 2-4 56F8300EVM - Daughter Card Jumper Reference
Table 2-1 56F8300EVM Daughter Card Jumper Settings
Jumper Group
JG1
Comment
Primary PFC
Connections
1-2, 3-4, 9-10
5-6 and 7-8 should
NOT be jumpered
JG2
Secondary PFC
NC
JG3
Phase_IS / Over_I
1-2
JG4
Primary Zero-Crossing / Encoder
NC
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
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
10
Freescale Semiconductor
Preliminary
EVM Jumper Settings
3.
Build
When building the BLDC Motor Control Application with Quadrature Encoder, the user creates an
application that runs from internal Flash. The application will run with either PC master software control
or with the on-board switches controlling the motor speed. To select the type of application to build, open
the bldc_encoder.mcp project and choose the target build type; see Figure 3-1. A definition of the projects
associated with these target build types may be viewed under the Targets tab of the project window.
Note:
It is not possible for the 8323EVM to control the BLDC motor speed with both the switches and the
PC master software in the same project. The signal used to sense SW2 on the LMDC board is the same
signal that handles the SCI TXD1 communication.
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.
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
11
Figure 3-2 Execute Make Command
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
CodeWarrior will automatically program the device’s internal Flash with the executable generated during
Build.
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 on the 56F8323EVM, set jumper JG3 to disable the JTAG port, 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.
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
12
Freescale Semiconductor
Preliminary
EVM Jumper Settings
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 red LED (labled FAULT B2), which indicates that the application is running.
If the application is stopped, the red LED will blink at a 2Hz frequency. If an Undervoltage fault occurs,
the red LED will blink at a frequency of 8Hz.
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
13
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
14
Freescale Semiconductor
Preliminary
EVM Jumper Settings
56F832x BLDC Motor Control with Quadrature Encoder, Rev. 0
Freescale Semiconductor
Preliminary
15
How to Reach Us:
USA/Europe/Locations Not Listed:
Freescale Semiconductor Literature Distribution Center
P.O. Box 5405
Denver, Colorado 80217
1-800-521-6274 or 480-768-2130
Japan:
Freescale Semiconductor Japan Ltd.
Technical Information Center
3-20-1, Minami-Azabu, Minato-ku
Tokyo 106-8573, Japan
81-3-3440-3569
Asia/Pacific:
Freescale Semiconductor Hong Kong Ltd.
2 Dai King Street
Tai Po Industrial Estate
Tai Po, N.T., Hong Kong
852-26668334
Home Page:
www.freescale.com
Information in this document is provided solely to enable system and software implementers to use Freescale
Semiconductor 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.
Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale
Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular
purpose, nor does Freescale Semiconductor assume any 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 that may be provided in Freescale Semiconductor 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. Freescale Semiconductor does not convey any
license under its patent rights nor the rights of others. Freescale Semiconductor 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 Freescale Semiconductor product could create
a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for
any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor 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 Freescale Semiconductor was negligent regarding the
design or manufacture of the part.
Learn More: For more information about Freescale products, please visit www.freescale.com
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names
are the property of their respective owners.
© Freescale Semiconductor, Inc. 2004
832xBLDCQETD
Rev. 0
09/2004