background image

Control Loop

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

Freescale Semiconductor

17

Figure 3-2. Firmware Control Loop

START

TargetPWMPeriod = Longest
ActualPWMPeriod = Longest

Drive L1

De-energized coils = DeadTime

Drive L2

Read Temp. Sensor

Read Temp. Sensor

128ms?

Update TargetPWMPeriod

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 128ms based on temperature

Hall
Edge?

Y

N

Energize L1 / L2

De-energize Coils

Timeout?

De-energize Coils

Sound Buzzer

N

Y

Fault
condition
detected.

Continuously monitor the hall sensor output

reading

Start Timer

Stop Timer

Record DriveTime

ActualPWMPeriod =
Dri DeadTime

Decrement DeadTime

Содержание RS08

Страница 1: ...RS08 Microcontrollers freescale com DRM079 Rev 0 5 2006 Designer Reference Manual Variable Speed DC Fan Control using the MC9RS08KA2...

Страница 2: ......

Страница 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...

Страница 4: ...Revision History Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 4 Freescale Semiconductor...

Страница 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...

Страница 6: ...Table of Contents Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 6 Freescale Semiconductor...

Страница 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...

Страница 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...

Страница 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...

Страница 10: ...Introduction Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 10 Freescale Semiconductor...

Страница 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...

Страница 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...

Страница 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...

Страница 14: ...Motor Control Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 14 Freescale Semiconductor...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 22: ...Implementation Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 22 Freescale Semiconductor...

Страница 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...

Страница 24: ...Implementation Variable Speed DC Fan Control using the MC9RS08KA2 Rev 0 24 Freescale Semiconductor...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 33: ......

Страница 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...

Отзывы: