0% found this document useful (0 votes)
8 views42 pages

Refrigerator Compressor Reference Design User Guide

Uploaded by

iqrok555 aliyev
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
8 views42 pages

Refrigerator Compressor Reference Design User Guide

Uploaded by

iqrok555 aliyev
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 42

Refrigerator Compressor Reference Design User Guide

Refrigerator Compressor Reference Design


User Guide

Contents

Safety Notice ..............................................................................................................................2


Document Revision History ........................................................................................................3
Glossary......................................................................................................................................4
1 Introduction ..............................................................................................................................5
1.1 System and Tools Requirements ................................................................................. 6
1.1.1 Basic requirements ............................................................................................ 6
1.1.2 Advanced requirements ..................................................................................... 6
2 Hardware Description ..............................................................................................................7
2.1 Introduction ................................................................................................................... 7
2.2 Key Functional Modules ............................................................................................... 8
2.2.1 EMI filter and Protection ..................................................................................... 9
2.2.2 Rectifier ............................................................................................................ 10
2.2.3 Auxiliary power supply ..................................................................................... 10
2.2.4 MCU ................................................................................................................. 11
2.2.5 Inverter circuitry ................................................................................................ 12
2.2.6 Feedback circuitry ............................................................................................ 13
2.2.7 Communication ports ....................................................................................... 14
2.3 User Interface ............................................................................................................. 14
2.3.1 Connectors and Sockets .................................................................................. 14
2.3.2 LED indicators .................................................................................................. 16
2.4 Electrical Specifications .............................................................................................. 17
3 Setup and Run .......................................................................................................................18
3.1 Basic Operation .......................................................................................................... 18
3.2 Run with Diagnostic Kernel ........................................................................................ 21
3.3 Debug and Test by Test Harness .............................................................................. 27
3.3.1 Debug and test operation by Test Harness ..................................................... 28
3.3.2 Brief conclusion of the Test Harness setting.................................................... 30
4 Run a Different Compressor ..................................................................................................32
4.1 Modify theoretical arithmetic parameters ................................................................... 32
4.2 Debug parameters ...................................................................................................... 35
4.2.1 Debug startup parameters ............................................................................... 35
4.2.2 Debug PI parameters ....................................................................................... 36
5 Known Issues ........................................................................................................................38
Appendix A. Flag Description ...................................................................................................39
Appendix B. Schematics ...........................................................................................................40

Microchip Technology Inc. Page 1


Refrigerator Compressor Reference Design User Guide

Safety Notice

The safety notices and operating instructions provided should be adhered to, to avoid
a safety hazard.

WARNING – The input AC mains supply, output terminals and other interfaces are NOT
isolated with each other. DO NOT connect any non-isolated device to the board when input
mains supply voltage applied.

WARNING – The output terminals may be at up to 410V with respect to ground, regardless
of the input mains supply voltage applied. These terminals are live during operation AND
for three minutes after disconnection from the supply. Do not attempt to access the
terminals or remove the cover during this time.

CAUTION – The system should not be installed, operated, serviced or modified except by
qualified personnel who understand the danger of electric shock hazards and have read
and understood the user instructions. Any service or modification performed by the user is
done at the user’s own risk and voids all warranties.

CAUTION – The Reference Design board is designed to be connected to the AC mains


supply via a nonlocking plug. As the unit has no mains switch, this plug constitutes the
means of disconnection from the supply and thus the user must have unobstructed
access to this plug during operation.

Microchip Technology Inc. Page 2


Refrigerator Compressor Reference Design User Guide

Document Revision History

Revision A – 12/4/2019
This is the initial released version of the document.

Microchip Technology Inc. Page 3


Refrigerator Compressor Reference Design User Guide

Glossary

ADC - Analog-to-Digital Converter


ATPLL - Angle Tracking Phase-Locked Loop
DSC - Digital Signal Controller
RCDRD - Refrigerator Compressor Development Reference Design
RCDB - Refrigerator Compressor Development Board
FOC - Field-Oriented Control
IPMSM - Interior Permanent-Magnet Synchronous Motor
LDO -Low Dropout voltage regulator
LED - Light-Emitting Diode
MCU - Micro Control Unit
MTPA - Maximum Torque Per Ampere
Op-Amp - Operational Amplifier
PI - Proportional - Integral
PWM - Pulse-Width Modulation
RMS - Root-Mean-Square
SPMSM - Surface Permanent-Magnet Synchronous Motor
SVPWM - Space Vector Pulse Width Modulation
TTL -Transistor-Transistor Logic
UART - Universal Asynchronous Receiver-Transmitter
USB -Universal Serial Bus

Microchip Technology Inc. Page 4


Refrigerator Compressor Reference Design User Guide

1 Introduction

PMSM motor is getting widely used in household electric refrigerator compressors for its
higher efficiency and lower noise over traditional single-phase AC motor. A typical
refrigerator electrical control system has 2 control boards,one is for refrigerator system
control, another for compressor control.
This Refrigerator Compressor Development Reference Design (RCDRD) is intended to aid
the engineers to develop the PMSM compressor control application with dsPIC® Digital
Signal Controllers (DSCs). This development Ref Design is targeted to provide a
competitive sensor-less control solution applies to both Interior Permanent Magnet
Synchronous Motor (IPMSM) and Surface Permanent Magnet Synchronous Motor
(SPMSM) compressor. Both hardware and software are provided.
The rated continuous output current is 0.65A (RMS). This allows up to approximately 250W
continuous output power when running from a 187V to 264V single-phase input voltage in
room temperature environment. The peak output power is 350W for instantaneous high
compressor pressure operation. More details of the RCDRD hardware is provided in
Chapter 2 “Hardware Description”.
This document describes how to use RCDRD prototype 1. Below Fig 1-1 gives the picture
of this Reference Design.

