You are on page 1of 240

Digital

Digital Signal
Signal Controller
Controller (DSC)
(DSC)

BLDC

2007 Microchip Technology Incorporated

Slide 1

Digital Signal Controller

WIB Agenda
O

Microchip

dsPIC DSC

dsPIC DSC

BLDC

2007 Microchip Technology Incorporated

Slide 2

Digital Signal Controller

WIB Agenda
LAB Sessions:
O Lab 1
: PICDEM MC LV Board (dsPIC DSC )
O Lab 2 Forced Commutation
: BLDC
O Lab 3 GPIO(OVDCON) BLDC
O Lab 4 MCPWM BLDC
O Lab 5 Closed-Loop (PID ) BLDC
O Lab 6 Sinusoidal BLDC
O Lab 7 Phase Advance BLDC
O Lab 8 Sensorless BLDC
Sensored Method : Lab 3/4/5/6/7
Sensorless Method : Lab 8
2007 Microchip Technology Incorporated

Slide 3

Digital Signal Controller

Overview
dsPIC DSC
O
O
O

Architecture
Motor Control Family
Motor Control

BLDC Motor Theory


O
O
O

Motor Theory
BLDC Motor
Position Sensing

2007 Microchip Technology Incorporated

Slide 4

Digital Signal Controller

Overview (continued)

BLDC :
O Forced
O
O

O Six
O
O

O Six

Commutation Operation ( )

What is Commutation?
Commutating a BLDC with no position feedback

Step Control (120 )


BLDC Position Sensing
Synchronizing Commutation with Position

Step Sensored Algorithm

2007 Microchip Technology Incorporated

Slide 5

Digital Signal Controller

Overview (continued)

BLDC :
O

Open Loop
O
O

MCPWM
Override Control

Closed Loop
O
O

DSP PID
BLDC Motor

2007 Microchip Technology Incorporated

Slide 6

Digital Signal Controller

Overview (continued)

BLDC :
O

Sinusoidal Control (180 )


O
O
O

Target Motors for Sinusoidal Control


Sinusoidal Voltage Generation
BLDC Commutation using Sinusoidal
Voltages

Phase Advance Commutation


O

Scheduling BLDC Motor Commutation

2007 Microchip Technology Incorporated

Slide 7

Digital Signal Controller

Overview (continued)
BLDC
O

Sensorless BLDC Motor Control


O
O
O
O
O
O

Why Sensorless?
BEMF Zero Crossing Detection Technique
Hardware Implementations for Detecting BEMF
Implementing Sensorless BLDC with dsPIC DSC
Introduction to SMTI for Tuning Parameters
Parameter Tuning Exercise using SMTI

2007 Microchip Technology Incorporated

Slide 8

Digital Signal Controller

Microchip
s Corporate
Microchips
Overview

2007 Microchip Technology Incorporated

Slide 9

Digital Signal Controller

Microchip
O

Leading semiconductor manufacturer:


O
O

O
O
O
O
O
O

of high-performance, field-programmable,
8-bit & 16-bit RISC Microcontrollers
of Analog & Interface products
of related Memory products
for high-volume embedded control applications

$850M in product sales

More than 4,200 employees


Headquartered near
Phoenix in Chandler, AZ
The Silicon Desert

O
O

2007 Microchip Technology Incorporated

Slide 10

Digital Signal Controller

Where Are We Today?

Sensors

Digital
Pot

Precision
Voltage
Reference

Amplifiers

Filters

Power

Serial NV
Memory

RF
Xmit/
receive

High
Voltage
I/Os

IR
Communications

Power
Drivers

A/D

Power
Management

Telecom
DTMF
Codec

Microcontrollers/
Digital Signal
Controllers

Motors
Relays
Print-heads

D/A

LCD
Drivers

SRAM

Xceivers
- RS232/485
- CAN bus
- USB

Offered by Microchip

2007 Microchip Technology Incorporated

Bus
Comm.
- CAN bus
- USB
- LinBus

Digital
Peripherals
PWM
RTC

LED
Drivers

Slide 11

Digital Signal Controller


dsPIC

2007 Microchip Technology Incorporated

DSC Overview

Slide 12

Digital Signal Controller

What is DSC ?
PERFORMANCE

Digital Signal Control


Embedded Control
+
Digital Signal Processing

e
h
T

dsPIC33F
dsPIC30F

P
S
D

e
c
a
p
S

32-bit MCU
16-bit MCU
5 - 15 MIPS

dsPIC DSC
The 16-bit MCU with
the power of DSP

8-bit MCU
1 - 10 MIPS

PRICE
2007 Microchip Technology Incorporated

Slide 13

Digital Signal Controller

dsPIC DSC Family:


Architected from Scratch
O

O
O
O
O

Seamlessly integrates a DSP


and an MCU
MCU look and feel, easy to use
Competitive DSP performance
Optimized for C compiler
Fast, deterministic, flexible
interrupts
Excellent RTOS support

2007 Microchip Technology Incorporated

Slide 14

Digital Signal Controller

DSC Highly Optimized C compiler


dsPIC

Control
Control Centric
Centric Benchmarks
Benchmarks
Relative Code Size

16-bit Applications
(~ 40KB code)
152%

153%

32-bit Applications
(~ 50KB code)
153%

157%

188%
180%

156%
136%
129%

113%

114%

114%

2007 Microchip Technology Incorporated

Infineon C16X

TI 320C24x

Hitachi H8S

Motorola HC12

FS 56F8367

Mitsubishi M16C

Infineon C16X

FS 56F8367

TI 320C24x

Hitachi H8S

Motorola HC12

Mitsubishi M16C

dsPIC DSC

MPLAB C30 v1.30

dsPIC DSC

100%

100%

MPLAB C30 v1.30

Slide 15

Digital Signal Controller

dsPIC30F Products
Power Conversion & Motor Control Family
Product
dsPIC DSC

A/D
Output
Motor
Flash SRAM EE Timer Input Comp/
10-bit Quad
UART SPITM I2CTM CAN
Cntrl
Pins
Enc
KB Bytes Bytes 16-bit Cap
1.0
Std
PWM
Msps
PWM

dsPIC30F2010

28

12

dsPIC30F3010

28

dsPIC30F4012

1024

6 ch

Yes

24

1024 1024

6 ch

Yes

28

48

2048 1024

6 ch

Yes

dsPIC30F3011

40

24

1024 1024

9 ch

Yes

dsPIC30F4011

40

48

2048 1024

9 ch

Yes

dsPIC30F5015

64

66

2048 1024

16 ch

Yes

dsPIC30F5016

80

66

2048 1024

16 ch

Yes

dsPIC30F6010

80

144

8192 4096

16 ch

Yes

O
O
O
O

512

Brushless DC Motor Control


AC Induction Motor Control
Switch Reluctance Motor Control
UPS, Inverters and Power Supplies

2007 Microchip Technology Incorporated

O
O
O
O

Appliances
Power Tools
Automotive
Industrial
Slide 16

Digital Signal Controller

dsPIC33F Products
Power Conversion & Motor Control Family
T
I
M
E
R

M
10-bit ADC
C
I
1.1 Msps
OC
P
C PWM
W
# ADC, # Ch
M

U
A
R
T

PINS

Flash
(KB)

RAM
(KB)

Dual
Port
RAM
(KB)

dsPIC33FJ64MC506

64

64

8 1 ADC, 16 Ch

dsPIC33FJ64MC508

80

64

dsPIC33FJ64MC510

100

64

dsPIC33FJ64MC706

64

64

14

dsPIC33FJ64MC710

100

64

14

dsPIC33FJ128MC506

64

128

dsPIC33FJ128MC510

100

128

dsPIC33FJ128MC706

64

dsPIC33FJ128MC708

S I
2
P
C
I

C
A
N

Q
E
I

8 1 ADC, 18 Ch

8 1 ADC, 24 Ch

8 2 ADC, 16 ch

8 2 ADC, 24 ch

8 1 ADC, 16 Ch

8 1 ADC, 24 Ch

128

14

8 2 ADC, 16 ch

80

128

14

8 2 ADC, 18 Ch

dsPIC33FJ128MC710

100

128

14

8 2 ADC, 24 ch

dsPIC33FJ256MC510

100

256

14

8 1 ADC, 16 ch

dsPIC33FJ256MC710

100

256

28

8 2 ADC, 24 ch

Product

2007 Microchip Technology Incorporated

Slide 17

Digital Signal Controller


dsPIC

DSC Architecture
Summary

2007 Microchip Technology Incorporated

Slide 18

Digital Signal Controller

dsPIC DSC Architecture


O


O
O

O
O
O
O
O
O

MCU + DSP
Harvard Architecture
(Separate data & memory Bus)
16-bit (Data or RAM)
24-bit (Program or ROM)
12MB (no paging)
64kB (no banking : RAM)
DSP (fixed point/ 2 40-bit accumulators)

2007 Microchip Technology Incorporated

Slide 19

Digital Signal Controller

dsPIC DSC Architecture


O

()
O 16 x 16-bit working register
O
O
O
O
O

Software stack
Fast, deterministic interrupt response
Three operand instructions: C = A + B

8 SRAM
DMAC

2007 Microchip Technology Incorporated

Slide 20

Digital Signal Controller

dsPIC DSC Operating


Parameters
Feature

dsPIC30F

dsPIC33F

DC to 30 MIPS

DC to 40 MIPS

VDD(VDC):

2.5 to 5.5

3.0 to 3.6

-40C to +125C

-40C to +85C

Flash

Flash

SRAM, EEPROM

SRAM, Self-write Flash

Package sizes
O
18-pin SO & SP
O

28-pin SO, SP and QFN


40-pin SP; 44-pin TQFP, QFN

64-, 80- and 100- pin TQFP

2007 Microchip Technology Incorporated

