JAJU802A January   2022  – October 2022

 

  1.   概要
  2.   リソース
  3.   特長
  4.   アプリケーション
  5.   5
  6. 1System Description
    1. 1.1 Key System Specifications
  7. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
    3. 2.3 Highlighted Products
      1. 2.3.1 TMS320F2800137
      2. 2.3.2 TMS320F280025C
      3. 2.3.3 TMS320F280039C
      4. 2.3.4 UCC28740
      5. 2.3.5 UCC27517
      6. 2.3.6 TLV9062
      7. 2.3.7 TLV76733
    4. 2.4 System Design Theory
      1. 2.4.1 Interleaved PFC
        1. 2.4.1.1 Full Bridge Diode Rectifier Rating
        2. 2.4.1.2 Inductor Ratings
        3. 2.4.1.3 AC Voltage Sensing
        4. 2.4.1.4 DC Link Voltage Sensing
        5. 2.4.1.5 Bus Current Sensing
        6. 2.4.1.6 DC Link Capacitor Rating
        7. 2.4.1.7 MOSFET Ratings
        8. 2.4.1.8 Diode Ratings
      2. 2.4.2 Three-Phase PMSM Drive
        1. 2.4.2.1 Field Oriented Control of PM Synchronous Motor
        2. 2.4.2.2 Sensorless Control of PM Synchronous Motor
          1. 2.4.2.2.1 Enhanced Sliding Mode Observer with Phase Locked Loop
            1. 2.4.2.2.1.1 Mathematical Model and FOC Structure of an IPMSM
            2. 2.4.2.2.1.2 Design of ESMO for the IPMSM
            3. 2.4.2.2.1.3 Rotor Position and Speed Estimation with PLL
        3. 2.4.2.3 Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control
        4. 2.4.2.4 Compressor Drive with Automatic Vibration Compensation
        5. 2.4.2.5 Fan Drive with Flying Start
        6. 2.4.2.6 Hardware Prerequisites for Motor Drive
          1. 2.4.2.6.1 Motor Current Feedback
            1. 2.4.2.6.1.1 Current Sensing with Three-Shunt
            2. 2.4.2.6.1.2 Current Sensing with Single-Shunt
          2. 2.4.2.6.2 Motor Voltage Feedback
  8. 3Hardware, Software, Testing Requirements, and Test Results
    1. 3.1 Getting Started Hardware
      1. 3.1.1 Hardware Board Overview
      2. 3.1.2 Test Conditions
      3. 3.1.3 Test Equipment Required for Board Validation
      4. 3.1.4 Test Setup
    2. 3.2 Getting Started Firmware
      1. 3.2.1 Download and Install Software Required for Board Test
      2. 3.2.2 Opening Project Inside CCS
      3. 3.2.3 Project Structure
    3. 3.3 Test Procedure
      1. 3.3.1 Build Level 1: CPU and Board Setup
        1. 3.3.1.1 Start CCS and Open Project
        2. 3.3.1.2 Build and Load Project
        3. 3.3.1.3 Setup Debug Environment Windows
        4. 3.3.1.4 Run the Code
      2. 3.3.2 Build Level 2: Open Loop Check with ADC Feedback
        1. 3.3.2.1 Start CCS and Open Project
        2. 3.3.2.2 Build and Load Project
        3. 3.3.2.3 Setup Debug Environment Windows
        4. 3.3.2.4 Run the Code
      3. 3.3.3 Build Level 3: Closed Current Loop Check
        1. 3.3.3.1 Start CCS and Open Project
        2. 3.3.3.2 Build and Load Project
        3. 3.3.3.3 Setup Debug Environment Windows
        4. 3.3.3.4 Run the Code
      4. 3.3.4 Build Level 4: Full PFC and Motor Drive Control
        1. 3.3.4.1  Start CCS and Open Project
        2. 3.3.4.2  Build and Load Project
        3. 3.3.4.3  Setup Debug Environment Windows
        4. 3.3.4.4  Run the Code
        5. 3.3.4.5  Run the System
        6. 3.3.4.6  Tuning Motor Drive FOC Parameters
        7. 3.3.4.7  Tuning PFC Parameters
        8. 3.3.4.8  Tuning Field Weakening and MTPA Control Parameters
        9. 3.3.4.9  Tuning Flying Start Control Parameters
        10. 3.3.4.10 Tuning Vibration Compensation Parameters
        11. 3.3.4.11 Tuning Current Sensing Parameters
    4. 3.4 Test Results
      1. 3.4.1 Performance Data and Curves
      2. 3.4.2 Functional Waveforms
      3. 3.4.3 Transient Waveforms
      4. 3.4.4 MCU CPU Load, Memory and Peripherals Usage
        1. 3.4.4.1 CPU Load for Full Implementation
        2. 3.4.4.2 Memory Usage
        3. 3.4.4.3 Peripherals Usage
    5. 3.5 Migrate Firmware to a New Hardware Board
      1. 3.5.1 Configure the PWM, CMPSS, and ADC Modules
      2. 3.5.2 Setup Hardware Board Parameters
      3. 3.5.3 Configure Faults Protection Parameters
      4. 3.5.4 Setup Motor Electrical Parameters
      5. 3.5.5 Setup PFC Control Parameters
  9. 4Design and Documentation Support
    1. 4.1 Design Files
      1. 4.1.1 Schematics
      2. 4.1.2 Bill of Materials
      3. 4.1.3 Altium Project
      4. 4.1.4 Gerber Files
      5. 4.1.5 PCB Layout Guidelines
    2. 4.2 Software Files
    3. 4.3 Documentation Support
    4. 4.4 サポート・リソース
    5. 4.5 Trademarks
  10. 5Terminology
  11. 6Revision History