Fig 1-1 Refrigerator Compressor Development Reference Design

Microchip Technology Inc. Page 5


Refrigerator Compressor Reference Design User Guide

1.1 System and Tools Requirements

1.1.1 Basic requirements


• Refrigerator Compressor Development Board (RCDB).
• MPLAB X V5.10 or later.
• Compiler XC16 V1.33 or later.
• PICkit™ 3 / PICkit™ 4 In-Circuit Debugger (Part Number: PG164130 / PG164140)
1.1.2 Advanced requirements
Below requirements are used for Diagnostic and Test-Harness function.
• MCP2200 Isolated USB to UART Demo Board (Part Number: ADM00276)

• 4 pcs Dupont line.


• X2C Scope plugin V1.30.

Microchip Technology Inc. Page 6


Refrigerator Compressor Reference Design User Guide

2 Hardware Description

2.1 Introduction

The RCDB is powered from 220V AC grid and controls the compressor motor with
dsPIC33EP64MC202. The input 220V AC voltage is passed through the Filter & protection
circuitry, and then converted to DC voltage by rectifier circuitry. An auxiliary power supply
circuitry supplies non-isolated 15V and 3.3V voltage to MCU, feedback circuitry and three
phases inverter bridge circuitry. Below Fig 2-1 gives the picture of the board while Fig 2-2
shows the block diagram.

Fig 2-1 Refrigerator Compressor Development Board

Microchip Technology Inc. Page 7


Refrigerator Compressor Reference Design User Guide

UART-USB

/ PICkit™ 4
PICkit™ 3
Isolated
Fridge Compressor Development Board Programming
UART 1
port
15V Power
Supply Square Square
Rectifier 3.3V
wave input wave
Power
Supper MCU circuitry

UART 2 Communic-
ation
DC BUS

Inverter circuitry
Filter &
Feedback
Protection
circuitry

220V AC Motor control


input output
220V AC

Motor

Fig 2-2 RCDB block diagram

2.2 Key Functional Modules

The RCDB has various functional modules which implement its salient features: EMI filter
& protection, Rectifier, Auxiliary power supply, MCU, Inverter, Feedback circuitry, and
Communication ports. They are marked in the Figure 2-3 and Tab 2-1.

Microchip Technology Inc. Page 8


Refrigerator Compressor Reference Design User Guide

2 3 7 4

1 6 5

Fig 2-3 RCDB functional modules

Tab 2-1 RCDB functional modules


① EMI filter & Protection ⑤ Three phase inverter bridge circuitry
② Rectifier ⑥ Feedback circuitry
③ Auxiliary power supply ⑦ Communication ports
④ MCU

2.2.1 EMI filter and Protection


The input power of the board is passed through the EMI filter & Protection module firstly,
as Fig 2-4 below. The F300 is a 250VAC/10A fast-acting fuse whose opening time is 0.03s
at 1000% of its ampere rating. The Vst300 is a zinc oxide varistor named TVR14561D for

Microchip Technology Inc. Page 9


Refrigerator Compressor Reference Design User Guide

surge protection. The EMI filter has two-stages. If only one-stage filter is valid, the CY300,
CY303, CX302, L301 and CX300 should be unsoldered and L301 should be shortened.

AC Input AC Output

Fig 2-4 EMI filter and Protection circuitry

2.2.2 Rectifier
This module includes an in-rush current protection, a single-phase full-bridge rectifier and
a DC bus capacitor, as Fig 2-5 below. The in-rush current was suppressed by a power
resistor R305 at the moment of powering on the board. After the DC bus capacitor is full
charged, the power resistor is shortened by relay RL30. The single-phase bridge rectifier
DB300 converts the input alternating voltage at power frequency into constant DC voltage.

VAC VBus

Fig 2-5 Rectifier circuitry

2.2.3 Auxiliary power supply


The Auxiliary power supply is to generate 15V and 3.3V for IGBT driver and
dsPIC33EP64MC202 separately.

Microchip Technology Inc. Page 10


Refrigerator Compressor Reference Design User Guide

The block diagram of auxiliary power supply is shown in Fig 2-6. The 15V power rail is
stepped down directly from the rectifier output. This eliminates the transformer and high
voltage rate components used in a Flyback approach. A MCP16331 is used to step down
this 15V to 5V.. The MIC5239 LDO regulates the 3.3V from 5V voltage to provide the
control chip dsPIC33EP64MC202 with a clean power supply. Besides the control chip, this
3.3V rail is also to power other digital and analog control circuitry, such as ADC reference,
feedback circuitry. This approach provides nice auxiliary power supply with small power
consumption.
IGBT Driver

VBus VBus–15V 15V


Buck Circuit
by VIPER12A MCU
15V–5V 5V 5V–3.3V 3.3V
DC-DC circuit LDO circuit Feedback
by MCP16331 by MIC5239
ADC reference

Fig 2-6 Auxiliary power supply