28 lead QFN: 6 x 6 x 0.9 mm

Slide 21

Digital Signal Controller

dsPIC Architecture Block Diagram


Data Memory
(RAM)
30 KB

2 KB
Dual Port
RAM

Selected
Peripherals

DMAC
8 chan.

DSP: dual access


MCU: single access

Instruction
Pre-fetch & Decode

DSP

16 x 16

MCU
ALU
Address Path
MCU/DSP Data Path
2007 Microchip Technology Incorporated

TABLE
Access Cntrl

W Array

X AGU

Y AGU

Engine

23-bit PC
Control

Program
Memory
256 KB

DSP Data Path


Program Data/Control Path
Slide 22

Digital Signal Controller

Programmers Model
15
Divide Quotient
Divide Remainder

W0
W1
W2
W3
W4
W5
W6
W7
W8
W9
W10
W11
W12
W13
W14
W15

W Registers
General Purpose
Data Registers
or
Address Pointers

DSP OPERAND
Registers
DSP ADDRESS
Registers

Frame Pointer
Stack Pointer
15
Stack Pointer Limit

DSP Accumulators
(40-bit)

SPLIM

ACCA
ACCB
39

32 31

OA OB SA SB OAB SAB DA DC IPL2 IPL1 IPL0 RA

2007 Microchip Technology Incorporated

0
0

16 15

N OV

Status Register

Slide 23

Digital Signal Controller

dsPIC
Interrupt Subsystem

2007 Microchip Technology Incorporated

Slide 24

Digital Signal Controller

Interrupt Vector Table

Interrupt Vector
Table (IVT)

Alternate
Interrupt Vector
Table (AIVT)

2007 Microchip Technology Incorporated

Reset - GOTO Instruction


Reset - GOTO Address
Reserved
Oscillator Fail Trap
Address Error Trap
Stack Error Trap
Math Error Trap
Reserved
Reserved
Reserved
Interrupt Vector 0
Interrupt Vector 1
Interrupt Vector 2

Interrupt Vector 53
Reserved
Reserved
Reserved
Oscillator Fail Trap

Interrupt Vector 53

0x000000
0x000004

Decreasing Natural Order Priority

0x00007E

0x000084

0x0000FE

Slide 25

Digital Signal Controller

Traps
O
O

Oscillator Failure Trap (level 14)


Address Error Trap (level 13)
O

Instruction fetch from illegal program space


Data fetch from unimplemented data space

Unaligned word access from data space

Stack Error Trap (level 12)


O

Stack overflow or underflow

Arithmetic Error Trap (level 11)


O
O
O
O

Divide by Zero
Unsaturated Accumulator Overflow (A or B)
Catastrophic Accumulator Overflow (either)
Accumulator Shift Overflow

2007 Microchip Technology Incorporated

Slide 26

Digital Signal Controller

dsPIC

2007 Microchip Technology Incorporated

Slide 27

Digital Signal Controller


dsPIC DSC PIC MCU

Watchdog Timer (RC Osc )


- 2 ms - 16 sec

Power-On-Reset

- 0, 4, 16, 64 ms Delay

Brown-out Reset :
-

Low VDD Detect Interrupt


-

2007 Microchip Technology Incorporated

Slide 28

Digital Signal Controller

Clock sources
Low Pwr RC 512KHz
Fast RC 8.0 MHz
PLL
4x,
8x,
16x
or bypass

EC Clock

OSCI

XTL, XT, HS
Primary
Xtal OSC

Clock Divide
By
1, 4, 16, 64

System
Clock

OSCO

SOSCI

32KHz
Timer1 Xtal
OSC

SOSCO

Primary Oscillator for Crystals


Y 32 kHz for Real Time Clock
O

Includes 2 Internal RC
Oscillators

PLL multiplies oscillator source


for high frequency operation
Clock divide can optionally slow clock
to conserve power
Y

2007 Microchip Technology Incorporated

Slide 29

Digital Signal Controller

Fail
-Safe Operation
Fail-Safe
O

Features that make the target system safe!


O

Clock monitor detects oscillator failure


O

Illegal Program Instruction


O

Automatic switch to an internal RC clock

Device Resets

Traps let software handle error conditions


O Oscillator Fail
O Address out of range
O Stack out of range
O Math errors

2007 Microchip Technology Incorporated

Slide 30

Digital Signal Controller

dsPIC DSC Peripherals


Overview

2007 Microchip Technology Incorporated

Slide 31

Digital Signal Controller

dsPIC Peripherals
MCU / DSP CORE
16-bit ALU
16 x 16 MAC
Dual 40-bit ACC

Output Compare
Standard PWM

ADC
12-bit 200 ksps
10-bit 1.0 Msps

(8 ch / 16-bit)

Input Capture
TIMER1

2007 Microchip Technology Incorporated

Quadrature Encoder

(TIMER6)

SPI 2

4 KB

SPI 1

Data Memory
EEPROM

UART 2

32 KB

16-bit, 6-8 ch

16 / 32 bit Timers
TIMER4 / TIMER5

UART 1

Data Memory
SRAM

Motor Control PWM

Slide 32

CAN 2

16 / 32 bit Timers
TIMER2 / TIMER3

CAN 1

256 KB

DCI

Real Time Clock

(8 ch / 16-bit)

I2C

Program Memory
Flash

Digital Signal Controller

A/D Converter
O

10-bit High Speed A/D


O 10 bit resolution with 1 LSB accuracy
O 1 Msps conversion rate
O Up to 16 input channels, 4 S/H Amplifiers
O Synchronization to the MCPWM time
base
12-bit A/D
O 12 bit resolution with 1 LSB accuracy
O 200 ksps conversion rate
O Up to 16 input channels, single S/H
amplifier

2007 Microchip Technology Incorporated

Slide 33

Digital Signal Controller

10
-bit A/D Converter
10-bit
VREF+

Conversion
Control

VREFAN0

S/H

Input Muxes

S/H

ADC
10 bit
1.0 Msps

Data
Format

BUFFER
16 deep

S/H

Bus Interface

AN1

S/H

AN15

2007 Microchip Technology Incorporated

Sample
Sequence
Control

Slide 34

Digital Signal Controller

Sampling Options

AN0
AN1
AN2
AN3

SIMULTANEOUS
SAMPLING

2007 Microchip Technology Incorporated

SEQUENTIAL
SAMPLING

Slide 35

Digital Signal Controller

Q
uadrature E
ncoder IInterface
nterface
Quadrature
Encoder
O


O 3
O
O
O

Phase A
Phase B
INDEX signals

AN1
AN7


dsPIC30F4011

O 16-bit

120 - 240
VAC

PWM3H
PWM3L
PWM2H
PWM2L
PWM1H
PWM1L
FLTA

Rectifier

IBUS
VBUS

BLDC Motor

3-ph
Inverter

Fault

AN6
AN0
QEA
QEB
INDEX

2007 Microchip Technology Incorporated

Incremental
Encoder

Slide 36

Digital Signal Controller

Quadrature Timing
Diagram
O

PHASE A

PHASE B
COUNT

+1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1

2007 Microchip Technology Incorporated

+1

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

Slide 37

Digital Signal Controller

QEI Block Diagram


Tcy

Clock
Divider
INDEX

Digital Filter
Logic

QEB/UP_ DN

Digital Filter
Logic

Quadrature
Decoder
Logic
DIR

Tcy

Prescaler and
Sync. Logic

Reset

Timer mode

Digital Filter
Logic

QEA/TQCKI
GATE

Clock

16-Bit Up/Down
Counter
Timer mode

Comparator

TQCS

Max. Count
Register

UP/DOWN

2007 Microchip Technology Incorporated

Slide 38

Digital Signal Controller

P
ulse W
idth M
odulation
Pulse
Width
Modulation
O

DC () AC

: PWM

PWM
Sine-wave

50%

(Carrier Ripple)
O

Power Tr. Switching


Loss

2007 Microchip Technology Incorporated

2%

50%

Slide 39

98%

Digital Signal Controller

Motor Control PWM


O

O
O
O

O High

AC Motors
DC motors
Power supplies

frequency @ more

bits
= better control of motor
operation
O Fault

2007 Microchip Technology Incorporated

120 - 240
VAC

AN1
AN7

dsPIC30F4011

O 4 PWM
O
PWM

PWM3H
PWM3L
PWM2H
PWM2L
PWM1H
PWM1L
FLTA

Rectifier

IBUS
VBUS

BLDC Motor

3-ph
Inverter

Fault

AN6
AN0
QEA
QEB
INDEX

Incremental
Encoder

Slide 40

Digital Signal Controller

PWM
O
O

Carrier Frequency
Duty Cycle

+V
PWM1H

PWM2H

PWM1L
PWM2L

2007 Microchip Technology Incorporated

PWM3H

3 Phase
BLDC

PWM3L

Slide 41

Digital Signal Controller

Motor Control PWM Block


Diagram
Dead Time A
1616-bit TimeTime-base
Dead Time B
PWM4H

Duty Cycle
Generator #4

Dead Time Unit


PWM4L

Duty Cycle
Generator #3

PWM3H
Dead Time Unit
PWM Override
Logic

Duty Cycle
Generator #2

A/D Conversion
Trigger

2007 Microchip Technology Incorporated

PWM2H

Dead Time Unit


PWM2L
PWM1H

Duty Cycle
Generator #1

PWM3L

Four PWM output


pairs with output
polarity control

Dead Time Unit


PWM1L
Fault A
Fault B

Slide 42

Two fault pins w/


programmable fault
states

Digital Signal Controller

Motor Control PWM


O

PTCON register
O
O
O
O
O

PTMOD - Timebase Mode


PTCKPS - Timebase clock pre-scale
PTOPS - Timebase Output post-scale
PTSIDL - Stop in IDLE mode
PTEN - Timebase Enable