Configure the PWM, CMPSS, and ADC Modules

The application parameters to control the motors and PFC are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, ADC of compressor motor defines are shown in the following codes.

Configure PWM and CMPSS base address for compressor motor drive

// EPWM
#define MTR1_PWM_U_BASE         EPWM3_BASE
#define MTR1_PWM_V_BASE         EPWM5_BASE
#define MTR1_PWM_W_BASE         EPWM6_BASE

// CMPSS
#define MTR1_CMPSS_U_BASE       CMPSS1_BASE
#define MTR1_CMPSS_V_BASE       CMPSS3_BASE
#define MTR1_CMPSS_W_BASE       CMPSS3_BASE

Configure ADC base address and channels for compressor motor drive

// ADC
#define MTR1_ADC_TRIGGER_SOC     ADC_TRIGGER_EPWM1_SOCA  // EPWM1_SOCA
#define MTR1_ADC_SAMPLE_WINDOW  14

#define MTR1_IU_ADC_BASE        ADCA_BASE               // ADCA-A11*/C0
#define MTR1_IV_ADC_BASE        ADCA_BASE               // ADCA-A5*/C2
#define MTR1_IW_ADC_BASE        ADCA_BASE               // ADCA-A0*/C15
#define MTR1_VU_ADC_BASE        ADCA_BASE               // ADCA-A7*/C3
#define MTR1_VV_ADC_BASE        ADCA_BASE               // ADCA-A12*/C1
#define MTR1_VW_ADC_BASE        ADCA_BASE               // ADCA-A1*
#define MTR1_VDC_ADC_BASE       PFC_VDC_ADC_BASE        // ADCC-A4/C14*

#define MTR1_IU_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A11*/C0
#define MTR1_IV_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A5*/C2
#define MTR1_IW_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A0*/C15
#define MTR1_VU_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A7*/C3
#define MTR1_VV_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A12*/C1
#define MTR1_VW_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A1*
#define MTR1_VDC_ADCRES_BASE    PFC_VDC_ADCRES_BASE     // ADCC-A4/C14*

#define MTR1_IU_ADC_CH_NUM      ADC_CH_ADCIN11          // ADCA-A11*/C0
#define MTR1_IV_ADC_CH_NUM      ADC_CH_ADCIN5           // ADCA-A5*/C2
#define MTR1_IW_ADC_CH_NUM      ADC_CH_ADCIN0           // ADCA-A0*/C15
#define MTR1_VU_ADC_CH_NUM      ADC_CH_ADCIN7           // ADCA-A7*/C3
#define MTR1_VV_ADC_CH_NUM      ADC_CH_ADCIN12          // ADCA-A12*/C1
#define MTR1_VW_ADC_CH_NUM      ADC_CH_ADCIN1           // ADCA-A1*
#define MTR1_VDC_ADC_CH_NUM     PFC_VDC_ADC_CH_NUM      // ADCC-A4/C14*