The details of all these three auxiliary circuit is shown in Appendix B. Schematic Diagram.
2.2.4 MCU
A dsPIC33EP64MC202 is selected in this design. There is also an approach that a single
chip conducts both refrigerator system control and compressor control job. Microchip
provides many other products in dsPIC33EP or dsPIC33CK series can well meet the
application.
In this design, the chip pinout functionality is listed in table below.

Tab 2-2 dsPIC33EP64MC202 pinout functionality (SSOP)


Pin Active
Pin Functions Description I/O ANSEL PPS
No. Function
1 MCLR MCLR RESET
2 AN0/OA2OUT/RA0 OA2OUT IOUT 1
3 AN1/C2IN1+/RA1 C2IN1+ I+ 1
PGED3/VREF-/AN2/C2IN1-
4 C2IN1- I- 1
/SS1/RPI32/CTED2/RB0
PGEC3/VREF+/AN3/OA1OUT/R
5 AN3 VBUS I 1
PI33/CTED1/RB1
6 PGEC1/AN4/C1IN1+/RPI34/RB2 RPI34 RX1 I 1
7 PGED1/AN5/C1IN1-/RP35/RB3 RP35 TX1 O 1
8 VSS VSS VSS
9 OSC1/CLKI/RA2 RA2 LED1 O
Clock out / test
10 OSC2/CLKO/RA3 RA3 I/O
point
11 FLT32/RP36/RB4 RB4 test point I/O
12 CVREF2O/RP20/T1CK/RA4 RA4 Relay O

Microchip Technology Inc. Page 11


Refrigerator Compressor Reference Design User Guide

13 VDD VDD VDD


14 PGED2/ASDA2/RP37/RB5 PGED2 Debug I
15 PGEC2/ASCL2/RP38/RB6 PGEC2 Debug I
16 SCK1/RP39/INT0/RB7 RP39 RX2 I 1
TCK/CVREF1O/ASCL1/SDO1/R
17 RP40 TX2 O 1
P40/T4CK/RB8
18 TMS/ASDA1/SDI1/RP41/RB9 PR41 Square_INPUT I 1
19 VSS VSS VSS
20 VCAP VCAP VCAP
21 TDO/RP42/PWM3H/RB10 PWM3H PWM3H O
22 TDI/RP43/PWM3L/RB11 PWM3L PWM3L O
23 RPI44/PWM2H/RB12 PWM2H PWM2H O
24 RPI45/PWM2L/CTPLS/RB13 PWM2L PWM2L O
25 RPI46/PWM1H/T3CK/RB14 PWM1H PWM1H O
26 RPI47/PWM1L/T5CK/RB15 PWM1L PWM1L O
27 AVSS AVSS AVSS
28 AVDD AVDD AVDD

2.2.5 Inverter circuitry


Discrete IGBTs and single shunt current sample are employed in the three-phases inverter
to save system cost. It consists of:
• 6 pcs 600V/15A IGBT
• 3 pcs 600V Half Bridge IGBT Driver MIC4608
• Single Shunt resistor for motor phase current sensing
• PWM switching frequency is 2.5 kHz
The MCU provides the PWM signals to the 3 half bridge drivers switching the 6 IGBTs, and
therefore apply power to the motor phases. Single shunt is connected in series on negative
DC bus for current feedback and over-current protection.
For simplicity, one of the 3 phase inverter circuit is shown in Fig 2-7.

15V VBus
RBST

DBST
HB

VDD CBST
PWMuH
HI HO
PWMuL
LI
Uu
MIC4608 HS

DCLAMP
LO

VSS

Figure 2-7 One phase inverter bridge circuitry diagram

Microchip Technology Inc. Page 12


Refrigerator Compressor Reference Design User Guide

Bootstrap Circuit
The high-side driver of MIC4608 is designed to drive a floating N-channel IGBT, whose
source terminal is referenced to the HS pin. A level-shifting circuit in MIC 4608 isolates the
low-side (VSS pin) referenced circuitry from the high-side (HS pin) referenced driver.
Power to the high-side driver is supplied by the bootstrap capacitor (CBST) while the voltage
level of the HS pin is shifted high.
HS Node Clamp
A diode clamp between the switching node and the HS pin is recommended to minimize
large negative glitches or pulses on the HS pin.
More detail of the bootstrap circuit and HS node clamp can be found in MIC4608 datasheet.
2.2.6 Feedback circuitry
DC bus voltage and motor phase current are sampled for motor control and protection.
• DC Bus Voltage Feedback. It is compounded by a voltage divider and a low-pass
RC filter. The divider divides the DC bus voltage to 3.3/443.3V in order to match the
MCU logic levels.
• Motor current feedback. A shunt resistor is located between the emitter of the three
low side switches and the “DC-”. dsPIC33EP64MC202 provides internal operational
amplifiers (Op-Amp) and comparators. They are used for amplifying motor current
and over-current protection. The gain of the Op-Amp is set to 4, the shunt resistor
voltage signal is shifted by 0.2VDC. Hence the motor phase current ranges from -
4.125A to +4.125A.
The location of the feedback circuit is shown in Fig 2-8.

DC Bus Voltage Feedback


dsPIC33EP64MC202
VBus

440K

5 AN3
ADC

3.3K

Motor Current Feedback


3.3V

133K

2K
3 C2INI+

Sample Shunt 8.66K


ADC / Comparator
100m
2K
4 C2INI-

8.06K
2