R/W-0
PTEN
bit15

R/W-0
bit7

U-0
14

R/W-0
PTSIDL
13

R/W-0
R/W-0
PTOPS<3:0>
6

2007 Microchip Technology Incorporated

U-0
12

R/W-0
4

U-0
11

U-0
10

R/W-0
R/W-0
PTCKPS<1:0>
3

U-0
9

U-0
bit8

R/W-0
R/W-0
PTMOD<1:0>
1

Slide 43

bit0

Digital Signal Controller

Motor Control PWM


O

Edge Aligned PWM


PTPER

PDC3
PDC2

PDC1

PWM1
PWM2
PWM3

2007 Microchip Technology Incorporated

Slide 44

Digital Signal Controller

Motor Control PWM


O

Center Aligned PWM


buffer
update

duty
cycle
changed

buffer
update

PTPER

PDCx

PWM

2007 Microchip Technology Incorporated

Slide 45

Digital Signal Controller

Motor Control PWM


O

Duty Cycle Comparison Block


Diagram
15

1
PDCx

16-bit Compare
PTDIR
PTMR
15 14

2007 Microchip Technology Incorporated

D
0

Tcy/2

Tcy

Slide 46

Digital Signal Controller

Motor Control PWM


O

PWM / Counting Resolution


O
O
O
O
O
O
O

15- PTMR : Tcy


PTPER : (Tcy)
16-bit Duty Cycles : Tcy/2
Duty Cycle 15 = PTMR
Duty Cycle LSB : Tcy/2
Count Period / 2 = PTPER
PWM frequency = (Center-Aligned
)/2

2007 Microchip Technology Incorporated

Slide 47

Digital Signal Controller

Motor Control PWM


O

Center Aligned PWM


PTPER = (Fcy / (Fpwm *PTMR Prescaler*2)- 1)

PWM Formula for Edge Aligned PWM


PTPER = (Fcy / (Fpwm *PTMR Prescaler)- 1

2007 Microchip Technology Incorporated

Slide 48

Digital Signal Controller

Motor Control PWM


O

Dead Time
O

Shoot Through
DT = Dead Time / (Tcy *Prescaler)
Dead Time

PWM1H

PWM1H

PWM1L
PWM1L

2007 Microchip Technology Incorporated

Slide 49

Digital Signal Controller

MCPWM A/D
O

O
O

SEVTCMP : A/D PWM



shunt A/D
Loop Update
PWM1H

Trigger conversion at end of bottom transistor on-time

PWM1H

PWM1L
To A/D

PWM1L
T

2007 Microchip Technology Incorporated

Slide 50

Digital Signal Controller

SEVTCMP Register

2007 Microchip Technology Incorporated

Slide 51

Digital Signal Controller

MCPWM Fault Inputs


O
O

Automatic/Latched Fault protection


Fault PWM Pin

Current
Limit
Motor
Current

LATCHED

PWM1H

PWM

PWM1L
Current
Limit
Motor
Current

FLTA

Current
Limit

AUTOMATIC

PWM

2007 Microchip Technology Incorporated

Slide 52

Digital Signal Controller

MCPWM Override Control


O

OVDCON (override control)


O
O
O
O
O

Commutation
I/O pin : PWM, Active, Inactive
POVD = 0 : I/O pin
POUT :
, PWM pins OFF

R/W-1
POVD4H
bit15

R/W-1
POVD4L
14

R/W-1
POVD3H

R/W-1
POVD3L

13

12

R/W-1
POVD2H
11

R/W-1
POVD2L

R/W-1
POVD1H

R/W-1
POVD1L

10

bit8

R/W-0
POUT4H

R/W-0
POUT4L

R/W-0
POUT3H

R/W-0
POUT3L

R/W-0
POUT2H

R/W-0
POUT2L

R/W-0
POUT1H

R/W-0
POUT1L

bit7

bit0

2007 Microchip Technology Incorporated

Slide 53

Digital Signal Controller

MCPWM Override Control


R/W-1
POVD4H

R/W-1
POVD4L
14

bit15

R/W-1
POVD3H

R/W-1
POVD3L

13

12

R/W-1
POVD2H
11

R/W-1
POVD2L

R/W-1
POVD1H

R/W-1
POVD1L

10

bit8

R/W-0
POUT4H

R/W-0
POUT4L

R/W-0
POUT3H

R/W-0
POUT3L

R/W-0
POUT2H

R/W-0
POUT2L

R/W-0
POUT1H

R/W-0
POUT1L

bit7

bit0

POVDx POUTx PWM Inactive Active


Output Output Output

0
0

1
0

POVDxx
POUTxx

0
1

0
0

1
x

PWMxx

2007 Microchip Technology Incorporated

Slide 54

Digital Signal Controller

Lab 1.
dsPIC DSC
(PICDEM
MCLV Board)
(PICDEM

2007 Microchip Technology Incorporated

Slide 55

Digital Signal Controller

Lab1 :
O
O

LV MC Board
Lab ?
O

O
O
O

C:\..\Lab1\Lab1.mcw

Lab1.mcw or Lab1.mcp
dsPIC DSC

2007 Microchip Technology Incorporated

Slide 56

Digital Signal Controller


1) MPLAB IDE V7.20 or higher installed
2) MPLAB ICD 2
- R20 or Latest Rev.

3) PICDEM MCLV board


4) 24V power supply
5) Hurst (NTDynamo) BLDC motor
z
z

Power (4 wires 4 )
Hall sensor (5 wires 8 )

2007 Microchip Technology Incorporated

Slide 57

Digital Signal Controller

LAB 1
O

Mission:
O
O
O

O
O

Board
MPLAB IDE workspace
MPLAB IDE build
compile
MPLAB ICD 2
MPLAB ICD 2

2007 Microchip Technology Incorporated

Slide 58

Digital Signal Controller

Training board
28-pin MC dsPIC30F
3-Phase
Inverter

Power
Reset
Pot
S2

Motor
connector

DIP Switch

Serial connector
2007 Microchip Technology Incorporated

MPLAB ICD 2
connector

Jumpers
J7, J8, J11, J12, J13, J14
Slide 59

Digital Signal Controller

Block Diagram

2007 Microchip Technology Incorporated

Slide 60

Digital Signal Controller

Schematic

2007 Microchip Technology Incorporated

Slide 61

Digital Signal Controller

Schematic

2007 Microchip Technology Incorporated

Slide 62

Digital Signal Controller

Jumper
O

PICDEM MCLV B/D !!!

Board Jumper
!!!

dsPIC DSC Sensored

REF(R14) R60 Center

2007 Microchip Technology Incorporated

Slide 63

Digital Signal Controller

dsPIC DSC Sensored Settings


Jumper Position

2007 Microchip Technology Incorporated

J7

NC

J8

NC

J11

NC

J12

NC

J13

NC

J14

NC

J15

NC

J10

NC

J16

1-2

J17

1-2

J19

1-2

Hall Sensor / BEMF

Vref
Cbemf

LED

Voltage of Hall Sensor

Slide 64

Digital Signal Controller

dsPIC30F3010

Debug / Program DIP Switch

PGC

UART Rx

PGD

UART Tx

EMUC2

ICD 2 Clock

EMUD2

ICD 2 Data

S2
Position

Function

Closed

PRGM

Open

DEBUG

: PRGM

: DEBUG

2007 Microchip Technology Incorporated

Slide 65

Digital Signal Controller

Lab1
O

Lab1 :
O PICDEM MCLV B/D DIP
PRGM
O Board (24V/2A)
O MPLAB IDE
O File -> Open Workspace
O C:\...\Lab1\Lab1.mcw
O Lab1.mcw
O Workspace
O

64 , Character
!!!

Continued...
2007 Microchip Technology Incorporated

Slide 66

Digital Signal Controller

Lab1 (()
)
O

Lab1 :
O
O
O
O
O
O
O

MPLAB IDE Project -> Build All


Build Succeed !!! (Output Window )
: Debugger -> Program
MCLV B/D DIP : DEBUG
Debugger -> Run
PICDEM MCLV B/D S2
PWM LEDs : Blinking???

2007 Microchip Technology Incorporated

Slide 67

Digital Signal Controller

Lab1
O

:
O
O

: DIP --- PRGM


Debugger : DIP ---DEBUG

Folder Lab workspace

Workspace

2007 Microchip Technology Incorporated

Slide 68

Digital Signal Controller

ADPCFG Register

2007 Microchip Technology Incorporated

Slide 69

Digital Signal Controller

PWMCON1 Register

2007 Microchip Technology Incorporated

Slide 70

Digital Signal Controller

Lab1
-2
Lab1-2
O

Instructions for Lab1-2:


O

Learning Project Build & Library Usage

Make Project using source file in Lab1-2


Set up Link-Scripts p30f3010.gld
Set up Library File libp30f3010-coff.a
Set up Heap size as 50 byte for printf

O
O
O

2007 Microchip Technology Incorporated

Slide 71

Digital Signal Controller

Lab1
-2
Lab1-2

2007 Microchip Technology Incorporated

Slide 72

Digital Signal Controller

Lab 1
-2 (contd.)
1-2
O

Instructions for Lab1 (contd):


O
Configuration
O
XT w PLL8x
O
Communication Channel Selecting
Use EMUC2 and EMUD2
O
Select Debugger -> Build All
O
IF NO errors then ...
O
Select Debugger -> Program to program
O
Move DIP switches to OPEN position
O
Select Debugger -> Run
O
Connect RS232 Cable to Board & PC
O
Run Lab1-2 HyperTerminal

2007 Microchip Technology Incorporated

Slide 73

Digital Signal Controller

Lab1
-2
Lab1-2

2007 Microchip Technology Incorporated

Slide 74

