background image

Variable Speed DC Fan Control using the MC9RS08KA2, Rev. 0

Freescale Semiconductor

5

Table of Contents

Chapter 1 

Introduction

1.1

Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7

1.2

Freescale’s New Generation Ultra Low Cost MCU  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8

1.3

DC Fan Reference Design Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.4

Bi-Phase BLDC Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  9

Chapter 2 

Motor Control

2.1

Commutation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  11

2.2

Rotor Position Control  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  11

2.3

Commutation Waveforms  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  12

2.4

Speed Control  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  12

2.5

Motor Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  13

2.6

Fault Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  13

Chapter 3 

Implementation

3.1

Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  15

3.2

Hardware Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  15

3.3

Control Loop  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  16

3.4

Temperature Sensor Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  18

3.4.1

Temperature Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Appendix A. 

Schematic

Appendix B. 

Program Listing

Summary of Contents for RS08

Page 1: ...RS08 Microcontrollers freescale com DRM079 Rev 0 5 2006 Designer Reference Manual Variable Speed DC Fan Control using the MC9RS08KA2...

Page 2: ......

Page 3: ...of our documents on the World Wide Web will be the most current Your printed copy may be an earlier revision To verify that you have the latest information available refer to http www freescale com Th...

Page 4: ...Revision History Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 4 Freescale Semiconductor...

Page 5: ...sign Targets 8 1 4 Bi Phase BLDC Motor 9 Chapter 2 Motor Control 2 1 Commutation 11 2 2 Rotor Position Control 11 2 3 Commutation Waveforms 12 2 4 Speed Control 12 2 5 Motor Startup 13 2 6 Fault Detec...

Page 6: ...Table of Contents Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 6 Freescale Semiconductor...

Page 7: ...es more and more sophisticated MCU approach provides a cost effective solution to this application There are several advantages of a MCU based design over traditional solutions 1 Instead of having a c...

Page 8: ...ccess RAM Allows emulation of HC08 HCS08 zero offset index addressing mode instructions Third generation Flash and RAM extremely fast byte writable programming 63 Byte RAM 2K Byte Flash Flexible clock...

Page 9: ...is commonly consist of a permanent magnet attached on the rotor and the stator phase coil windings are mounted on the motor shaft as illustrated in Figure 1 2 The BLDC has no brushes on the rotor and...

Page 10: ...Introduction Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 10 Freescale Semiconductor...

Page 11: ...grees or one motor phase One mechanical revolution is contributed by four commutation steps To avoid conflict to the magnetic field adjacent coils cannot be energized at the same time Dead time where...

Page 12: ...ation period could be considered as a pulse width modulation PWM output cycle The PWM period defines the motor speed in this case The coils energization time is in fact the PWM driving period which is...

Page 13: ...rgized at the same time there are equal pulling pushing force induced on the rotor in both directions There is chance for the rotor to startup in either direction It is necessary to monitor the initia...

Page 14: ...Motor Control Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 14 Freescale Semiconductor...

Page 15: ...rature sensor In the faulty situation such as motor jam the buzzer alarm is driven by the MCU through a pulse width modulated PWM output Figure 3 1 DC Fan Design Block Diagram 3 2 Hardware Resources I...

Page 16: ...arying the absolute dead time This is updated every 128ms in the application As in all RS08 S08 devices the MC9RS08KA2 MCU has a programmable real time interrupt RTI feature In this case it is used to...

Page 17: ...eriod Increment DeadTime Target Actual Target Actual De energized coils DeadTime N Y Y N N Y During the dead time delay update PWM period for the next commutation Modify Target PWM period value every...

Page 18: ...d the comparator is then enabled and the terminal turns to analog input voltage across C starts to ramp up The 8 bit internal modulo timer is used to monitor the time taken for the RC to charge to a l...