Fig 2-8 Feedback circuitry diagram

Microchip Technology Inc. Page 13


Refrigerator Compressor Reference Design User Guide

2.2.7 Communication ports


The RCDB provides three ports for transmitting/receiving data to and from debug tools
and/or system control board. All these ports are powered by 3.3V rail.
• UART1 communication port is non-isolated. It translates the UART signals directly
to and from dsPIC® DSC on board. This port is used to communicate with
laptop/MPLAB X IDE.
Note: The UART1 port is NON-ISOLATED. There is a big risk to damage the
board when connecting this port directly with other non-isolated system. It’s
strongly suggested connecting this port with MCP2200 Isolated USB-UART
Demo Board or other isolated USB-UART converters.
• UART2 communication port is used to communicate with refrigerator system control
board for commands and operation-status information. This port is isolated by two
optocoupler.
• Square wave acceptor port provides another method to receive speed command
from main control board. This port is isolated by a phototransistor.
The communication ports location is shown in Fig 2-9.

UART1

Square wave acceptor UART2

Fig 2-9 Communication ports

2.3 User Interface

2.3.1 Connectors and Sockets


(1) Power Sockets
• AC power inlet (CON300)
• Three-phase inverter connector to compressor (CON100)
(2) Signal sockets
• Isolated square wave receiver socket (CON200)
• Isolated UART2 communication socket (CON201)
• Non-isolated UART1 communication socket (CON202)
• PICkit™ 3 / PICkit™ 4 In-Circuit Debugger socket (CON203)
UART sockets have 4 terminals. Square wave socket has 2 terminals. Debugger socket
has 5 terminals. Table 2-3 shows the functionality of each terminal.

Microchip Technology Inc. Page 14


Refrigerator Compressor Reference Design User Guide

Tab 2-3 Terminal functionality of signal sockets


Socket Socket name
Num Pin Terminal functionality
Isolated square wave 1 +
SON200
acceptor 2 Isolated GND
1 Isolated VCC
2 TXD2
CON201 Isolated UART2
3 RXD2
4 Isolated GND
1 3.3V
2 GND
CON202 Non-isolated UART1
3 RXD1
4 TXD1
1 MCLR
PICkit™ 3 / PICkit™ 4 2 3.3V
CON203 In-Circuit Debugger 3 GND
socket 4 PGD
5 PGC

All the sockets location can be found in Fig 2-10.


UART-USB

PICkit™ 4
PICkit™ 3
Isolated

CON
200 Square
CON203 wave
CON202

LD200
UART
communication
CON
201
LD300

CON300 CON100
Compressor
220V AC

Fig 2-10 All sockets and LED indicators

Microchip Technology Inc. Page 15


Refrigerator Compressor Reference Design User Guide

2.3.2 LED indicators


There are two LED indicators in the development board. The two LED location can be
found in Fig 2-10 above.
LD300 indicates whether 3.3V power rail is available. This LED is lighted when 3.3V power
rail is ready.
LD200 indicates the board operation status and error message. The LED blinks all the time
after the board is powered. Customers could get the operating information via LED blinking.
When RCDB is operating as expected, say runs the compressor, below table shows all its
possible operation status.

Tab 2-4 Operation status LED blink pattern


System states LED blink pattern
RESTART Off
STARTING 15/16 on @ 0.625Hz
RUNNING 1/16 on @ 0.625Hz
STOPPING 15/16 on @ 0.625Hz
STOPPED 50% on @ 0.625Hz

If the board driving the compressor was in fault state, the LED will blink as in below error
code

Tab 2-5 Error codes LED blink pattern


Fault types LED blink pattern
Traps
ERR_OSC_FAIL ++---
ERR_ADDRESS_ERROR +++---
ERR_HARD_TRAP ++++---
ERR_STACK_ERROR +-++---
ERR_MATH ++-++---
ERR_RESERVED_TRAP5 +++-++---
ERR_SOFT_TRAP ++++-++---
ERR_RESERVED_TRAP7 +-+++---
Application errors
ERR_STALL +-+-++---
ERR_INVALID_STARTUP_FSM_STATE ++-+-++---
ERR_HW_OVERCURRENT +++-+-++---
ERR_DCLINK_OVERVOLTAGE ++++-+-++---
ERR_DCLINK_UNDERVOLTAGE +-++-++---
ERR_DIRECTREVERSE ++-++-++---
ERR_SPEEDERROR +++-++-++---
Reset errors
ERR_RCON_TRAPR +-+-+++---

Microchip Technology Inc. Page 16


Refrigerator Compressor Reference Design User Guide

ERR_RCON_IOPUWR ++-+-+++---
ERR_RCON_CM +++-+-+++---
ERR_RCON_WDTO_ISR ++++-+-+++---
ERR_RCON_WDTO_MAINLOOP +-++-+++---

ERR_UNEXPECTED_INTERRUPT_BASE +-+-+-+-++---

In the tab above, a “+” represents LED blinking once with 50% duty @ 1.67Hz. A “-”
represents LED tuning off in the whole cycle of 1.67Hz.

2.4 Electrical Specifications

The electrical specifications of the RCDB board is in table below:

Tab 2-6 Electrical Specifications of RCDB board


