mcrp03: brushless dc motor control reference platform...
TRANSCRIPT
APPLICATION NOTE
REG05B0049-0100/Rev.1.00 March 2009 Page 1 of 44
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform using Hall sensors
Introduction
This application note shows how to use the R8C/11's output compare function of Timer C. It shows a sample application of how to implement sensored driving of a BLDC motor that makes use of three hall-sensors positioned at 120 electrical degrees. This example applies to MCUs in the R8C/11 – R8C/13 Group and is based on the Renesas R8C/Tiny Motor Control Reference Platform MCRP03.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 2 of 44
Contents
MCRP03: BRUSHLESS DC MOTOR CONTROL REFERENCE PLATFORM USING HALL SENSORS. 1
INTRODUCTION .......................................................................................................................................... 1
CONTENTS .................................................................................................................................................. 2
HARDWARE SPECIFICATIONS:................................................................................................................ 3
CONTROL METHODS................................................................................................................................. 4
SYSTEM CONFIGURATION / CONTROL BLOCK DIAGRAM: ................................................................. 5
SOFTWARE SPECIFICATIONS:................................................................................................................. 6
LIST AND BRIEF DESCRIPTION OF THE SOFTWARE MODULES IN “VOLTAGE MODE”.................. 8
PWM IN “VOLTAGE MODE”: ................................................................................................................... 10
LIST AND BRIEF DESCRIPTION OF THE SOFTWARE MODULES IN “CURRENT MODE”................ 11
PWM IN “CURRENT MODE”: ................................................................................................................... 13
1. HOW TO OUTPUT WAVEFORMS FOR 120-DEGREE COMMUTATION ........................................... 14
1A. SPEED CONTROL IN “VOLTAGE MODE” ....................................................................................... 14
1B. MOTOR CURRENT CONTROL IN “VOLTAGE MODE”.................................................................... 14
2A. SPEED CONTROL IN “CURRENT MODE” ....................................................................................... 14
2B. MOTOR CURRENT CONTROL IN “CURRENT MODE” ................................................................... 14
DETERMINING THE OUTPUT PATTERN (VOLTAGE AND CURRENT MODE) .................................... 15
MCRP 03 BASIC DESCRIPTION. ............................................................................................................. 33
USER INTERFACE BOARD BASIC DESCRIPTION................................................................................ 33
USER INTERFACE BOARD BASIC DESCRIPTION................................................................................ 34
R8C CPU BOARD...................................................................................................................................... 35
HALL SENSORS CONNECTION. ............................................................................................................. 35
HALL SENSORS CONNECTION. ............................................................................................................. 36
HALL SENSORS/SENSORLESS TUNING PROCEDURE....................................................................... 37
OSCILLOSCOPE EVALUATION TESTS. ................................................................................................. 39
MEASUREMENT EXAMPLES................................................................................................................... 40
PHASE CURRENT SHUNT IN CASE OF VOLTAGE MODE............................................................................ 40
PHASE CURRENT SHUNT IN CURRENT MODE. ........................................................................................ 41
PROTECTION SHUNT RESISTOR CURRENT READING............................................................................... 42
WEBSITE AND SUPPORT ........................................................................................................................ 43
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 3 of 44
Hardware Specifications: Motor: Surface-mounted permanent magnet synchronous motor (SPMSM)
- Model: MB057GA240 or MB057GA140 (EXMEK) - Number of poles: 4 (2 pairs)
Power Stage Board (DIP-IPM): - Model: PS21564/PS21563 - Rating: 600 V, 15 A / 600V, 5A - Connection: Three-phase inverter
CPU Board: - Microcontroller: R8C/11 – R8C/13
Power supply: - Model: AP70 - Input voltage: 85 to 265 V AC - Output voltage: 15 to 24 Vdc - Output power: 70 W
Fig. 1: Hardware Configuration
BLDC Motor
Power Stage
Board
Interface
Board
CPU
Board
Sensor/Sensor-less
Board
24 Volt DC
Power Supply BEMF – Detection Lines
HALL Sensors User Interface Board
Serial Interface (RS232)
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 4 of 44
Control methods. There have been used two methods to drive the motor; the first named “voltage mode” and the second named “current mode”. In the first one, the high side of the IGBTs are driven with PWM commands and the speed is proportional to the duty cycle. The current limitation is performed via software by reading the dc current (see fig.1a and fig.5) and reducing the PWM duty to an appropriate value. In the second one, the PWM is used to set a reference current (see fig.1a); all the IGBTs are driven ON with dc commands and refreshed every 62.5μs software interrupt, but when the current reaches the reference value settled via PWM, the output of the amplifier goes low and an interrupt is generated. The high side IGBTs are driven OFF until the next 62.5μs software interrupt is generated.
V
dc current Op amp
Comparator
Reference current (pwm)
to P1_2 pin (interrupt pin)
Fig.1a
to P07/AN0 pin (analog to digital converter pin)
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 5 of 44
System configuration / control block diagram: The block diagram of fig.2 shows the system operation. The speed set is entered via RS232 from the User Interface Board, then it is compared with the actual speed (calculated by counting the hall sensors edges) to feed the PI block. Output of speed PI is clamped by the “motor current limitation block” and the result is fed into the “output pattern settling block”, which turn on the IGBTs of the IPM to switch the current in the phases, according to the actual rotor position (calculated from the hall sensors configuration). Fig.2
+ -
PI speed control
Motor current limitation Output
pattern settling
DIP-IPM
SPMSM
Dc motor current
Hall sensors detection and speed calculation
actual speed
Speed reference input from RS232 User Interface
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 6 of 44
Software Specifications: Control method 120-degree commutation using trapezoidal waves
Rotor position detection Detected by hall-sensors detection
Carrier frequency 16 kHz
Forward rotation: 500 rpm to 2100 rpm Range of rotation speed control Reverse rotation: –500 rpm to –2100 rpm
Error detection The Fo signal (forced shut-down signal) of the IPM is input to the P04 pin of the MCU. Thus, if the Fo signal goes low, the three-phase output is forcibly stopped and the three-phase output pins are placed in the high-impedance state.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 7 of 44
Outline in VOLTAGE MODE: The RS232 connection with the User Interface Board is used to receive the rotation-speed command. At power-up the microcontroller starts to receive command from User Interface Board. If a set speed is received the microcontroller outputs the pattern accordingly to the state of hall-sensors signal. The PWM duty cycle is calculated from the actual speed of rotation and the rotation speed reference, using a PI algorithm; PWM is used only with the high side IGBTs. The PWM duty cycle is clamped to limit the motor current to its rated value. Switching of the output pattern is made every edge of the hall-sensors signal (6 times every electrical time period). The actual rotation speed is calculated by counting the edges of the hall-sensors signal. Outline in CURRENT MODE: The RS232 connection with the User Interface Board is used to receive the rotation-speed command. At power-up the microcontroller starts to receive command from User Interface Board. If a set speed is received the microcontroller outputs the pattern accordingly to the state of hall-sensors signal. The reference current is calculated from the actual speed of rotation and the rotation speed reference, using a PI algorithm; a reference current PWM signal is generated. Every time the motor current exceeds the reference value, a interrupt is generated and the high side IGBTs are driven OFF until the next 62.5μs software interrupt is generated (see fig. 1a). Switching of the output pattern is made every edge of the hall-sensors signal (6 times every electrical time period). The actual rotation speed is calculated by counting the edges of the hall-sensors signal.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 8 of 44
List and brief description of the software modules in “VOLTAGE MODE” HWSETUP: this module performs all the I/O port settings and the SFR settings. INITCOM: this module performs the serial communication setup (UART, 9600baud, N81, internal clock). SET_TIMER_C: this module perform the timer C setup in order to generate a periodic interrupt every (1250*50)ns=62.5μs. Every interrupt, “Cmp1_int” is executed. START_TIMER_C: this module performs the timer C start. Ges_Com: this module perform serial communication management slave routine: the slave is waiting for a command (reception mode); when a serial command is received, the slave interprets it and eventually sends a reply. Ges_gen: this module performs:
- motor current filtering and load register for sending value via serial communication - speed calculation for visualization and load register for sending value via serial
communication - enabling first ON management when the motor stops - first on management: all low IGBT's ON for 1ms to charge the bootstrap
Ges_vb: this module performs the bus DC voltage management (reading, filtering and scaling) and load register for sending value via serial communication. Ges_ntc: this module performs the NTC management (temperature calculation using linear interpolation) and load register for sending value via serial communication. Ram_vel: this module performs acceleration and deceleration ramps; step increment is DELTAINC, and step decrement is DELTADEC. SpeedReg: this module performs speed calculation and PI speed regulation; the output of this module is the reference current. Cmp1_int: this module performs the main interrupt function every 62.5μs:
- ad conversion management: motor current, bus voltage and temperature sensor voltage
- motor current limitation - serial communication polling - main loop synchronization
sens_hall: this module performs the detection of the hall sensors configurations init_hall: this module performs the initial position calculation by using the hall sensors configurations
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 9 of 44
Int3_int: interrupt related to hall A rotor position sensor Int1_int: interrupt related to hall B rotor position sensor Int0_int: interrupt related to hall C rotor position sensor The fig. 3 shows the flow chart of the operations performed by the software. Fig. 3
- HWSETUP: hardware setup
- INITCOM: serial comm. setup
- SET_TIMER_C: timer C setup
- START_TIMER_C: start timer C
Reset
Main:
GesCom: serial communication handling
ges_gen: general routines
ges_vb: Vbus calculation
ges_ntc: temperature calculation
ram_vel: acceleration and decelaration ramps
SpeedReg: speed calculation and PI speed regulation
- ad conversion management
- serial communication polling
- motor current limiting
Cmp1_int:
int3_int, int0_int, int1_int:
- hall sensors related interrupt
62.5μs
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 10 of 44
PWM in “VOLTAGE MODE”: The PWM output is implemented by using the MCU's output compare mode of Timer C. In output compare mode, TM1 is used to control the carrier wave period and TM0 to control the PWM output. Settings of Timer C Output Compare Mode In this software, output compare mode of Timer C is configured as follows (see timerC related register settings in “hwsetup.c” source code). Item Description
Mode Output compare mode (The input capture mode is not used.)
P30 to P32 pin functions P30 (Up): The pin function is switched between port I/O andCMP output. P31 (Vp): The pin function is switched between port I/O andCMP output. P32 (Wp): The pin function is switched between port I/O andCMP output.
Interrupt Compare 1 interrupt (A compare 1 interrupt is generated oncompare-match of the TC register and TM1 register.)
Timer-counter source clock
Timer C: f1 (20 MHz)
Timer C reload selection The TC register is set to 0000h on a match of compare 1.
Compare 0 and 1 output mode selection
The CMP output is driven high on a match of compare 0. The CMP output is driven low on a match of compare 1.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 11 of 44
List and brief description of the software modules in “CURRENT MODE” HWSETUP: this module performs all the I/O port settings and the SFR settings. INITCOM: this module performs the serial communication setup (UART, 9600baud, N81, internal clock). SET_TIMER_C: this module perform the timer C setup in order to generate a periodic interrupt every (1250*50)ns=62.5μs. Every interrupt, “Cmp1_int” is executed. START_TIMER_C: this module performs the timer C start. Ges_Com: this module perform serial comunication management slave routine: the slave is waiting for a command (reception mode); when a serial comman is received, the slave interprets it and eventually sends a reply. Ges_gen: this module performs:
- motor current filtering and load register for sending value via serial communication - speed calculation for visualization and load register for sending value via serial
communication - enabling first ON management when the motor stops - first on management: all low IGBT's ON for 1ms to charge the bootstrap
Ges_vb: this module performs the bus DC voltage management (reading, filtering and scaling) and load register for sending value via serial communication. Ges_ntc: this module performs the NTC management (temperature calculation using linear interpolation) and load register for sending value via serial communication. Ram_vel: this module performs acceleration and deceleration ramps; step increment is DELTAINC, and step decrement is DELTADEC. SpeedReg: this module performs speed calculation and PI speed regulation; the output of this module is the reference current. Cmp1_int: this module performs the main interrupt function every 62.5μs:
- ad conversion management: motor current, bus voltage and temperature sensor voltage
- if the motor current don’t exceeds the reference current (i.e. the output of comparator is high (see fig.1a)), the IGBTs of the correct pattern are driven ON.
- load PWM duty register with the reference current calculated in “SpeedReg”, and output it to P1_0 pin. This signal is filtered and inputted to the pin + of comparator (see fig.1a)
- serial communication polling - main loop synchronization
sens_hall: this module performs the detection of the hall sensors configurations
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 12 of 44
init_hall: this module performs the initial position calculation by using the hall sensors configurations Int3_int: interrupt related to hall A rotor position sensor Int1_int: interrupt related to hall B rotor position sensor Int0_int: interrupt related to hall C rotor position sensor ki3_int: interrupt related to the negative edge of comparator (see fig.1a); the high side IGBTs are driven OFF The fig. 3 shows the flow chart of the operations performed by the software.
- HWSETUP: hardware setup
- INITCOM: serial comm. setup
- SET_TIMER_C: timer C setup
- START_TIMER_C: start timer C
Reset
Main:
GesCom: serial communication handling
ges_gen: general routines
ges_vb: Vbus calculation
ges_ntc: temperature calculation
ram_vel: acceleration and decelaration ramps
SpeedReg: speed calculation and PI speed regulation
- ad conversion management
-serial communication polling
- IGBTs of the correct pattern are driven ON
- load pwm duty register with the reference current
Cmp1_int:
int3_int, int0_int, int1_int:
- hall sensors related interrupt
62.5μs
ki3_int:
- negative edge of comparator related interrupt (see fig.1a); all igbt,s are driven OFF
Fig. 4
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 13 of 44
PWM in “CURRENT MODE”: The PWM output is implemented by using the MCU's output compare mode of Timer C. In output compare mode, TM1 is used to control the carrier wave period and TM0 to control the PWM output. Settings of Timer C Output Compare Mode In this software, output compare mode of Timer C is configured as follows (see timerC related register settings in “hwsetup.c” source code). Item Description
Mode Output compare mode (The input capture mode is not used.)
P10 pin functions P10 : The pin function is always CMP output.
Interrupt Compare 1 interrupt (A compare 1 interrupt is generated oncompare-match of the TC register and TM1 register.)
Timer-counter source clock
Timer C: f1 (20 MHz)
Timer C reload selection The TC register is set to 0000h on a match of compare 1.
Compare 0 and 1 output mode selection
The CMP output is driven high on a match of compare 0. The CMP output is driven low on a match of compare 1.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 14 of 44
1. How to Output Waveforms for 120-Degree Commutation Described below is an example of waveform output for 120-degree commutation that is implemented through the use of the Timer C function.
1a. Speed Control in “VOLTAGE MODE” In 120-degree commutation using trapezoidal waves, the speed of rotation is basically proportional to the voltage. To be specific, the active period of the output waveform is controlled by rewriting the TM0 setting each time the rotation speed command is changed, using a PI algorithm. Only the high side IGBTs are PWM controlled; the low side IGBTs are driven with dc commands. Only two IGBTs are ON at the same time: one high and one low according to the Output Pattern determined from the position obtained through the detection of hall-sensors signals. In this way only two phases are ON at the same time.
1b. Motor Current Control in “VOLTAGE MODE” The motor current is detected through one DC shunt and converted by the ad converter module. If the current exceeds the set value, then the duty cycle is reduced.
2a. Speed Control in “CURRENT MODE” In this case, the PWM is used to set a reference current calculated by a PI algorithm; all the IGBTs are driven ON with dc commands and refreshed every 62.5μs software interrupt, but when the current reaches the reference value settled via PWM, the output of the comparator goes low and an interrupt is generated (see fig.1a). The high side IGBTs are driven OFF until the next 62.5μs software interrupt. In this way the motor current (and then the voltage) will be the right value needed to get the reference speed. Only two IGBTs are ON at the same time: one high and one low according to the Output Pattern determined from the position obtained through the detection of hall-sensors signals. In this way only two phases are ON at the same time.
2b. Motor Current Control in “CURRENT MODE” The motor current is always under control like a hardware control. As soon as the current exceeds the set value, the IGBTs are driven OFF by the “ki3_int” interrupt routine. The system dynamics is very good.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 15 of 44
Determining the Output Pattern (VOLTAGE and CURRENT MODE) The output pattern (0 to 5) is determined from the position obtained through the detection of hall-sensors signals. The situation shown in fig. 6 and table 1 is related to ccw rotation. For ccw rotation the sequence of the patterns is from pattern5 to pattern0 and the current flows in accordance with the black arrows; for cw rotation (see fig. 6a and table 2), the sequence of the patterns is from pattern0 to pattern5 and the current flows in accordance with the black arrows. Note that in case of ccw direction, the edges of hall-sensors signals are to be inverted (for example, the positive edge of hall A sensor in cw direction, will be negative in ccw direction).
Q1
Q4 Vdc
Q3
Q6
Q5
Q2
Phase coils
W V U
I
Fig.5: IGBTs configuration
dc current
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 16 of 44
iV
iW
iU
Q5: pwm
Q3: pwm Q1: pwm
Q4: dc Q2: dc Q6: dc
Q5: pwm
W V U V V V V V W U W U W U W U W U
Software processing: int3_int, interrupt related to hall A signal
Software processing: int1_int, interrupt related to hall C signal
Software processing: int0_int, interrupt related to hall B signal
Pattern 0 Pattern 1 Pattern 2 Pattern 3 Pattern 4 Pattern 5
Ccw direction Motor current flows in cw direction:
Hall A signal
Hall B signal
Hall C signal
Fig.6: motor current flows and configuration of IGBTs in ccw direction; read the diagram from right to left.
0˚ 30˚ 60˚ 90˚ 120˚ 150˚ 180˚ 210˚ 240˚ 270˚ 300˚ 330˚ 360˚
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 17 of 44
iV
iW
iU
Q2:dc Q6: dc Q4: dc
Q1: pwm Q5: pwm Q3: pwm
Q2: dc
W V U V V V V V W U W U W U W U W U
Software processing: int3_int, interrupt related to hall A signal
Software processing: int1_int, interrupt related to hall C signal
Software processing: int0_int, interrupt related to hall B signal
Pattern 0 Pattern 1 Pattern 2 Pattern 3 Pattern 4 Pattern 5
Cw direction Motor current flows in cw direction:
Hall A signal
Hall B signal
Hall C signal
Fig.6a: motor current flows and configuration of IGBTs in cw direction; read the diagram from left to right.
0˚ 30˚ 60˚ 90˚ 120˚ 150˚ 180˚ 210˚ 240˚ 270˚ 300˚ 330˚ 360˚
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 18 of 44
Period of pattern (ccw direction)
Output pattern Comments
Pattern5 From positive edge of hall C signal to negative edge of hall A signal
Q5(high):PWM, Q4(low):dc Q1,Q2,Q3,Q6=OFF
Current flows from W to U
Pattern4 From negative edge of hall A signal to positive edge of hall C signal
Q3(high):PWM, Q4(low):dc Q1,Q2,Q5,Q6=OFF
Current flows from V to U
Pattern3 From positive edge of hall A signal to negative edge of hall B signal
Q3(high):PWM, Q2(low):dc Q1,Q4,Q5,Q6=OFF
Current flows from V to W
Pattern2 From negative edge of hall C signal to positive edge of hall A signal
Q1(high):PWM, Q2(low):dc Q3,Q4,Q5,Q6=OFF
Current flows from U to W
Pattern1 From positive edge of hall B signal to negative edge of hall C signal
Q1(high):PWM, Q6(low):dc Q2,Q3,Q4,Q5=OFF
Current flows from U to V
Pattern0 From negative edge of hall A signal to positive edge of hall B signal
Q5(high):PWM, Q6(low):dc Q1,Q2,Q3,Q4=OFF
Current flows from W to V
Tab. 1: pattern outputs in ccw direction (see fig.6)
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 19 of 44
Period of pattern (cw direction) Output pattern Comments
Pattern0 From positive edge of hall A signal to negative edge of hall C signal
Q3(high):PWM, Q2(low):dc Q1,Q4,Q5,Q6=OFF
Current flows from V to W
Pattern1 From negative edge of hall C signal to positive edge of hall B signal
Q3(high):PWM, Q4(low):dc Q1,Q2,Q5,Q6=OFF
Current flows from V to U
Pattern2 From positive edge of hall B signal to negative edge of hall A signal
Q5(high):PWM, Q4(low):dc Q1,Q2,Q3,Q6=OFF
Current flows from W to U
Pattern3 From negative edge of hall A signal to positive edge of hall C signal
Q5(high):PWM, Q6(low):dc Q1,Q2,Q3,Q4=OFF
Current flows from W to V
Pattern4 From positive edge of hall C signal to negative edge of hall B signal
Q1(high):PWM, Q6(low):dc Q2,Q3,Q4,Q5=OFF
Current flows from U to V
Pattern5 From negative edge of hall B signal to positive edge of hall A signal
Q1(high):PWM, Q2(low):dc Q3,Q4,Q5,Q6=OFF
Current flows from U to W
Tab. 2: pattern outputs in cw direction (see fig. 6a)
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 20 of 44
The figures 7, 8, 8a, 9, 10, 11, 12 and 13 shows the flow charts of the module involved in the motor control.
SpeedReg
Speed reference=0
y
n
Integral speed loop register=0;
mv int=0;
Actual speed calculation:
counts the edges of hall sensors signal every 1ms
Sum of the last 5 speed calculated and then multliplied by 256
IIR filtering (16 step filtering); the result is “speed_fil”
v_err=|speed_rif-speed_fil|;
Integral speed loop: mv_int=mv_int+k_i_v*v_err
Proportional speed loop: reg_aux=k_p_v*v_err
proportional + integral, scalingand clamping; the result is “i_rif”
return
Fig. 7: voltage and current mode
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 21 of 44
Cmp1_int
Ad conversion result management.
Motor current limitation:
if the current motor exceed the set value, then the pwm duty, “i_rif”, is decreased.
The result is “i_rif_out”.
Load the pwm duty register:
tm0=i_rif_out;
serial communication polling
main loop synchronization
Start the next ad conversion
return
Fig.8: voltage mode
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 22 of 44
Cmp1_int
Ad conversion result management.
Load the pwm duty register:
tm0=i_rif_out; enabling pwm output to P1_0 pin.
serial communication polling
main loop synchronization
Start the next ad conversion
return
Fig.8a: current mode
Output of comparator is low (p1_3=low)?
All high IGBTs driven OFF
n
y
Igbt configuration ON (according to the actual pattern)
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 23 of 44
Init_hall
all igbt's off
motor enabled
Hall sensors level detection
0 - 60deg position
cw ccw
Turn on LOW_W and HIGH_V IGBTs
Turn on LOW_V and HIGH_W IGBTs
break
all igbt's off
Turn on LOW_Uand HIGH_V IGBTs
Turn on LOW_V and HIGH_U IGBTs
60 - 120deg position
cw ccw
y
y
y
break break
break break
Fig. 9: voltage and current mode
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 24 of 44
120 - 180deg position
cw ccw
Turn on LOW_U and HIGH_W IGBTs
Turn on LOW_W and HIGH_U IGBTs
Turn on LOW_V and HIGH_W IGBTs
Turn on LOW_W and HIGH_V IGBTs
180 - 240deg position
cw ccw
break break
y
y
break break
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 25 of 44
240 - 300deg position
cw ccw
Turn on LOW_V and HIGH_U IGBTs
Turn on LOW_U and HIGH_V IGBTs
Turn on LOW_W and HIGH_U IGBTs
Turn on LOW_U and HIGH_W IGBTs
300 - 360deg position
cw ccw
break break
return
y
y
break break
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 26 of 44
0 - 60deg position
cw ccw
Turn on LOW_W and HIGH_V IGBTs, and count edges increment
Turn on LOW_V and HIGH_W IGBTs, and count edges increment
180 - 240deg position
cw ccw
break break
y
y
int3_int
Turn on LOW_V and HIGH_W IGBTs, and count edges increment
Turn on LOW_W and HIGH_V IGBTs, and count edges increment
- Off arms
- hall sensors level detection
break break
Fig. 10: voltage and current mode
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 27 of 44
300 - 360deg position
cw ccw
120 - 180deg position
cw ccw
break break
return
y
y
Turn on LOW_W and HIGH_U IGBTs, and count edges increment
Turn on LOW_U and HIGH_W IGBTs, and count edges increment
Turn on LOW_U and HIGH_W IGBTs, and count edges increment
Turn on LOW_W and HIGH_U IGBTs, and count edges increment
break break
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 28 of 44
120 - 180deg position
cw ccw
Turn on LOW_U and HIGH_W IGBTs, and count edges increment
Turn on LOW_W and HIGH_U IGBTs, and count edges increment
300 - 360deg position
cw ccw
break break
y
y
int0_int
Turn on LOW_W and HIGH_U IGBTs, and count edges increment
Turn on LOW_U and HIGH_W IGBTs, and count edges increment
- Off arms
- hall sensors level detection
break break
Fig.11: voltage and current mode
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 29 of 44
60 - 120deg position
cw ccw
240 - 300deg position
cw ccw
break break
return
y
y
Turn on LOW_U and HIGH_V IGBTs, and count edges increment
Turn on LOW_V and HIGH_U IGBTs, and count edges increment
Turn on LOW_V and HIGH_U IGBTs, and count edges increment
Turn on LOW_U and HIGH_V IGBTs, and count edges increment
break break
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 30 of 44
240 - 300deg position
cw ccw
Turn on LOW_V and HIGH_U IGBTs, and count edges increment
Turn on LOW_U and HIGH_V IGBTs, and count edges increment
60 - 120deg position
cw ccw
break break
y
y
int1_int
Turn on LOW_U and HIGH_V IGBTs, and count edges increment
Turn on LOW_V and HIGH_U IGBTs, and count edges increment
- Off arms
- hall sensors level detection
break break
Fig. 12: voltage and current mode
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 31 of 44
180 - 240deg position
cw ccw
0 - 60deg position
cw ccw
break break
return
y
y
Turn on LOW_V and HIGH_W IGBTs, and count edges increment
Turn on LOW_W and HIGH_V IGBTs, and count edges increment
Turn on LOW_W and HIGH_V IGBTs, and count edges increment
Turn on LOW_V and HIGH_W IGBTs, and count edges increment
rising edge selected
ySet rising edge
Set falling edge
break break
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 32 of 44
ki3_int
- Off all high IGBTs arms
Fig. 13: current mode
return
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 33 of 44
MCRP 03 Basic description.
High voltage power supply (up to 220Vac)
External PFC connection
Motor connection
Low voltage power supply (24 Vdc)
RS232
RS232
Hall sensors connection
Encoder connection
Tacho connection
E7/E8 interface
TM interface
User interface connection
DC Vbus
I/O connection
E7/E8 interface
DC Brushlessmotor
User interface board
Power board Direct interface board R8C based microcontroller board
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 34 of 44
User interface board basic description.
Stop key: pressing this key the motor stops.
Reverse speed key: pressing this key the motor starts to rotate in the opposite direction.
Display key: pressing this key the LCD shows alternatively the actual motor current, the actual bus dc voltage, the actual temperature (the sensor is placed on the power board).
Encoder 2: this is used to change the speed of the motor.
Stop key
Display key
Reverse speed
Encoder 1: Speed
gnd
gnd
gnd
gnd
Communication selection:
- this setting for
wired communication
Reset key
Encoder 2
Potentiometer 2 Potentiometer 1
analog input: 0÷10Vdc
analog input: 0÷10Vdc
analog output: 0÷3.3Vdc
analog output: 0÷3.3Vdc
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 35 of 44
R8C CPU Board.
Communication selection:
- this setting for wired communication
- the other setting for infrared communication
Feedback solution selection:- this setting for 3 hall-sensor solution - the other setting for sensorless solution (under development)
Reset key
Gnd
Rx
Tx PC
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 36 of 44
HALL Sensors connection.
Black-white: U
Yellow-white: V
Red-white: W
White: Hall-
Red: Hall sensors 5Vcc supply
Blu: Hall-WGreen: Hall-Black: Hall sensors GND
1.1.1.2 J3
1.1.1.1 J1
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 37 of 44
HALL Sensors/Sensorless tuning procedure.
Fig. 2tp
This picture shows how to place the oscilloscope probes to get exact connection of the motor and hall sensors cables into the demo-board.
The fig.3tp shows the relationship between the back-EMF of one phase and its hall sensor signal, by rotating the motor in cw direction (see fig.2tp). It is mandatory to couple one phase of the motor with its hall sensor and connect them in the exact sequence in the connector J35 and J12 (see fig.1: U motor phase with U hall sensor, V motor phase with V hall sensor and W motor phase with W hall sensor).
Furthermore the sequence of the motor phases (and then the sequence of the hall sensors) must be as in fig.4tp.
Three resistor (approx.
10K) star connected.
U-0 back-emf
voltage
Cw direction
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 38 of 44
Fig. 3tp.
Fig. 4tp: sequence of motor phases rotating the motor in cw direction.
- Relationship between hall-sensor signal and motor voltage (back-emf), rotating in cw direction (see fig.2)
- Yellow trace: hall sensor signal
Blue-light trace: back-emf
- This figure refers to U-0 voltage vs Hall-U sensor, or V-0 voltage vs Hall-V sensor, or W-0 voltage vs Hall-W sensor.
30 electrical deg delay
- Relationship between all the three phase motor voltage (back-efm), rotating in cw direction (see fig.2 )
- Yellow trace: back-emf of U motor phase
- Blue-light trace: back-emf of V motor phase
- Pink trace: back-emf of W motor phase
.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 39 of 44
Oscilloscope evaluation tests.
It is possible to download 2 different kind of software onto the CPU board:
1) Voltage mode.
2) Current mode.
Voltage mode is used when no load is applied to the motor shaft.
This mode allows the motor to be relatively silent even if no load is applied, it’s not a real application control method but it is nice to see in standard demonstration environments.
Current more has to be used in order to properly manage the motor in a real application when a standard load is applied.
It is not usable when no load is applied because, in this case, the motor current is so low that the current level read by the shunt is so low that is lower than the inverter noise so that the motor noise is quite annoying.
Here some possible waveform reading using a normal oscilloscope.
NOTE: This kind of measurements must not be made by not authorized and expert personnel in case high voltage is applied.
In case standard 24V DC power supply unit is applied the following measurement can be made without any particular care using a standard oscilloscope.
Pls. only remember that, in case of phase current reading only one shunt voltage can be read at the same time because all the shunt voltage grounds do not match.
Wrong ground connection could damage both the oscilloscope and/or the MCRP hardware. The most important measurement points are the 2 phase shunt. The phase shunts are the 2, parallel, black, big resistors close to the motor phases connector.
Another interesting measurement point is the protection shunt; it is the other resistor, similar to the previous 2, where you can read the motor global current.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 40 of 44
Measurement examples. Phase current shunt in case of voltage mode.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 41 of 44
Phase current shunt in current mode.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 42 of 44
Protection shunt resistor current reading.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 43 of 44
Website and Support Renesas Technology Website
http://www.renesas.com/ Inquiries
http://www.renesas.com/inquiry [email protected]
All trademarks and registered trademarks are the property of their respective owners.
R8C/11 MCRP03: Brushless DC Motor Control Reference Platform
using Hall sensors
REG05B0049-0100/Rev.1.00 March 2009 Page 44 of 44
1. This document is provided for reference purposes only so that Renesas customers may select the appropriate Renesas products for their use. Renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights or any other rights of Renesas or any third party with respect to the information in this document.
2. Renesas shall have no liability for damages or infringement of any intellectual property or other rights arising out of the use of any information in this document, including, but not limited to, product data, diagrams, charts, programs, algorithms, and application circuit examples.
3. You should not use the products or the technology described in this document for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. When exporting the products or technology described herein, you should follow the applicable export control laws and regulations, and procedures required by such laws and regulations.
4. All information included in this document such as product data, diagrams, charts, programs, algorithms, and application circuit examples, is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas products listed in this document, please confirm the latest product information with a Renesas sales office. Also, please pay regular and careful attention to additional and different information to be disclosed by Renesas such as that disclosed through our website. (http://www.renesas.com)
5. Renesas has used reasonable care in compiling the information included in this document, but Renesas assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document.
6. When using or otherwise relying on the information in this document, you should evaluate the information in light of the total system before deciding about the applicability of such information to the intended application. Renesas makes no representations, warranties or guaranties regarding the suitability of its products for any particular application and specifically disclaims any liability arising out of the application and use of the information in this document or Renesas products.
7. With the exception of products specified by Renesas as suitable for automobile applications, Renesas products are not designed, manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of human injury or which require especially high quality and reliability such as safety systems, or equipment or systems for transportation and traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication transmission. If you are considering the use of our products for such purposes, please contact a Renesas sales office beforehand. Renesas shall have no liability for damages arising out of the uses set forth above.
8. Notwithstanding the preceding paragraph, you should not use Renesas products for the purposes listed below: (1) artificial life support devices or systems (2) surgical implantations (3) healthcare intervention (e.g., excision, administration of medication, etc.) (4) any other purposes that pose a direct threat to human life Renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who
elect to use Renesas products in any of the foregoing applications shall indemnify and hold harmless Renesas Technology Corp., its affiliated companies and their officers, directors, and employees against any and all damages arising out of such applications.
9. You should use the products described herein within the range specified by Renesas, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas shall have no liability for malfunctions or damages arising out of the use of Renesas products beyond such specified ranges.
10. Although Renesas endeavors to improve the quality and reliability of its products, IC products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Please be sure to implement safety measures to guard against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other applicable measures. Among others, since the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you.
11. In case Renesas products listed in this document are detached from the products to which the Renesas products are attached or affixed, the risk of accident such as swallowing by infants and small children is very high. You should implement safety measures so that Renesas products may not be easily detached from your products. Renesas shall have no liability for damages arising out of such detachment.
12. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from Renesas.
13. Please contact a Renesas sales office if you have any questions regarding the information contained in this document, Renesas semiconductor products, or if you have any other inquiries.
Notes regarding these materials
© 2009. Renesas Technology Corp., All rights reserved.