Digital Signal Controller

Lab1
-2 Result
Lab1-2

2007 Microchip Technology Incorporated

Slide 75

Digital Signal Controller

Peripheral Hands
-On
Hands-On
10
-bit A/D Converter
10-bit

2007 Microchip Technology Incorporated

Slide 76

Digital Signal Controller

dsPIC
10
-bit A/D Converter
dsPIC
10-bit
O

Feature Summary
O 10-bit Resolution with +/- 1 bit accuracy
O 1M Samples/Sec conversion rate
O Up to 16 input channels, 4 S/H Amplifiers
O Unipolar differential measurements
O External VREF+ and VREFO Many sampling sequences can be programmed
O Multiple conversion trigger sources

2007 Microchip Technology Incorporated

Slide 77

Digital Signal Controller

10
-bit A/D Block Diagram
10-bit
VREF+

Conversion
Control

VREFVREFAN0
SH0
AN1

16-word
buffer

Data
Formatting

SH2

Bus Interface

Input Muxes

SH1

ADC
10 bit
500 ksps

SH3
AN15

Sample
Sequence
Control

2007 Microchip Technology Incorporated

Slide 78

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

A/D Configuration for Labs


O PLab 1 - Sample one channel, manual
sampling, manual conversion
O PLab 2 - Simultaneously sample 4
channels, auto sample, trigger
conversion from PWM

Keep these configurations in mind as we


look at the A/D control registers

2007 Microchip Technology Incorporated

Slide 79

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

ADCON1 Register Bits


O DONE - A/D conversion status
O SAMP - A/D sampling status/control
O ASAM - Auto sample control bit
O SIMSAM - Simultaneous sample
control
O SSRC - Conversion trigger source
O FORM - Result format
O ADSIDL - Stop in IDLE control bit
O ADON - A/D enable bit (set last)

2007 Microchip Technology Incorporated

Slide 80

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

A/D Conversion Trigger Options


O Auto convert (internal counter)
O Motor Control PWM special event trigger
O allows synchronized shunt current
measurement
O Timer3 period match event
O Edge input on INT0 pin
O Manual trigger
O user clears SAMP bit to begin CONV

2007 Microchip Technology Incorporated

Slide 81

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

ADCON2 Register Bits


O ALTS - Alternate MUX sample mode
O BUFM - Buffer mode control bit
O SMPI - Samples per interrupt
O BUFS - Buffer status
O CHPS - S/H Channels per Sample
O CSCNA - MUX A Scan enable bit
O VCFG - Voltage Ref configuration

2007 Microchip Technology Incorporated

Slide 82

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

A/D Sampling Options


O 1, 2, or 4 S/H amplifiers for conversions
O Simultaneous or sequentially sampled
O Scan mode with enable for each input
O Two multiplexer settings can be
programmed
O Alternate between conversions
O Selectable number of samples per interrupt
O Selectable buffer fill mode
O Auto or manual sample

2007 Microchip Technology Incorporated

Slide 83

Digital Signal Controller

Sampling Options

AN0
AN1
AN2
AN3

SIMULTANEOUS
SAMPLING

2007 Microchip Technology Incorporated

SEQUENTIAL
SAMPLING

Slide 84

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

ADCON3 Register Bits


O

ADCS - A/D Clock setting (Tad)


O

ADRC Conversion Clock Source


O
O

Tcy/2 increments, 167ns min


A/D RC oscillator
System Clock

SAMC - Auto Sample Time bits

2007 Microchip Technology Incorporated

Slide 85

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

ADPCFG Register
O

Sets port pin for analog (default) or


digital mode

ADCSSL - A/D Input Scan Select


Register
O

Use when CSCNA bit set

2007 Microchip Technology Incorporated

Slide 86

Digital Signal Controller

PLab1 - Single channel ADC


Conversion
Instructions for PLab1:
O Use PLab1.c
O Write code to setup ADC:
O Convert single Pot REF on AN2(RB2)
O Use Manual Sample by setting SAMP bit
every 100 mS (use Delay100 mS routine)
O Manually check conversion complete
O Use Internal RC for Tad
.. Contd.
O

2007 Microchip Technology Incorporated

Slide 87

Digital Signal Controller

PLab1 - Single channel ADC


Conversion (contd.)
O
O

O
O
O
O
O

Open the project file - PLab1 in PLab1 Directory


Code to be modified clearly marked:
Replace text with Code
Compile the program using Project -> Build All
If no errors then Program the part but ...
MAKE SURE DIPs are in CLOSE position
Use Debugger -> Program to program part
MAKE SURE DIPs are in OPEN position

2007 Microchip Technology Incorporated

Slide 88

Digital Signal Controller

PLab1 - Single channel ADC


Conversion (contd.)
O

In Windows:
O
O

Open Hyperterm PLab1.ht in PLab1


directory.
If Bottom Status reads Disconnected
then connect by selecting: Call -> Call

In MPLAB IDE, Run the program:


Debugger -> RUN
Turn POT REF to view different values
in Hyperterm.

2007 Microchip Technology Incorporated

Slide 89

Digital Signal Controller

PLab1 Result

2007 Microchip Technology Incorporated

Slide 90

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

ADCHS Register - CH0 S/H Input


Selection
AN0 - AN15
+
CH 0
AN1
VREF-

ADCHS Register
R/W-0
R/W-0
CHXNB<1:0>
bit15

14

R/W-0
R/W-0
CHXNA<1:0>
bit7

2007 Microchip Technology Incorporated

R/W-0
CHXSB

R/W-0
CH0NB

R/W-0

13

12

11

R/W-0
CHXSA

R/W-0
CH0NA

R/W-0

R/W-0
R/W-0
CH0SB<3:0>
10

R/W-0
R/W-0
CH0SA<3:0>
2

Slide 91

R/W-0
bit8

R/W-0
bit0

Digital Signal Controller

10
-bit A/D Converter
10-bit
O

ADCHS - CH1, CH2, CH3 Input


Select

AN0

AN1
+
CH 1
-

AN3
AN6
AN9

AN2
+

AN4

CH 2
-

AN7

+
CH 3
-

AN5
AN8

AN10

AN11

VREF-

VREF-

VREF-

ADCHS Register
R/W -0
R/W -0
CHXNB<1:0>
bit15

14

R/W-0
R/W-0
CHXNA<1:0>
bit7

2007 Microchip Technology Incorporated

R/W -0
CHXSB

R/W -0
CH0NB

13

12

R/W-0
CHXSA

R/W-0
CH0NA

R/W-0

R/W -0
11

R/W -0
R/W -0
CH0SB<3:0>
10

R/W-0
R/W-0
CH0SA<3:0>
2

Slide 92

R/W-0
bit8

R/W-0
bit0

Digital Signal Controller

MCPWM A/D Synchronization


SEVTCMP register sets A/D conversion start time in PWM
cycle
Ensure A/D properly captures shunt current
Can also use to minimize control loop update delay
Trigger conversion at end of bottom transistor on-time

PWM1H

PWM1H

PWM1L
To A/D

PWM1L
T

2007 Microchip Technology Incorporated

Slide 93

Digital Signal Controller

PLab 2 Objectives
O
O
O
O

3 MC PWM pairs are connected to 3 ADC inputs


MC PWMs will be driven with a 25%, 50% and
100% duty cycle
The average of the duty cycle will be measured
by each ADC
If the configuration is correct then the 3 ADC
value displayed will be 1.8V, 2.8V and 3.75V
using Hyperterm

2007 Microchip Technology Incorporated

Slide 94

Digital Signal Controller

PLab 2 Hardware
+V

1H

2H

3H
AN5
PWM3

1L

2L

3L

AN4
PWM2

PWM1

2007 Microchip Technology Incorporated

AN3

Slide 95

Digital Signal Controller

PLab2 Jumper settings


O

J7, J11 and J13 - shorted between


pin 2 & 3
(short link away from ICD 2 connector)

O
O

Other Jumper - open


Keep Potentiometer REF(R14) and
R60 in center position

2007 Microchip Technology Incorporated

Slide 96

Digital Signal Controller

PLab 2 Objectives
O

Learn to setup the MC PWM period,


duty cycle, dead time, ADC trigger
etc.
Learn to setup the ADC for
simultaneous sampling and
conversion on multiple channels

2007 Microchip Technology Incorporated

Slide 97

Digital Signal Controller

PLab2 Setup
O

Part 1: Setup ADC


O
O
O
O
O
O

ADC to simultaneously sample 4


channels
Set CH0 - AN2(Pot), CH1 - AN3, CH2 AN4 and CH3 - AN5. Vref- = GND
Trigger Conversion with 16 PWM
Periods
Set Tad = 4Tcy
Modify Registers ADCON1, ADCON2,
ADCON3, ADCHS and ADPCFG
Code to be modified is clearly marked

2007 Microchip Technology Incorporated

Slide 98

Digital Signal Controller

PLab2 Setup (contd.)


O

Part 2: setup MC PWM


O
O
O
O
O
O

Setup for continuous center aligned


PWM
Complementary pairs
Fcy = 10Mips , PWM Freq = 80khz
PDC1 = 25%, PDC2 = 50% PDC3 = 100%
Dead time = 1 uS (active and inactive)
Code to be modified is clearly marked

2007 Microchip Technology Incorporated

Slide 99

Digital Signal Controller

PLab2 Setup (contd.)


O

PLab 2 General:
O
O

Do not connect the motor to the board


Use Hyperterm setup: PLab2.ht in
PLab2 directory to view results of the
ADC
Make sure that DIPs are in CLOSE
position when programming
Make sure that DIPs are in OPEN
position when running

2007 Microchip Technology Incorporated

Slide 100

Digital Signal Controller

PLab2 Result

2007 Microchip Technology Incorporated

Slide 101