No. Parameters Spec
1 Rated Input Voltage 220VAC 50/60Hz
2 Input Voltage range 90V~264V AC
3 Digital Voltage 3.3V
4 Rated Power 250W
5 Maximum Power 250W
6 PWM Frequency range 2.5kHz~15kHz
7 Operating Temperature -10℃ ~ +60℃
8 Board Efficiency 94%
9 Board Standby Power 0.5W
10 Board Size 130mm × 120mm × 40mm
11 Rectifier Y
12 Auxiliary Power Supply Y
13 PFC Circuitry N
14 Power Circuitry Discrete
15 Current Sensing Single Shunt, Internal Op-Amp in dsPIC®
16 DC Bus Voltage Sensing Y, Internal Op-Amp in dsPIC®
17 Temperature Sensing N
18 Hardware Over-Current Protection Y, Internal comparator in dsPIC®
19 In-rush current protection for DC bus Y, Power resistance and Relay

Microchip Technology Inc. Page 17


Refrigerator Compressor Reference Design User Guide

3 Setup and Run

The software of RCDRD is configured for Basic Operation. This chapter describes how to
setup the software, run the compressor and debug the code.

3.1 Basic Operation

Basic operation is to open the S/W project, configure and build the code and program the
chip on development board.
(1) Start MPLAB X IDE V5.10 and open the project “RCDRD_V1.0.X”.
Note: The project requires MPLAB X IDE V5.10 or later.

(2) Right click on this project on the left tab named “Project”, and select the last item
“Properties”.

On the “Project Properties” page you can select the programmer/debugger in


“hardware tool” section and select compiler (XC16 V1.33 or later) in “Compiler
toolchain” section. The “PICkit 3”/“PICkit 4” term can be found in Hardware Tools list

Microchip Technology Inc. Page 18


Refrigerator Compressor Reference Design User Guide

after connecting the Programmer/Debugger to laptop. Click “Apply” to apply the


selection.

(3) The RCDB board is a hot-ground design. It is prohibited to be powered when connects
with any other non-isolated tools and equipment, such as computer, laptop,
oscilloscope, etc. Programmer/Debugger is suggested to program the chip as it can
provide 3.3V to the board for programming.
After applying Programmer/Debugger selection (PICkit 3/PICkit 4), the “PICkit
3”/“PICkit 4” term can be found in “Categories” list in “Project Properties” window.

On “PICkit 3”/“PICkit 4” page, select “Power” item in “Option categories”. Check


“Power target circuit from PICkit3” item and select “3.25” on “Voltage level” item. Click
“OK” to apply the selection.

Microchip Technology Inc. Page 19


Refrigerator Compressor Reference Design User Guide

(4) Build the code by clicking the “Clean and Build Project” button on the toolbar or in the
“Production” menu.

or
(5) After a successful build, connect PICkit 3/PICkit 4 to RCDB CON203.

Download code to the chip by clicking “Make and Program” button on toolbar

Microchip Technology Inc. Page 20


Refrigerator Compressor Reference Design User Guide

Note: Before this step, make sure that the AC power supply is DISCONNECTED
to the board.
(6) Disconnect the PICkit3 with the board. Make sure RCDB is not connected with any
other non-isolated board or equipment.
(7) Connect a compressor or a motor on CON 100, connect the AC power supply on
CON300. Power on the development board. The board now is in STOPPED status, the
LED blinks 50% on @ 0.625Hz.

3.2 Run with Diagnostic Kernel

In terms of RCDRD prototype 1, the only way to run the compressor is by Diagnostic Kernel
function in code. The tool working with Diagnostic Kernel function is X2C Scope plugin and
MCP2200 Isolated USB to UART Demo Board. The X2C Scope is a plugin of MPLAB X
IDE to facilitate the debug job. It provides a complete feature to read and write variables in
dsPIC®’s data memory by means of UART. Furtherly it can plot those variables in a real
time mode.

Microchip Technology Inc. Page 21


Refrigerator Compressor Reference Design User Guide

(1) Install X2C Scope plugin. Select “Plugins” item from “Tools” menu. On “downloaded”
page, click “Add Plugins…” button, select “at-lcm-x2c-mplabscope.nbm” file. Click
“Install” to install X2C Scope plugin.

(2) Open the project properties (as in 3.1(2)) and enable “Load symbols when
programming or building for production (slows process)” during production builds in
“Loading” page.

(3) Connect the MCP2200 Isolated USB to UART Demo Board to computer and RCDB
by Dupont lines.

Microchip Technology Inc. Page 22


Refrigerator Compressor Reference Design User Guide

(4) Download the code to the driver board (as described in 3.1(4)(5)(6)), disconnect all
non-isolated devices.
Note: The code needs to be downloaded every time the board was power off and
on for connecting X2C Scope to MCU on board.
(5) Disconnect the Programmer/Debugger and power on the board

(6) Start X2C Scope by clicking “X2CScope” from “Embedded” on “Tools” menu. The
“X2C Scope Configuration” window will open.

Microchip Technology Inc. Page 23


Refrigerator Compressor Reference Design User Guide

(7) Set the parameters as picture below, select this RCDRD project in “Select Project”
button. Then click “Disconne…” button to connect computer to driver board.

Parameters setting

(8) On “Project Setup” page, “Scope Sampletime” configures the sample interval to
display in scopes time-axis. It must be the same value as the PWM cycle. In RCDRD,
it is 400 us (2.5kHz). The “watch sampletime” configures the refresh interval in the
“X2C Scope Watch” window. It should be bigger than PWM cycle. Click “Set Values”
to apply the setting.