#define MTR1_IU_ADC_SOC_NUM     ADC_SOC_NUMBER0         // ADCA-A11*/C0-SOC0
#define MTR1_IV_ADC_SOC_NUM     ADC_SOC_NUMBER1         // ADCA-A5*/C2 -SOC1
#define MTR1_IW_ADC_SOC_NUM     ADC_SOC_NUMBER2         // ADCA-A0*/C15-SOC2
#define MTR1_VU_ADC_SOC_NUM     ADC_SOC_NUMBER3         // ADCA-A7*/C3 -SOC3
#define MTR1_VV_ADC_SOC_NUM     ADC_SOC_NUMBER4         // ADCA-A12*/C1-SOC4
#define MTR1_VW_ADC_SOC_NUM     ADC_SOC_NUMBER5         // ADCA-A1*    -SOC5
#define MTR1_VDC_ADC_SOC_NUM    PFC_VDC_ADC_SOC_NUM     // ADCC-A4/C14*

Configure peripheral interrupt for compressor motor drive control

// Interrupt
#define MTR1_ADC_INT_BASE       ADCA_BASE               // ADCA-A1  -SOC5
#define MTR1_ADC_INT_NUM        ADC_INT_NUMBER2         // ADCA_INT2-SOC5
#define MTR1_ADC_INT_SOC        ADC_SOC_NUMBER6         // ADCA_INT2-SOC5
#define MTR1_PIE_INT_NUM        INT_ADCA2               // ADCA_INT2-SOC5
#define MTR1_CPU_INT_NUM        INTERRUPT_CPU_INT10     // ADCA_INT2-CPU_INT10
#define MTR1_INT_ACK_GROUP      INTERRUPT_ACK_GROUP10   // ADCA_INT2-CPU_INT10

Configure the connections between ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins and Internal Connections in TMS320F28002x Real-Time Microcontrollers Technical Reference Manual, TMS320F28003x Real-Time Microcontrollers Technical Reference Manual, or TMS320F280013x Real-Time Microcontrollers Technical Reference Manual

// ADC pins connection to CMPSS
#define MTR1_IU_CMPHP_SEL       ASYSCTL_CMPHPMUX_SELECT_1    //A11*/C0, CMPSS1-HP
#define MTR1_IU_CMPLP_SEL       ASYSCTL_CMPLPMUX_SELECT_1    //A11*/C0, CMPSS1-LP, N/A

#define MTR1_IV_CMPLP_SEL       ASYSCTL_CMPLPMUX_SELECT_3    //A5*/C2,  CMPSS3-LP

#define MTR1_IW_CMPLP_SEL       ASYSCTL_CMPLPMUX_SELECT_3    //A0*/C15, CMPSS3-LP, N/A

#define MTR1_IU_CMPHP_MUX       1                            //A11*/C0, CMPSS1-HP
#define MTR1_IU_CMPLP_MUX       1                            //A11*/C0, CMPSS1-LP, N/A

#define MTR1_IV_CMPLP_MUX       1                            //A5*/C2,  CMPSS3-LP, N/A

#define MTR1_IW_CMPLP_MUX       2                            //A0*/C15, CMPSS3-LP, N/A

Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR Mux Configuration Table and Table, OUTPUT X-BAR Mux Configuration Table in TMS320F28002x Real-Time Microcontrollers Technical Reference Manual, TMS320F28003x Real-Time Microcontrollers Technical Reference Manual, or TMS320F280013x Real-Time Microcontrollers Technical Reference Manual.

// XBARINTPUT to EPWM
#define MTR1_XBAR_TRIP_ADDRL    XBAR_O_TRIP7MUX0TO15CFG
#define MTR1_XBAR_TRIP_ADDRH    XBAR_O_TRIP7MUX16TO31CFG

#define MTR1_IU_XBAR_EPWM_MUX   XBAR_EPWM_MUX00_CMPSS1_CTRIPH       // CMPSS1-HP
#define MTR1_IV_XBAR_EPWM_MUX   XBAR_EPWM_MUX05_CMPSS3_CTRIPL       // CMPSS3-LP
#define MTR1_IW_XBAR_EPWM_MUX   XBAR_EPWM_MUX05_CMPSS3_CTRIPL       // CMPSS3-LP, N/A

#define MTR1_IU_XBAR_MUX        XBAR_MUX00          // CMPSS1-HP
#define MTR1_IV_XBAR_MUX        XBAR_MUX05          // CMPSS3-LP
#define MTR1_IW_XBAR_MUX        XBAR_MUX05          // CMPSS3-LP

#define MTR1_XBAR_INPUT         XBAR_INPUT1
#define MTR1_TZ_OSHT            EPWM_TZ_SIGNAL_OSHT1
#define MTR1_XBAR_TRIP          XBAR_TRIP7
#define MTR1_DCTRIPIN           EPWM_DC_COMBINATIONAL_TRIPIN7

The related ADC channels are used for motor current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the file of hal.c as the following codes. Compressor motor control uses two CMPSS modules, two analog comparators of each CMPSS are used to implement positive and negative overcurrent protection of U-phase and V-phase of the motor.

// HAL_setupCMPSSsMTR
void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle)
{
    HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;
    uint16_t cmpsaDACH;
    uint16_t cmpsaDACL;

    // Refer to the Table 9-2 in Chapter 9 of TMS320F28004x
    // Technical Reference Manual (SPRUI33B), to configure the ePWM X-Bar
    if(obj->motorNum == MTR_1)
    {
        cmpsaDACH = MTR1_CMPSS_DACH_VALUE;
        cmpsaDACL = MTR1_CMPSS_DACL_VALUE;

        ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX);

        ASysCtl_selectCMPLPMux(MTR1_IV_CMPLP_SEL, MTR1_IV_CMPLP_MUX);

        // --------------- U-Phase ---------------------------------------------
        // Enable CMPSS and configure the negative input signal to come from the DAC
        CMPSS_enableModule(obj->cmpssHandle[0]);
}

The CMPSS-generated signals go to the X-Bar, where they can be combined in different and unique fashions to flag unique trip events from multiple sources to implement the fault protection. The faults include the over-current signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the file of hal.c as the following codes.

void HAL_setupMtrFaults(HAL_MTR_Handle handle)
{
    HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;
    uint16_t cnt;

    uint16_t tzSignal;
    uint16_t dcTripIn;
    if(obj->motorNum == MTR_1)
    {
    }
    else if(obj->motorNum == MTR_2)
    {
    }
}

Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the file of hal.c as the following codes.

void HAL_setupGPIOs(HAL_Handle handle)
{
    // GPIO0->EPWM1A->M2/FAN_UH
    GPIO_setPinConfig(GPIO_0_EPWM1_A);
    GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
    return;
}  // end of HAL_setupGPIOs() function

As described above, to configure the PWM, ADC, CMPSS and fault protection for fan motor and PFC control based on the hardware. The PFC uses HAL_setupCMPSSsPFC(), and HAL_setupPFCFaults().

Also need to change the configuration codes in HAL_enableMtrPWM(), HAL_enablePFCPWM(), HAL_clearMtrFaultStatus(), and HAL_clearPFCFaultStatus() in hal.h file as below marked bold according to the used CMPSS for motor and PFC control.

static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle)
{
    HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;
    if(obj->motorNum == MTR_1)
    {
        // Clear any comparator digital filter output latch
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]);
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]);
        CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]);
    }
    else if(obj->motorNum == MTR_2)
    {
        // Clear any comparator digital filter output latch
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]);
        CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]);
        CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]);
    }
... ...
    return;
} // end of HAL_enableMtrPWM() function
static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle)
{
    if(obj->motorNum == MTR_1)
    {
        // Clear any comparator digital filter output latch
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]);
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]);
        CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]);
    }
    else if(obj->motorNum == MTR_2)
    {
        // Clear any comparator digital filter output latch
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]);

        CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]);
        CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]);
    }
... ...
    return;
} // end of HAL_clearMtrFaultStatus() function