Digital Signal Controller

BLDC

2007 Microchip Technology Incorporated

Slide 102

Digital Signal Controller

I. Motor
O

What is a Motor?

How?
(I) (B) (F)

F=IxB
2007 Microchip Technology Incorporated

Slide 103

Digital Signal Controller

Left Hand Rule


F=IxB
B
I
N

B
F

2007 Microchip Technology Incorporated

Slide 104

Digital Signal Controller

Motor Torque
T=F * D

F
D
B

S
I
F
B
F

2007 Microchip Technology Incorporated

Slide 105

Digital Signal Controller

DC Motor Torque
O
O

Summary
Torque = Force * Distance
O

F=IxB
T=(IxB)*D

B,D : T = * A

O
O

: B = K * IF
DC (T), (B)

2007 Microchip Technology Incorporated

Slide 106

Digital Signal Controller

DC Motor
O
O
O
O
O

2007 Microchip Technology Incorporated

N :
S :

(Rotor) N S

, (commutator)


Spark

Slide 107

Digital Signal Controller

DC Motor Control
O

DC




S/W
PWM

Armature

Vin

Armature

Vin

2007 Microchip Technology Incorporated

Slide 108

Digital Signal Controller

Unidirectional
DC Motor Control
Low side switch

High side switch

Armature

PWM

A
Vin

Armature

2007 Microchip Technology Incorporated

Vin
PWM

Slide 109

Digital Signal Controller

Bi
-directional
Bi-directional
DC Motor Control H
-bridge
H-bridge
Reverse

Forward

PWM
Vin

PWM

A
PWM

PWM

H-bridge
2007 Microchip Technology Incorporated

Slide 110

Digital Signal Controller

Resources Required
O

PWMs: H-bridge
O

ADCs: /
O

O
O

1 ~ 2 (8/10-bit )

I/O ports 2~4 I/Os



O

1~2 ( 8-bit ), 20 kHz

AUSART / I2C / LIN bus

PIC16FXXX C

2007 Microchip Technology Incorporated

Slide 111

Digital Signal Controller

The Brushless DC Motor


(BLDC)
O
O
O

DC
DC
: (Rotor)
O
O

(Loss)
or

Armature : (Stator)
z
z


(Loss)

2007 Microchip Technology Incorporated

Slide 112

Digital Signal Controller

vs
DC Motor
PERMANENT MAGNET BRUSHED DC
MOTOR
Permanent
Brushes
Magnet
Stator

Windings
2007 Microchip Technology Incorporated

Rotor

PERMANENT MAGNET BRUSHLESS


DC MOTOR
Permanent
Magnet
Stator

Rotor

Windings
Slide 113

Digital Signal Controller

Brushless DC Motor
Energization
100

101

com

110

com

g
g
B

SS
001

b
G

r
com

010
G

011

2007 Microchip Technology Incorporated

Slide 114

Digital Signal Controller

BLDC
O
O
O
O
O
O


No Brushes / No



No Commutator
O

/ No Arcing - No Commutator

2007 Microchip Technology Incorporated

Slide 115

Digital Signal Controller

BLDC Control

BLDC =

, (Rotor/)
!!!

2007 Microchip Technology Incorporated

Slide 116

Digital Signal Controller

Lab 2. Forced Commutation


BLDC

2007 Microchip Technology Incorporated

Slide 117

Digital Signal Controller

Running a BLDC Motor


with Forced Commutation
O
O
O
O
O

O
O

Sector 5 ,
= 24V
= 0V
= OFF


(6)

2007 Microchip Technology Incorporated

Red Winding
60o

Green Winding

Blue Winding

Sector

Slide 118

Digital Signal Controller

Six
-Step Commutation with
Six-Step
Inverter
+V
PWM1H

PWM2H

PWM3H

PWM1L

PWM2L

PWM3L

Sector

2007 Microchip Technology Incorporated

3 Phase
BLDC

Slide 119

Digital Signal Controller

Six
-Step Commutation with
Six-Step
Inverter
+V
PWM1H

PWM2H

PWM3H

PWM1L

PWM2L

PWM3L

Sector

2007 Microchip Technology Incorporated

3 Phase
BLDC

Slide 120

Digital Signal Controller

Six
-Step Commutation with
Six-Step
Inverter
+V
PWM1H

PWM2H

PWM3H

PWM1L

PWM2L

PWM3L

Sector

2007 Microchip Technology Incorporated

3 Phase
BLDC

Slide 121

Digital Signal Controller

Six
-Step Commutation with
Six-Step
Inverter
+V
PWM1H

PWM2H

PWM3H

PWM1L

PWM2L

PWM3L

Sector

2007 Microchip Technology Incorporated

3 Phase
BLDC

Slide 122

Digital Signal Controller

Motor Control PWM


O

Using OVDCON for 6-Step


Commutation

1 Electrical Revolution

Sector

OVDCON Value
POVD<7:0> POUT<7:0>

Sector

PWM1H

00000000

00100001

00000000

00100100

00000000

00000110

00000000

00010010

PWM2L

00000000

00011000

PWM3H

00000000

00001001

PWM3L

2007 Microchip Technology Incorporated

PWM1L
PWM2H

Slide 123

Digital Signal Controller

Running a BLDC Motor


with Forced Commutation

Start /
Stop

3-Phase
Voltages
Main State
Machine

Periodic
ISR

6-Step
Generation

GPIO

GPIO

dsPIC30F
3-Phase
Inverter

BLDC

Peripheral Block

Software Block

2007 Microchip Technology Incorporated

Slide 124

Digital Signal Controller

Hurst Motor Connection

M1
M2
M3

5V
G

2007 Microchip Technology Incorporated

Slide 125

Digital Signal Controller

Lab2 Running a BLDC Motor


with Forced Commutation
Lab2 :
O

workspace
O

C:\...\Lab2\Lab2.mcw

Coding / / :
O
O
O
O

Six-Step Table : SixStepTable[ ]


Compile code
Program dsPIC DSC
Run code

Continued...
2007 Microchip Technology Incorporated

Slide 126

Digital Signal Controller

Lab2 Running a BLDC Motor


with Forced Commutation
O

O
O
O

S2
O !!!
???
O rough and loud (almost screeching)

WHY?
S2
O

2007 Microchip Technology Incorporated

Slide 127

Digital Signal Controller

Lab2 Running a BLDC Motor


with Forced Commutation

Fixed Speed
1000 RPM

4 Amps Peak

2007 Microchip Technology Incorporated

Slide 128

Digital Signal Controller

Details of Program
O

Use MPLAB IDE to go thru sections


of the code

2007 Microchip Technology Incorporated

Slide 129

Digital Signal Controller

Lab2
O

BLDC

Six-Step Commutation
O

dsPIC DSC Override

BLDC