Microchip Technology Inc. Page 24


Refrigerator Compressor Reference Design User Guide

(9) On “Data Views” page, click “Open Scope View” to open “X2C Scope Scope” window.
This window displays the wave form of variables. Click “Open Watch View” to open
“X2C Scope Watch” window. Variables value is displayed and changed in this window.
Only global variables can be added in these two windows.

Microchip Technology Inc. Page 25


Refrigerator Compressor Reference Design User Guide

For example, in below figure, three variables systemData.X2CVelocityReference,


systemData.X2CSystemStatesFlag and motor.faultDetect.faultDetectFlagBackup are
selected in “X2C Scope Watch” window. Variable systemData.X2CVelocityReference
is the reference electromagnetic speed of compressor motor, in the unit of RPM.
Variable systemData.X2CSystemStatesFlag is the system status flag. Variable
motor.faultDetect.faultDetectFlagBackup is the fault flag. More detail flag information
is description in Appendix A. Flag Description. You can add other variables you are
interested in.

(10)Add the variables which you want to observe in “X2C Scope Scope” window. For
example, add the reference velocity and feedback velocity, reference id/iq and
detected id/iq, output vd/vq, etc. Click the “SAMPLE” button to start sampling variables
and show the waves.

Microchip Technology Inc. Page 26


Refrigerator Compressor Reference Design User Guide

(11)Configure reference speed variable systemData.X2CVelocityReference with a data


bigger than minimum speed. The compressor will start to run. Scope Window will show
the variable waveforms in real time.

Scope window

Watch window

(11)At the end of the operation, remember to click “Connected” button to disconnect X2C
Scope to board.

(12)More detail of X2C Scope is described in file “X2CScope Documentation”.

3.3 Debug and Test by Test Harness

In FDCRD, there is a Test Harness component which provides an easy method to modify
the control operation mode of the commutation and motor control loops. It represents
several runtime parameters which are used to put the system into certain test modes. In

Microchip Technology Inc. Page 27


Refrigerator Compressor Reference Design User Guide

combination with other adjustable parameters used in motor control application, we can
debug and test proper operation of the compressor and board. it is tightly coupled to
commutation and motor control loops, as picture below.
(4) Set ωe (3) Set id/iq (2) Set Vd/Vq

FOC
id* Current PI Ud* U * Usa*

single shunt
SVPWM in
Inv Clarke
Inv Park
- controler PWM
Usb*
iq*
Duty M
e * Velocity PI Current PI Uq* U * Usc* cycle
- controller - controler

Single shunt
process

isa
id i

Clarke
isb Current

Park
iq i sample
isc

sin, cos Trigonometric r


calculation
e

d
(5) Set fe
dt

(6) Set θ

3.3.1 Debug and test operation by Test Harness


All the debug and test operation is set in “X2C Scope Watch” window.
(1) Start test mode
Set the key will run the control system into test mode. Otherwise, all other Test
Harness features are unavailable.
Start operation:
 Set systemData.testing.key = TEST_GUARD_VALID = 53670.
Stop operation:
 Set systemData.testing.key != TEST_GUARD_VALID != 53670.
(2) Set Vd and Vq directly
Bypass velocity loop and current loop and feed their output Vd/Vq with a setting value.
It is used to debug and test the SVPWM duty calculation function. This function only
sets the amplitude of the output voltage.
Start operation:
 Set motor.testing.overrideVdqCmd.d and motor.testing.overrideVdqCmd.q with
proper data. The values of these two variables are normalized.
 Set motor.testing.operatingMode = OM_FORCE_VOLTAGE_DQ = 1. The setting
Vd and Vq are available.
Stop operation:
 Set motor.testing.operatingMode = OM_DISABLED = 0. There is no output
voltage.
Related function:

Microchip Technology Inc. Page 28


Refrigerator Compressor Reference Design User Guide

 In combination with electromagnetic frequency in Feature (5) to set the output


voltage frequency.
 In combination with electromagnetic angle in Feature (6) to set the output voltage
of motor phase.
(3) Set idCmd and iqCmd directly
Bypass velocity loop and enable current loop and feed current reference id/iq with a
setting value directly. It can be used to debug and test current loop, tune PI parameters,
calibrate current sample, etc. This function only sets the amplitude of the output current.
Start operation:
 Set motor.testing.overrideIdqCmd.d and motor.testing.overrideIdqCmd.q with a
proper data. Attention that the values of these two variables are normalized.
 Set motor.testing.operatingMode = OM_FORCE_VOLTAGE_DQ = 2. Then the Id
and Iq will output as we set.
Stop operation:
 Set motor.testing.operatingMode = OM_DISABLED = 0. There is no output
current.
Related function:
 In combination with electromagnetic frequency in Feature (5) to set the output
current frequency.
 In combination with electromagnetic angle in Feature (6) to set the output current
of motor phase.
(4) Set reference speed directly
Set the speed command reference directly in FOC operation, ignore original speed
command. It is used to debug and test the velocity loop and tune PI parameters.
Start operation:
 Set motor.testing.operatingMode = OM_NORMAL = 3.
 Set motor.testing.overrideOmegaElectrical with proper data. Attention that the
variable is electromagnetic speed, unit is RPM.
 Set motor.testing.overrides = TEST_OVERRIDE_VELOCITY_COMMAND = 1.
 Start system. After startup period, the driver will spin the motor at the setting
