Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
AN022802-0708
12V DC
H-bridge BLDC
FAN
GND
Hall Sensor
PWM
Comparator
Generator
Hall Sensor
3.3 V Edge Input
Generator Z8 Encore! XP Detection
Microcontroller
AN022802-0708 Page 2 of 8
Z8 Encore! XP® Based BLDC Fan Control Reference Design
The register gets locked on successful completion The init_adc function initializes port A pin 4 as
of a register write to the OSCCTL. an ADC channel. The input voltage is applied at
this pin. The speed of the fan is controlled based on
the input voltage applied at this pin.
Software Details
The software offered with this application note is The init_pwm function initializes port A pin 1 to
developed and tested on the hardware as per the generate the PWM output of different duty cycle.
schematic provided in Appendix B—Schematic This sets TIMER0 to work in PWM mode.
Diagram on page 7. This section discusses the
function of different software blocks used to Speed Command Input
control the BLDC fan.
A potentiometer is used to generate different volt-
ages, through a voltage divider network at the
The software provides the following
ADC input channel. The speed_in function peri-
functionalities:
odically reads the ADC data register. These ADC
data register values are scaled and loaded to the
• Initializing the Z8 Encore! XP® Peripheral PWM data register to generate PWM output of dif-
• Speed Command Input ferent duty cycles. This function is called from the
while loop of the main function so as to read the
• Measuring the Speed ADC value and to change the PWM output, which
• Hall Sensor Input Detection and Commutation in turn changes the fan speed.
• Motor Stall Detection
Measuring the Speed
• Over Current Detection
The on-chip ADC of Z8 Encore! XP is used in this
Initializing the Z8 Encore! XP® Peripheral application. An internal reference of 2 V is used as
Port A pin 0 and pin 2 are initialized as GPIO a reference voltage for analog to digital conver-
ports. These pins are used to commutate the two sion. This conversion happens on continuous basis.
different windings of the BLDC fan by driving an The main function calls speed_in routine that
FET. reads the converted data from ADC data register.
The ADC is configured for buffered, single-ended
mode.
The init_com function initializes for port A pin
0 and pin 2 . These port pins are also used for
enabling the high drive feature and as open drain Hall Sensor Input Detection and
outputs. Commutation
Commutation is achieved using two MCU pins:
The init_tach function initializes the port Port A pin2 and pin4 of the Z8 Encore! XP 8-pin
A pin 3 to input mode. The tachometer input from microcontroller. These outputs are either high or
the BLDC fan is fed to this pin and the software low depending on the commutation timings. The
detects the rising and falling edge of the Hall sensor input signal is applied to pin PA3,
tachometer input. which is configured as an input port. The software
detects the rising or falling edge (to detect the state
The init_comp function initializes port A pin 5 changes) of the Hall sensor inputs and accordingly
as input pin to be used as a comparator input. the commutation is done for the fan motor
windings.
AN022802-0708 Page 3 of 8
Z8 Encore! XP® Based BLDC Fan Control Reference Design
The software checks for the rising and falling Equipments Used
edges of the Hall sensor and decides the logical
The following equipments are used for testing:
state of the sensor input. If the Hall sensor input is
logic High, the Commutation state is set to 1 else
the Commutation state is set to 0. The function • H-bridge BLDC fan controller reference design
commutation_a or the function board Zilog PCA:99C0967
commutation_b is activated based on the Hall • Zilog Developer Studio II - Z8 Encore! XP (ZDS
sensor input state. Calling the commutation_a II - IDE)
function commutates one winding of the BLDC fan
• 12 V Vdc 3A power supply
and commutation_b commutates the other
winding of the BLDC fan. • Digital tachometer
Test Procedure
Motor Stall Detection
The H-bridge fan control reference design board is
If no Hall sensor edge is detected for a period of shown in Appendix B—Schematic Diagram on
300 ms, the firmware assumes that the motor is page 7. Supply 12 V DC power to the board and
locked and stops commutating the motor for about observe the speed of the motor by varying the
100 µs. Then after every 300 ms, the firmware tries potentiometer.
to commutate the windings until the locked rotor
comes back to normal or the power is switched off.
Test Results
Over Current Detection You can observe that by changing the position of
the potentiometer settings, the voltage at the ADC
When the motor comes to a stall condition, the input pin changes and accordingly the speed of the
BLDC fan motor draws a very high current. The fan is varied. The graph of fan speed verses the
resultant voltage in the circuit is fed to ISENCE PWM duty cycle is presented below.
input (Port A pin 5). This input voltage is com-
pared with the set voltage (200 mv) using the on-
chip comparator of Z8 Encore! XP® microcontrol-
ler. When the input voltage exceeds the reference
voltage, the comparator generates an interrupt. The
comp_intrp interrupt service routine turns off
the PWM generation from port A pin1 for about
100 us.
AN022802-0708 Page 4 of 8
Z8 Encore! XP® Based BLDC Fan Control Reference Design
5000
4500 44564534
4361
4180
4000 4013
3799
3628
3500 3416
3196
Fan speed in RPM
3000 2998
2775
2500 2555
2290
2000 2031
1782
1500 1527
1245
1000
880
500 574
243
0 0
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 10
0
% PWM Duty Cycle
Summary
Z8 Encore! XP® 8-pin microcontroller consists of
all the required on-chip peripheral suitable for
speed control application of BLDC motors.
AN022802-0708 Page 5 of 8
Z8 Encore! XP® Based BLDC Fan Control Reference Design
AN022802-0708 Page 6 of 8
Z8 Encore! XP® Based BLDC Fan Control Reference Design
G ND
J1
2
D1
3
1 12V 2 1
D P WR JACK D
2
B340LA-13 C7 R1 R3 C8
D2
1
3300pF 680 680 3300pF
1N4148
3
DZ1 V DD
1 1
1
SMAJ7.5A C6 Q1 Q2
2
1uF 50V FDD5614P R14
R11 FDD5614P R4 4.99K
2
220 R2 510
510
1
1
DZ2
V CC
SMAJ7.5A
1
2 SPEED_CMD
C5 R22
2
R5 100 Q7 W1 W2 Q8 R6 100 5K
R12 1uF COMA 2 2N7002 2N7002 2 COMB_PWM1 C9
75
3
0.1uF
3
V CC V CC
1
2
PWM0 PWM0
V DD
C C
R16 R17
J2
2
C3 1.0k 1.0k
1
3
R9 2.0K
ISENSE
DBG
INTERFACE
C1
R19 J6
0.01uF 0.15 V CC V DD nRST
1 2 D BG
G ND 3 4
R18 5 6
1.0k Header 3x2
PWM0
B B
HALL
V DD
V CC
SENSOR
U2 INTERFACE
R15 V DD 1 8 VSS R25
10k VDD VSS 10k
J5
C4 COMA 2 7 ISENSE
PA0/DBG PA5/CINP TACH 1
D BG 0.1uF 2
PWM0 SPEED_CMD 3
3 PA1/T0OUT PA4/ANA1 6
con_3
COMB_PWM1 4 5 TACH
PA2/RESET PA3/T1IN
R23 0
Z8F04xA
A A
R26 0
nRST
Title
ZiLOG H Bridge Fan Controller
As used herein
Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b)
support or sustain life and whose failure to perform when properly used in accordance with instructions for
use provided in the labeling can be reasonably expected to result in a significant injury to the user. A
critical component is any component in a life support device or system whose failure to perform can be
reasonably expected to cause the failure of the life support device or system or to affect its safety or
effectiveness.
Document Disclaimer
©2008 by Zilog, Inc. All rights reserved. Information in this publication concerning the devices,
applications, or technology described is intended to suggest possible uses and may be superseded. ZILOG,
INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY
OF THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT.
Z I L O G A L S O D O E S N O T A S S U M E L I A B I L I T Y F O R I N T E L L E C T U A L P R O P E RT Y
INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR
TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this
document has been verified according to the general principles of electrical and mechanical engineering.
Z8 Encore! XP is a registered trademark of Zilog, Inc. All other product or service names are the property
of their respective owners.
AN022802-0708 Page 8 of 8
8