(4 Amps /

Position Feedback

2007 Microchip Technology Incorporated

Slide 130

Digital Signal Controller

BLDC
Rotor Angular Position

Resolver
360
O


(, 1 1024)

A/D +

()

180
0

Resolver Output
Sine

Cosine

2007 Microchip Technology Incorporated

Slide 131

Digital Signal Controller

BLDC
Rotor Angular Position

Optical Encoder
360
O


180
(, 500 )

QEI +

()

Optical Encoder Output


QEA
QEB
INDEX

2007 Microchip Technology Incorporated

Slide 132

Digital Signal Controller

BLDC
Rotor Angular Position

Hall Effect
360
O
O
O
O


(, 1 30
Ext.

1~3 Hall
( )

180
0

Hall Effect Sensors


Hall A
Hall B
Hall C

2007 Microchip Technology Incorporated

Slide 133

Digital Signal Controller

BLDC
O

50%
,

3 - ,
120

- ,

2007 Microchip Technology Incorporated

Slide 134

Digital Signal Controller

BLDC Motor

Rotor magnets
Stator winding

Hall sensors
2007 Microchip Technology Incorporated

Slide 135

Digital Signal Controller

Six Step BLDC Control


HALL C
60o

Red Winding

M1

Q1

HALL B

Q2

Green Winding

M2

Q4

HALL A

Q5

Q3
G

Q6

Blue Winding

M3
+TORQUE FIRING Q3,Q5 Q1,Q5 Q1,Q6 Q2,Q6 Q2,Q4 Q3,Q4 Q3,Q5 Q1,Q5 Q1,Q6
Sector
Hall States

Tr. On State :

W /V U /V U /W V /W V /U W /U W /V U /V U /W
0x24 0x06 0x12 0x18 0x09 0x21 0x24 0x06 0x12

2007 Microchip Technology Incorporated

Slide 136

Digital Signal Controller

Six Step BLDC Control (CW)


Hall State : 6 5 4 3 2 1 6 ..

HALL A / M1

60

HALL B / M3

HALL C / M2

+TORQUE FIRING

Q3,Q5

Sector

Q1,Q6

Q2,Q6

Q2,Q4

Q3,Q4

Q3,Q5

Q1,Q5

Q1,Q6

W /V

U /V

U /W

V /W

V /U

W /U

W /V

U /V

U /W

0x24

0x06

0x12

0x18

0x09

0x21

0x24

0x06

0x12

Hall States

Tr. On State :

Q1,Q5

2007 Microchip Technology Incorporated

Slide 137

Digital Signal Controller

Six Step BLDC Control (CCW)


Hall State : 1 2 3 4 5 6 1 ..

HALL A / M3

60

HALL B / M2

HALL C / M1

+TORQUE FIRING

Q3,Q5

Sector

Q1,Q6

Q2,Q6

Q2,Q4

Q3,Q4

Q3,Q5

Q1,Q5

Q1,Q6

W /V

U /V

U /W

V /W

V /U

W /U

W /V

U /V

U /W

0x24

0x06

0x12

0x18

0x09

0x21

0x24

0x06

0x12

Hall States

Tr. On State :

Q1,Q5

2007 Microchip Technology Incorporated

Slide 138

Digital Signal Controller


-
-

2007 Microchip Technology Incorporated

Slide 139

Digital Signal Controller

Lab 3. OVDCON

OVDCON
BLDC

2007 Microchip Technology Incorporated

Slide 140

Digital Signal Controller

Six Step Sensored


BLDC Control
O

6 2(000,111)

3 High, Low, Off Lookup


Table

6 60

2007 Microchip Technology Incorporated

Slide 141

Digital Signal Controller

Lab 3 Jumper
O

MCLV dsPIC DSC


Sensored Jumper

REF(R14) R60

- ( )

( )

2007 Microchip Technology Incorporated

Slide 142

Digital Signal Controller

OVDCON
BLDC
Start /
Stop

Main State
Machine

6-Step
Generation

OVDCON

GPIO

dsPIC30F

Angular
Position

3-Phase
Voltages
3-Phase
Inverter

BLDC

GPIO

Hall
Sensors

2007 Microchip Technology Incorporated

Slide 143

Digital Signal Controller

OVDCON
BLDC
:

Start

Read Hall Port

New Commutation

: PWM ,

2007 Microchip Technology Incorporated

Slide 144

Digital Signal Controller

Lab3 OVDCON
BLDC
O

Lab3 :
O
O

Workspace : C:\WIB\Lab3\Lab3.mcw
Lab 3 :
O
O
O
O
O

HallValue SixStepTable
HallValue Read & Mask & Shift OVDCON

dsPIC
(Run)

...

2007 Microchip Technology Incorporated

Slide 145

Digital Signal Controller

Lab 3 - OVDCON
BLDC
O

: S2

WHY?

: S2

2007 Microchip Technology Incorporated

Slide 146

Digital Signal Controller

Lab 3 - OVDCON
BLDC
?
O
O

O
O

-
Jumper
- dsPIC DSC Sensored
, S2 , DIP
PRGM DEBUG
MPLAB IDE
S2 ?

2007 Microchip Technology Incorporated

Slide 147

Digital Signal Controller

Lab 3 - OVDCON
BLDC

Maximum Speed
3800 RPM

200 mA Peak

2007 Microchip Technology Incorporated

Slide 148

Digital Signal Controller

Details of Program
O

MPLAB IDE
!

2007 Microchip Technology Incorporated

Slide 149

Digital Signal Controller

Lab3
O
O

-
BLDC

, OVDCON OFF
- H/W
With no PWM we have fixed motor speed.

2007 Microchip Technology Incorporated

Slide 150

Digital Signal Controller

Lab 4. MCPWM
BLDC

2007 Microchip Technology Incorporated

Slide 151

Digital Signal Controller

Change Notification (CN)


O

dsPIC DSC CN :
O

pin

- A,B,C CN5,6,7

CNxInterrupt , 3 -
, Lookup Table
BLDC

2007 Microchip Technology Incorporated

Slide 152

Digital Signal Controller

Hall Sensors
100
R
b

101

S
com

110
N

Hall A
CN or IC

N
com

Hall B

g
B
N

001
G

CN or IC

010

Hall C
CN or IC

com

011

2007 Microchip Technology Incorporated

Slide 153

Digital Signal Controller

Motor Control PWM


O

Using OVDCON for PWM 6-Step


1 Electrical Revolution
commutation
Halls

Halls
C|B|A

OVDCON Value

C|B|A

100

110

010

011

001

101

POVD<7:0> POUT<7:0>

Sector

000

00000000

00000000

001

00100000

00000001 0x2001 PWM1L

010

00001000

00010000 0x0810

011

00001000

PWM2H
00000001 0x0801

100

00000010

00000100 0x0204 PWM2L

101

00100000

00000100 0x2004

110

00000010

PWM3H
00010000 0x0210

111

00000000

00000000

2007 Microchip Technology Incorporated

PWM1H

PWM3L

Slide 154

Digital Signal Controller

MCPWM
BLDC

Duty
Cycles

10-bit ADC

+5V
Voltage

6-Step
Generation

MCPWM

dsPIC30F

Start /
Stop

Main State
Machine

2007 Microchip Technology Incorporated

3-Phase
Inverter

BLDC

Hall
Sensors
CN

GPIO

Angular
Position

3-Phase
Voltages

Slide 155

Digital Signal Controller

MCPWM
BLDC
Hall Change ISR

Duty Cycle = ADC Value

:
Read new Hall values

New Commutation

Return
See Ch-15.3 & 15.4

2007 Microchip Technology Incorporated

Slide 156

Digital Signal Controller

Lab4
MCPWM
O

Lab4 :
O
O

C:\..\Lab4\Lab4.mcw Workspace
Lab 1 :
O

Code
dsPIC DSC

2007 Microchip Technology Incorporated

Slide 157

Digital Signal Controller

Lab4
MCPWM
O
O
O

S2 :
:

?

WHY?

S2 :

2007 Microchip Technology Incorporated

Slide 158

Digital Signal Controller

Lab4
MCPWM
O
O

: S2
3


LED Table

LED

Why?

O
O

2007 Microchip Technology Incorporated

Slide 159

Digital Signal Controller

Lab4
MCPWM

Hall Effect
Sensors

PWM1H
PWM1L

2007 Microchip Technology Incorporated

Slide 160

Digital Signal Controller

Lab4
O

MCPWM

3800 RPM

2007 Microchip Technology Incorporated

Slide 161

Digital Signal Controller

Lab 5. BLDC

2007 Microchip Technology Incorporated

Slide 162

Digital Signal Controller

PI(D) Loop
O

Proportional-Integral-Differential

Set Point - Process Variable =


Error

Control Variable = Output

CV = Pe + I e dt + D de/dt

2007 Microchip Technology Incorporated

Slide 163

Digital Signal Controller

Closed Loop

Desired Speed

Speed Error

PID

+-

Measured
Speed

2007 Microchip Technology Incorporated

Voltage

Speed
Calculation

Motor

Hall Sensor
Period

Slide 164

Digital Signal Controller

Digital PID
Up

Kp * Error

Speed Error

Desired Speed
+-

Ui

Measured Speed

dError
Kd *

2007 Microchip Technology Incorporated

Ki * Error dt

Voltage

Ud

dt

Slide 165

Digital Signal Controller

Digital PID
O

Up(T) = Kp * Error(T)

Ui(T) = Ki * Error(T) + Ui(T-1)

Kp * Error

Ki * Error dt

Ud(T) = Kd * (Error(T) Error(T-1))

dError
Kd *

dt

Voltage(T) = Up(T) + Ui(T) + Ud(T)


2007 Microchip Technology Incorporated

Slide 166

Digital Signal Controller

Optional Digital PID


Kp * Error

Ki

Ki * Error dt

dError
Kd

Kp * Error

+
+
+

-1 * Error
1-Z

-1

Kd * (1 Z ) * Error

dt

2007 Microchip Technology Incorporated

Slide 167

Digital Signal Controller

Optional Digital PID


Kp * Error

Ki
-1

* Error

1-Z

+
+
+

Error *

Kp +

-1

Ki
-1

+ Kd (1 Z )

1-Z

-1

Kd * (1 Z ) * Error

2007 Microchip Technology Incorporated

Slide 168

Digital Signal Controller

Optional Digital PID


Error *

-1

Ki

Kp +

-1

+ Kd (1 Z )

= Controller Output

1-Z

-1

Error *

Kp (1 Z )

-1 2

+ Ki +

Kd (1 Z )

= Controller Output

-1

1-Z

-1

(Kp + Ki + Kd) + (-Kp - 2*Kd) Z + Kd*Z


Error *

-1

-2

= Controller Output

1-Z

2007 Microchip Technology Incorporated

Slide 169

Digital Signal Controller

Optional Digital PID


-1

(Kp + Ki + Kd) + (-Kp - 2*Kd) Z + Kd*Z


Error *

-1

-2

= Controller Output

1-Z

Error = Error (T)

Most Recent Error

-1

Error * Z = Error (T-1)


-2

Error * Z = Error (T-2)

2007 Microchip Technology Incorporated

Least Recent Error

Slide 170

Digital Signal Controller

Optional Digital PID


-1

(Kp + Ki + Kd) + (-Kp - 2*Kd) Z + Kd*Z


Error *

-1

-2

= Controller Output

1-Z

Controller Output (T) = Controller Output (T 1)


+ Error (T) * K1
+ Error (T-1) * K2
+ Error (T-2) * K3
Where:
K1 = Kp + Ki + Kd
MAC
K2 = -Kp -2Kd
K3 = Kd
2007 Microchip Technology Incorporated

Slide 171

Digital Signal Controller

MAC Class of DSP Instructions


O

Sample Instruction
O MAC
W4*W5, A, [W8]+=2, W4, [W10]-=6, W5, W13

Source
operand
registers

Y
prefetch
source

Destination
accumulator
X
prefetch
source

Basic Syntax
2007 Microchip Technology Incorporated

Y
prefetch
destination

X
prefetch
destination

Other Acc.
Write-back
destination

Optional Arguments
Slide 172

Digital Signal Controller

Round Logic

40-bit Accumulator A
40-bit Accumulator B

Saturate

Saturate

DSP Engine Block Diagram


16

Enable

40

Adder
Negate

16

X Data Bus

40

40

Barrel
Shifter

40

Zero-backfill

Sign Extend

32
33

17-bit
Multiplier/Scaler

16

16

16

Operand Pre-Processing
From W Array
2007 Microchip Technology Incorporated

To W Array
Slide 173

Digital Signal Controller

ADC
Fractional Data Format
ADC
O

-32768 ~ +32767
-1.0+1
.
Word
Value
0x8000
0xA000
0xC000
0xE000
0x0000
0x2000
0x4000
0x6000
0x7FFF

2007 Microchip Technology Incorporated

Integer
Value
-32768
-24576
-16384
-8192
0
8192
16384
24576
32767

Fractional
Value
-1.0
-0.75
-0.5
-0.25
0.0
+0.25
+0.5
+0.75
+0.999969
Slide 174

Digital Signal Controller

Input Capture (IC)


dsPIC DSC IC :
O
O
O
O

IC

-

3 - IC
ICxInterrupt , IC
IC

2007 Microchip Technology Incorporated

Slide 175

Digital Signal Controller

dsPIC Engine
Measured
Speed

Speed
Calculation

Measured
= (Fractional Divide)
Speed

O
O

Hall Sensor
Period

Minimum Period
IC Period

dsPIC DSC Engine


2007 Microchip Technology Incorporated

Slide 176

Digital Signal Controller

Lab5 BLDC

10-bit ADC

+5V

Required
Speed
+

Duty
Cycles
Voltage

Error

6-Step
Generation

PID

Measured
Speed

MCPWM

dsPIC30F

Angular
Position

3-Phase
Voltages
3-Phase
Inverter

BLDC

CN

Hall
Sensors

Start /
Stop

IC Period
Main State
Machine

2007 Microchip Technology Incorporated

IC

GPIO

Speed
Calculation

Slide 177

Digital Signal Controller

Lab5 BLDC

Hall Change ISR

Periodic ISR

Calculate Speed

Desired Speed = ADC

Duty Cycle = PID Output

Process PID

Read new Hall values

Return

New Commutation

Return

2007 Microchip Technology Incorporated

Slide 178

Digital Signal Controller

Lab5 BLDC

O

Lab5 :
O
O

C:\..\Lab5\Lab5.mcw Workspace
Lab 1 :
O


dsPIC DSC

...
2007 Microchip Technology Incorporated

Slide 179

Digital Signal Controller

Lab5 BLDC

O
O
O
O

: S2
:

Duty Cycle

WHY?

: S2

2007 Microchip Technology Incorporated

Slide 180

Digital Signal Controller

Lab5 BLDC

O

BLDC motor

dsPIC DSC DSP PID


dsPIC DSC PWM, OVDCON, CN IC


BLDC

2007 Microchip Technology Incorporated

Slide 181

Digital Signal Controller

Lab 6. BLDC

2007 Microchip Technology Incorporated

Slide 182

Digital Signal Controller

Lab 6. BLDC

O

Ripple

BLDC AC

- Update

(Amplitude)

2007 Microchip Technology Incorporated

Slide 183

Digital Signal Controller

Lab 6. BLDC

Q1

HALL A

Q2

Q3

60o

Red Winding

Q4

Q5

Q6

HALL B
Green Winding

50%

HALL C
Blue Winding

Sine Phase

Sector

Hall States

60

120

180

240

300

60

120

2%

2007 Microchip Technology Incorporated

Slide 184

50% 98%

Digital Signal Controller

Lab 6. BLDC

Operation
1
s
Executed

1
2
3

HALL A
Red Winding

1
2
3

1
2
3

60o

HALL C
Blue Winding

Sector
Hall States

60

120

5
5

0
4

1
6

2007 Microchip Technology Incorporated

180

240

300

2
2

3
3

4
1

0
5
5

Hall A,B,C :
60
Hall

Hall B :
IC (Input Capture)
-

Hall B :
-

HALL B
Green Winding

Sine Phase

60

120

0
4

1
6

Slide 185

Digital Signal Controller

Lab 6. BLDC

Amplitude
10-bit ADC

+5V

Required
Speed
+

Error

Duty
Cycles
Sine Waves

PID

Generation

Measured
Speed

MCPWM

dsPIC30F

Angular
Position

3-Phase
Voltages
3-Phase
Inverter

BLDC

CN

Hall
Sensors

Start /
Stop

IC Period
Main State
Machine

2007 Microchip Technology Incorporated

IC

GPIO

Speed
Calculation

Slide 186

Digital Signal Controller

Lab 6. BLDC

Control Technique:
Hall Change ISR
PWM ISR
Periodic ISR

Calculate Speed

Desired Speed = ADC

Read new Hall values

Modulate Sine Wave


Based on PID Output

Process PID

Set new Phase for sine

Return

Return

Return

Calculate Phase Inc


Based on Speed

2007 Microchip Technology Incorporated

Slide 187

Digital Signal Controller

Lab 6. BLDC

O

Lab6 :
O
O

C:\...\Lab6\Lab6.mcw
Lab 1 :
O


dsPIC DSC

...
2007 Microchip Technology Incorporated

Slide 188

Digital Signal Controller

Lab 6. BLDC

O

: S2

(Lab 5) ?

: S2

2007 Microchip Technology Incorporated

Slide 189

Digital Signal Controller

Lab 6. BLDC

Sinusoidal Phase Voltage

Six-Step Control
Trapezoidal Phase Voltage

2007 Microchip Technology Incorporated

Slide 190

Digital Signal Controller

Lab6
O

BLDC

(Ripple)

CE003. Driving a BLDC with Sinusoidal


Voltages using dsPIC30F.

2007 Microchip Technology Incorporated

Slide 191

Digital Signal Controller

Lab 7. Phase Advance


BLDC

2007 Microchip Technology Incorporated

Slide 192

Digital Signal Controller

Lab 7. Phase Advance


BLDC
O


(Phase advanced)

Phase advance ,

Phase shift Negative Field


,

, Phase Advance
, (full) ,
,

2007 Microchip Technology Incorporated

Slide 193

Digital Signal Controller

Lab 7. Phase Advance


BLDC
O

-
(commutation)
,
- (commutation)

Phase advance

-

2007 Microchip Technology Incorporated

Slide 194

Digital Signal Controller

Phase Advance

Advance

NO ADVANCE

0
SECTOR
2007 Microchip Technology Incorporated

15 ADVANCE

2
Slide 195

Digital Signal Controller

Lab7 Phase Advance


BLDC
+5V

Duty
Cycles

10-bit ADC

Required
Voltage
6-Step
Generation

MCPWM

dsPIC30F
3-Phase
Voltages
3-Phase
Inverter

BLDC

Start /
Stop

Hall
Sensors

Angular
Position
Main State
Machine

2007 Microchip Technology Incorporated

CN

GPIO

Phase
Advance

Slide 196

Digital Signal Controller

Lab7 Phase Advance


BLDC
Hall Change ISR

Scheduled ISR
Calculate Speed
Load saved Hall values
Duty Cycle = ADC
Predict new Hall values
Save Hall values
New Commutation,
Actual Sector + 1
Schedule ISR Based on
Actual Speed
Return
Return

2007 Microchip Technology Incorporated

Slide 197

Digital Signal Controller

Lab7 Phase Advance


BLDC
O

Lab7 :
O

C:\..\Lab7\Lab7.mcw

Lab 1 :
O

dsPIC DSC

...
2007 Microchip Technology Incorporated

Slide 198

Digital Signal Controller

Lab7 Phase Advance


BLDC
O
O
O

O
O
O

: S2
:
Phase Advance


WHY?
: S2

2007 Microchip Technology Incorporated

Slide 199

Digital Signal Controller

Lab7 Phase Advance


BLDC

Extended Speed:
6500 RPM
1 A Peak

2007 Microchip Technology Incorporated

Slide 200

Digital Signal Controller

Program
O

MPLAB IDE

2007 Microchip Technology Incorporated

Slide 201

Digital Signal Controller

Lab7
O

Phase advance

70% (
)

2007 Microchip Technology Incorporated

Slide 202

Digital Signal Controller

Sensorless BLDC Motor

2007 Microchip Technology Incorporated

Slide 203

Digital Signal Controller

Why sensorless?
O
O
O
O
O
O

Reliability especially aerospace, military


Physical space restrictions axial length.
Issues surrounding sealing of connections
Applications where rotor runs flooded
Manufacturability alignment and duty cycle
tolerance
Cost especially on low power systems
O Even at high volumes, position sensing can
add $3 to system cost.

2007 Microchip Technology Incorporated

Slide 204

Digital Signal Controller

BLDC Sensorless Techniques


O

AN901 uses Back EMF sensing


O
O
O
O
O

Reliable
Varies linearly with speed
Works over a wide range of BLDC Motors
Relatively easy to implement
Works well for applications like Fan or
pump speed control

Method used is called Back EMF zero


crossing method
O

Consists of monitoring the voltage of the


inactive winding for zero crossing

2007 Microchip Technology Incorporated

Slide 205

Digital Signal Controller

What is BEMF?
O

Motor

BEMF

O
O
O

2007 Microchip Technology Incorporated

When a DC motor spins,


the PM rotor, moving past
the stator coils induces a
electrical potential in the
coils called Back EMF.
BEMF is directly
proportional to speed
BEMF = RPM/Kv
In order to sense BEMF
we have to spin the motor.

Slide 206

Digital Signal Controller

BLDC Motor Back EMF


O
O

DC+
A

Back EMF

DC- C

2007 Microchip Technology Incorporated

B
O

Phase A and C are


energized
Inactive Phase B
has induced Back
EMF
Normally the phase
which is not
energized, is
monitored for Back
EMF
Important: Motor
has to be spinning
Slide 207

Digital Signal Controller

Technique to Monitor Back


EMF
Back EMF signal compared with DC bus/2
using external comparators

CN1

dsPIC30F3010

CN3

CN2

2007 Microchip Technology Incorporated

Slide 208

Digital Signal Controller

Technique to Monitor Back


EMF
Back EMF signal compared with virtual neutral

CN1

dsPIC30F3010

CN3

CN2

2007 Microchip Technology Incorporated

Slide 209

Digital Signal Controller

AN901 method to Monitor


Back EMF

2007 Microchip Technology Incorporated

dsPIC30F3010

Signal Conditioning

Back EMF signal read using A/D Channels

Slide 210

Digital Signal Controller

Back EMF Crossing


Diagram
0

0
T30
T60

0
SECTOR

2007 Microchip Technology Incorporated

5
Slide 211

1
Digital Signal Controller

The Back EMF zero


zero
crossing
method in detail
crossing
O
O

O
O
O
O

In every electrical cycle, there are periods when


each phase is not being driven.
During these regions one end of the inactive phase
is referenced to the star point and the other is
monitored.
The monitored voltage will cross the 1/2 VDD point
at 30 electrical degrees.
Knowing the last zero crossing time we know the
60 electrical degree time (T60)
T60 divided by 2 = T30 is loaded in TMR2.
The ISR of TMR2 then commutes the next pair of
windings at T30 seconds later

2007 Microchip Technology Incorporated

Slide 212

Digital Signal Controller

BEMF v/s Hall sensors

Back EMF

Hall sensor

2007 Microchip Technology Incorporated

Slide 213

Digital Signal Controller

How to Start
Start Spinning

Spinning
O
O
O

The motor is energized Open Loop (no feedback)


The speed is ramped up to a programmable value
At a given time two winding are energized. The
third is monitored for Back EMF
The unexcited windings are then monitored for two
rising edges (120 information)
From the time and sequencing of the edges we can
determine the speed and rotation direction
The BEMF sensing algorithm is now applied to
rotate the motor

2007 Microchip Technology Incorporated

Slide 214

Digital Signal Controller

Starting Algorithm
Parameters used in AN901
O

Lock Position 1 Time


O Before starting, motor is rotated to a known
position
O The amount of time that the rotor is held in
that position is LP1T
Lock Position 1 Demand
O Speed at which the rotor moves to the lock
position
O If value is too high then rotor may
overshoot the position

2007 Microchip Technology Incorporated

Slide 215

Digital Signal Controller

Starting Algorithm
Parameters used in AN901
O

Ramp Start/End Speed:


O Open loop speed to get the rotor moving
before back EMF is monitored
O Too low a speed will not generate enough
back EMF
O Too high a speed may cause an overcurrent stall
O Rotor is accelerated from Ramp Start speed
to the Ramp End Speed in the Ramp
Duration time Acceleration Profile.

2007 Microchip Technology Incorporated

Slide 216

Digital Signal Controller

Starting Algorithm
Parameters used in AN901
O

Ramp Start/End Demand:


O The amount of torque required to spin the
motor without slipping
O If the rotor appears to be spinning slowly as
the ramp time proceeds then the ramp
demand needs to be increased
O If the whole motor vibrated when the ramp
time increases then the demand is too high
and most likely the over current will trip

2007 Microchip Technology Incorporated

Slide 217

Digital Signal Controller

Lab 8. Running Sensorless BLDC


Motor

2007 Microchip Technology Incorporated

Slide 218

Digital Signal Controller

Lab8 Jumper settings


O

Turn MCLV board over and refer to


the jumper settings for dsPIC
Sensorless
Keep Potentiometer REF(R14) and
R60 in center position
Disconnect Hall Sensors from Motor
(Black connector)

2007 Microchip Technology Incorporated

Slide 219

Digital Signal Controller

dsPIC DSC Sensored


Settings
Jumper Position

2007 Microchip Technology Incorporated

J7

2-3

J8

NC

J11

2-3

J12

NC

J13

2-3

J14

NC

J15

NC

J10

NC

J16

1-2

J17

1-2

J19

NC
Slide 220

Digital Signal Controller

Running Sensorless BLDC


Motor
Required
Speed
+

Duty
Cycles
Voltage

Error

6-Step
Generation

PID

Angular
Position

Measured
Speed

Speed
Calculation

ZX
Period

ZX
Detect

3-Phase
Voltages
3-Phase
Inverter

BLDC

VBUS
Feedback
10-bit ADC

10-bit ADC

+5V

MCPWM

dsPIC30F

GPIO

3-Phase
Voltage Feedback
Start /
Stop

Main State
Machine

2007 Microchip Technology Incorporated

Slide 221

Digital Signal Controller

Sensorless Motor Tuning


Interface (SMTI)

O
O

Visual tool for


Tuning sensorless
BLDC Applications
Runs with MPLAB
ICD 2
Can change any
parameter specified
in AN901
See GS005 for
Operation Details

2007 Microchip Technology Incorporated

Slide 222

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
Instructions for Lab8:
O
O

Use workspace
C:\WIB\Lab8\Lab8.mcw
Follow Lab 1 instructions to:
O
O
O

Compile code
Program dsPIC
Run code

Disconnect Black connector from Motor

Continued...
2007 Microchip Technology Incorporated

Slide 223

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
Open Sensorless Motor Tuning
Interface
O Click on Halt in the SMTI window
O Click on Refresh in the SMTI window
PART I
O Change parameters as per next slide
O

SMTI runs ONLY under Debugger, not Programmer

2007 Microchip Technology Incorporated

Slide 224

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC

2007 Microchip Technology Incorporated

Slide 225

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
O
O
O

Click on Start in the SMTI window


Press S2 to start motor
Motor appears to start but does not
spin
WHY?
O
O

Start demand is to low to keep the


motor running while ramping up.
Hint. Increase the start/end speed ramp
demand when motor slips

2007 Microchip Technology Incorporated

Slide 226

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
Press S2 to stop/reset the motor
O Click on Halt in the SMTI window
PART II
O Change parameters as per next slide
O

2007 Microchip Technology Incorporated

Slide 227

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC

2007 Microchip Technology Incorporated

Slide 228

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
O
O
O
O
O

Click on Start in the SMTI window


Press S2 to start motor
Motor appears to start but does not spin
Observe the mechanics of the motor
What is happening?
O
O
O

The motor is vibrating in each sector while ramping


up, because the demand was to high
This generates a lot of start up current and bad back
EMF feedback
Hint. Reduce the start/end demands when motor
vibrates in every sector while ramping. If we reduce
the demands more than we should, the motor will
start slipping again

2007 Microchip Technology Incorporated

Slide 229

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC

Press S2 to stop/reset the motor


O Click on Halt in the SMTI window
Part III
O Change parameters as per next
slide
O

2007 Microchip Technology Incorporated

Slide 230

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC

2007 Microchip Technology Incorporated

Slide 231

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
O
O
O
O

Click on Start in the SMTI window


Press S2 to start motor
Motor appears to start but does not spin
What is wrong?
O

The motor is ramping with good torque and


does not slip, but the end speed is too low.
Back EMF zero crossings are still not
detectable by the controller.
Hint. When ramping up a motor, try to set a
maximum speed of 50% of the motor rated
speed, which is around 2000 RPM in this
Motor

2007 Microchip Technology Incorporated

Slide 232

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
Press S2 to stop/reset the motor
O Click on Halt in the SMTI window
PART IV
O Change parameters as per next slide
O

2007 Microchip Technology Incorporated

Slide 233

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC

2007 Microchip Technology Incorporated

Slide 234

Digital Signal Controller

O
O
O
O
O

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC
Keep Pot in center position
Click on Start in the SMTI window
Press S2 to start motor
Does the motor spin?
Press S2 to stop/reset the motor

Discuss why the motor spins


Use AN992: Sensorless Control of
BLDC motor using dsPIC30F2010, for
details
2007 Microchip Technology Incorporated

Slide 235

Digital Signal Controller

Lab8 Running Sensorless BLDC


Motor using dsPIC DSC

Phase PWM
Voltage

BEMF Zero
Crossing

2007 Microchip Technology Incorporated

Slide 236

Digital Signal Controller

Summary
O
O
O
O
O
O
O
O
O

BLDC motor basics


Blindly spin a BLDC motor
Improve efficiency by using Hall sensors
Used dsPIC peripherals to spin a sensored
BLDC motor
Controlling BLDC Speed with Digital PID
Reducing audible noise of BLDC with
Sinusoidal control
Extending speed range with Phase Advance
control
Techniques for sensorless control
Modified Parameters in AN901 to spin a
sensorless BLDC motor

2007 Microchip Technology Incorporated

Slide 237

Digital Signal Controller

Reference Application Notes


and Collateral
O
O
O
O
O
O
O
O
O

GS001: Getting Started with BLDC Motors and dsPIC30F


GS002: Measuring Speed and Position with the QEI Module
GS004: Driving an ACIM with the dsPIC MWPWM Module
GS005: Using the dsPIC30F Sensorless Motor Tuning Interface
CE003: Driving a BLDC with Sinusoidal Voltages using dsPIC30F
AN901: Sensorless Control of BLDC Motor using dsPIC30F
AN907: Using the dsPIC30F for Vector Control of an ACIM
AN957 : Sensored Control of BLDC Motor using dsPIC30F2010
AN992: Sensorless Control of BLDC Motor using dsPIC30F2010

2007 Microchip Technology Incorporated

Slide 238

Digital Signal Controller

Thanks for Attending!


Good Luck in Your
Development

2007 Microchip Technology Incorporated

Slide 239

Digital Signal Controller

The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KeeLoq, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart and rfPIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, microID, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartShunt and The Embedded Control Solutions Company are registered
trademarks of Microchip Technology Incorporated in the U.S.A.
Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming,
ICSP, ICEPIC, Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICtail, PowerCal, PowerInfo, PowerMate,
PowerTool, rfLAB, Select Mode, SmartSensor, SmartTel and Total Endurance are trademarks of Microchip Technology Incorporated in the U.S.A. and other
countries.
Serialized Quick Turn Programming (SQTP) is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.

2007 Microchip Technology Incorporated

Slide 240

Digital Signal Controller

You might also like