reference speed.
Stop operation:
 Set motor.testing.overrides = 0. The original speed order is available.
(5) Set electromagnetic frequency directly
Set the electromagnetic frequency directly in commutation component, ignore the
estimated theta. Cooperate this feature with Feature (2) / Feature (3), the frequency
of output voltage / current can be set. If setting the frequency to 0, the output voltage
/ current is DC.
Start operation:
 Set motor.testing.overrideCommutationFrequency with proper data. Attention that
the variable is electromagnetic frequency of FOC, unit is Hz.
 Set motor.testing.overrides = TEST_OVERRIDE_COMMUTATION = 2.
 Set Feature (2) or Feature (3).
Stop operation:

Microchip Technology Inc. Page 29


Refrigerator Compressor Reference Design User Guide

 Set motor.testing.overrides = 0. The estimated frequency is available. Attention


that there is still output voltage or current which is set by Feature (2) or Feature
(3).
(6) Set electromagnetic theta
Set the electromagnetic theta directly in commutation component, ignore the estimated
theta. Cooperate this feature with feature (2) / feature (3), motor phase voltage / current
will be controlled to the setting value.
Start operation:
 Set motor.testing.overrideThetaElectrical with proper data. Attention that the
variable is electromagnetic theta of FOC, unit is normalized.
 Set motor.testing.overrides = TEST_OVERRIDE_COMMUTATION = 4
 Set Feature (2) or Feature (3).
Stop operation:
 Set motor.testing.overrides = 0. The estimated theta is available. Attention that
there is still output voltage or current which is set by Feature (2) or Feature (3).
(7) Time stamps
An array of 16-bit timestamps is part of the test harness state structure. These
timestamps are recorded in various places for profiling the main control process via
real-time diagnostic tools. The time stamp uses Timer 1 which runs at the system clock
rate (Fcy = 70MHz), so that the timer value indicates the elapsed system clock time.
Description of Time stamps array variables:
 motor.testing.timestamps[0]: The executing time before state machine start
 motor.testing.timestamps[1]: The executing time of performing all critical tasks
that are independent of the state.
 motor.testing.timestamps[2]: The executing time of determining next state.
 motor.testing.timestamps[3]: The executing time of updating state and executing
appropriate actions in the state.
 motor.testing.timestamps[4]: The executing time of performing all noncritical tasks
that are independent of the state.
 motor.testing.timestamps[7]: The executing time of other process, including UI,
Monitor, Watchdog, etc.
Operation:
 Add the timestamps array variables in X2C Scope.
3.3.2 Brief summary of the Test Harness setting
Conclude the Test Harness features and setting on the table below:

Tab 3-1 Brief summary of the Test Harness features and setting
on-off Parameter setting Control Setting
motor.t motor.t motor.t motor.t motor.tes motor.tes motor.t
Setting system motor.tes motor.t
esting. esting. esting. esting. ting.overr ting.overr esting.
Data.te ting.overr esting.
overrid overrid overrid overrid ideOmeg ideComm operati
sting.k ideTheta overrid
eVdqC eVdqC eIdqC eIdqC aElectric utationFr ngMod
Features ey Electrical es
md.d md.q md.d md.q al equency e
Set Vd and Vq 53670 value value —— —— —— —— —— 1 ——

Microchip Technology Inc. Page 30


Refrigerator Compressor Reference Design User Guide

Set Id and Iq 53670 —— —— value value —— —— —— 2 ——


Set speed 53670 —— —— —— —— value —— —— 3 1
Set frequency 53670 value value value value —— value —— 1/2 2
Set angle 53670 value value value value —— —— value 1/2 4
Disable !53670 —— —— —— —— —— —— —— —— ——

Microchip Technology Inc. Page 31


Refrigerator Compressor Reference Design User Guide

4 Run a Different Compressor

Motor control is a very motor and application dependency system. Compressor motor
control brings even more challenge in reliable startup and unbalanced load in every
mechanism revolution. RCDRD is targeted to provide an easy way to run with different part
number compressor. This chapter describes how to use RCDRD to run a compressor other
than the developers were using for debug and test.
To run a different compressor, some parameters need a modification to fit with the
compressor. All code files need to be modified are the header files in folder “parameters”
besides one C source file “opamp_comparator.c” in folder “hal”.

4.1 Modify theoretical arithmetic parameters

(1) Because dsPIC® is a fixed-point controller, the motor parameters cannot be used
straightly in code since they are fractional data. Therefore, we must convert the
physical units to fixed point PU format (mostly Q15). “tuning_params.xlsx” is provided
to implement this conversion. There are many parameters in the “tuning_params.xlsx”
file, which are described as below.

Tab 4-1 Parameter types in “tuning_params.xlsx”


Kinds Property Marks
Input Physical units of H/W board parameters.
Input Physical units of motor parameters.

Microchip Technology Inc. Page 32


Refrigerator Compressor Reference Design User Guide

Board and motor parameters in fixed-point


Output
format. Constant to set in "xxxx_parms.h".
Startup algorithm parameters in fixed-point
Output
format. Constant to set in "startup_params.h".
others Interim calculation data.

In order to get the fixed-point parameters, the motor parameters should be input in
“tuning_params.xlsx” as below.

The fixed-point format value is then be generated in the purple background cells. To
avoid saturation, resolution loss and truncation error caused by Q15 implementation,
it is recommended that the fixed-point data should be in the range of 6000-26000. If
the fixed-point data falls out of the recommended range (greater than 26000), the scale
“Q” should be adjusted to achieve the recommended range.
(2) Modify over-current threshold in register CVR (CVRCON<3:0>) in C source file
“hal/opamp_comparator.c”.

(3) Modify the parameters of estimator Angle Tracking Phase-Locked Loop (ATPLL) in
header file “parameters/atpll_params.h”.

Microchip Technology Inc. Page 33


Refrigerator Compressor Reference Design User Guide

(4) Modify software over-current threshold value of stall detection in header file
“parameters/fault_detect_params.h”.

(5) Modify motor parameters in header file “parameters/motor_params.h”.

(6) Modify parameters of Maximum Torque Per Ampere (MTPA) algorithm in header file
“parameters/mtpa_params.h”.

(7) Modify motor speed parameters in header file “parameters/operating_params.h”.

Microchip Technology Inc. Page 34


Refrigerator Compressor Reference Design User Guide

(8) Modify PI saturation threshold of velocity loop in header file


“parameters/sat_PI_params.h”.

(9) Modify parameters of startup algorithm in header file “parameters/startup_params.h”.

(10)Go back to Chapter 3 “Setup and Run” to program and run the code.

4.2 Debug parameters

4.2.1 Debug startup parameters


The startup algorithm in RCDRD is specialized for compressor application. It not only
improves the startup reliability, but also reduce vibration. All the startup algorithm
parameters are in header file “parameters/startup_params.h”. Some of them need to be
debugged when changing a compressor.
Refer to the Tab 4-2, in “Startup algorithm parameters” section of “tuning_params.xlsx”,
column “value” is the theoretical calculated value, the column “normalization” is the
normalized value. The column “revise” is the debugged value, the column “revise
normalization” is the normalized debugged value.

Tab 4-2 “Startup algorithm parameters” section of “tuning_params.xlsx”

Microchip Technology Inc. Page 35


Refrigerator Compressor Reference Design User Guide

Theoretical Debugged Normalized Normalized


value value theoretical value debugged value

Only a few parameters in the table above need fine-tuning when changing a compressor.
They are described as below.

Tab 4-3 Key parameters for startup


Parameters Description Debugging
STARTUP_FINALTOR
Open loop current Increase it if startup load was big
QUE
STARTUP_ACCELER Acceleration of the first velocity Increase it if shorter startup time.is
ATION0 accelerating state wanted
STARTUP_ACCELER Acceleration of the second velocity Increase it if shorter startup time.is
ATION1 accelerating state wanted
STARTUP_RAMPDO The current threshold for switching This parameter is always equal to open
WN_END_CURRENT open loop to close loop loop current in compressor application

4.2.2 Debug PI parameters


The PI controller parameters of current loop and velocity loop may need tuning when
changing compressor. All the PI parameters are in header file “parameters/for_params.h”.

Microchip Technology Inc. Page 36


Refrigerator Compressor Reference Design User Guide

The Kxx_Q (KIP_Q, KII_Q, KWP_Q and KWI_Q) is the scaler. Kp and Ki is multiplied by
2^Kxx_Q to get final PI controller data used in code. During the very early stage of the
debug job, changing this scaler value rather than Kp (Ki) will help reducing the debug time
to find a rough Kp (Ki) value.

Microchip Technology Inc. Page 37


Refrigerator Compressor Reference Design User Guide

5 Known Issues

(1) Computer can’t connect to RCDB with X2C Scope.


Several causes may lead this issue.
• Scenery 1: Open a new project in MPLAB X without disconnecting X2C Scope.

Work Around: Restart the MPLAB X and redownload the program to the board.
• Scenery 2: Sometimes the chip might fall in watchdog overtime protection. It
could be caused by some mistake when modifying the code. Check LED (LD200)
blink to get the chip operation status.
Work Around: Power off the RCDB. Re-connect the UART1 port and power on
the board.

Microchip Technology Inc. Page 38


Refrigerator Compressor Reference Design User Guide

Appendix A. Flag Description

All state flags of RCDRD are described in below tables.

Tab A-1 System state


System State
Variable motor.state
Flag enum
0 MCSM_RESTART
1 MCSM_STOPPED
2 MCSM_STARTING
3 MCSM_RUNNING
4 MCSM_STOPPING
5 MCSM_FAULT
6 MCSM_TEST_DISABLE
7 MCSM_TEST_ENABLE

Tab A-2 Error code


Error code
Variable motor.faultDetect.faultDetectFlagBackup
Flag Enum
1 OVERVOLTAGE
2 UNDERVOLTAGE
4 OVERCURRENT
8 DIRECTREVERSE
16 SPEEDERROR
32 STALL

Tab A-3 Stall detecting code


Stall code
Variable motor.stallDetect.stallDetectFlagBackup
Flag Enum
1 OVERCURRENT
2 LOSS_OF_LOCK
4 LOW_SPEED
8 TORQUE_ANGLE

Microchip Technology Inc. Page 39


Refrigerator Compressor Reference Design User Guide

Appendix B. Schematics

Microchip Technology Inc. Page 40


Refrigerator Compressor Reference Design User Guide

Microchip Technology Inc. Page 41


Refrigerator Compressor Reference Design User Guide

Microchip Technology Inc. Page 42

You might also like