Page 19: ...et and Start Timer mov mACMPSC_ACME mACMPSC_ACIE ACMP_OUTPUT_RAISING ACMPSC Enable ACMP start RC rise bset ACMPSC_ACF ACMPSC Clear ACMP Flag wait brclr ACMPSC_ACF ACMPSC NoReading mov MTIMCNT SensorRe...

Page 20: ...ecific temperature range are also defined and shown in Table 3 3 EQ 3 2 shows how the target PWM period value is calculated The target value is compared with the measured PWM period every 180 degrees...

Page 21: ...Timer Counts 1 NOTES 1 The resolution of a timer count is 64 s 25 or below 10 2 86 1000 232 30 34 8 082 2 59 1200 193 35 39 6 577 2 34 1400 165 40 44 5 387 2 09 1600 144 45 49 4 441 1 86 1800 128 50...

Page 22: ...Implementation Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 22 Freescale Semiconductor...

Page 23: ...K4 PA1 K1 A PA0 K0 A 9RS08KA2DN U1 1 2 3 4 5 6 7 8 FMMT491A Q1 1 2 3 R7 1 2 1K5 FMMT491A Q2 1 2 3 R6 1 2 1K5 C4 1 2 2u2F 25V LL4148 D3 1 2 R9 1 2 7 5K 1 LL4148 D2 1 2 P1 1 2 BUZ1 1 2 0 1uF DC1 1 2 ZM...

Page 24: ...Implementation Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 24 Freescale Semiconductor...

Page 25: ...BI1 ACMP Temp sensor input PTA2 KBI2 TCLK RESETb VPP Hall input PTA3 ACMPO BKGD MS Buzzer PTA4 KBI4 PWM PTA5 KBI5 PWM include derivative specific macros XDEF Entry include MC9RS08KA2 inc ICS Definitio...

Page 26: ..._512MS equ 06 RTI_1024MS equ 07 Application Definition RC equ PTAD_PTAD0 mRC equ mPTAD_PTAD0 TEMPSEN equ PTAD_PTAD1 mTEMPSEN equ mPTAD_PTAD1 HALL equ PTAD_PTAD2 mHALL equ mPTAD_PTAD2 BUZZER equ PTAD_P...

Page 27: ...SEL mov MAP_ADDR_6 NV_FTRIM ICSSC 3FFB mov MAP_ADDR_6 NV_ICSTRM ICSTRM 3FFA mov ICS_DIV_2 ICSC2 Use 4MHz Config System mov HIGH_6_13 SOPT PAGESEL Init Page register mov mSOPT_COPT mSOPT_STOPE MAP_ADDR...

Page 28: ...for Delay 0 5s dbnza Dly1 clr PTAD de energize coils bsr Delay Drive L2 ldx mPWM2 Select L2 Coils bsr SetPWM Drive coil bsr Delay De energize coils inc MotorRunning otherwise Update Software flag Fan...

Page 29: ...same Fan speed reach target then exit DecPeriod if bigger decrement DeadTime lda DeadTime cmp MinDeadTime blo WaitAgain dec DeadTime bra WaitAgain IncPeriod if smaller increment DeadTime lda DeadTime...

Page 30: ...isconnect coil mov mKBISC_KBACK KBISC Clear Flag and mask interrupt mov mMTIMSC_TSTP mMTIMSC_TRST MTIMSC mask interrupt and clear flag rts Read Temperature Sensor Value Timer prescalar 8 Timer clk 250...

Page 31: ...Error Handling Stop the motor Sound the buzzer about 520Hz MotorHang clr PTAD clear PWMp and PWMn lda MotorRunning Check software flag bne SoundBuzzer 1 Motor is running jmp ResetPosition SoundBuzzer...

Page 32: ...MTIMSC_TRST MTIMSC mask interrupt and clear flag sta MAP_ADDR_6 SRS Bump COP dbnza Quiet bra SoundBuzzer Lookup Table org TableStart dc b 57 57 57 57 57 60 63 67 71 76 82 82 88 88 96 96 dc b 105 105 1...

Page 33: ......

Page 34: ...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 p...

Reviews: