TIDUF77 June   2024 MSPM0G1507

 

  1.   1
  2.   Description
  3.   Resources
  4.   Features
  5.   Applications
  6.   6
  7. 1System Description
    1. 1.1 Terminology
    2. 1.2 Key System Specifications
  8. 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 MSPM0G1507
      3. 2.3.3 DRV7308
      4. 2.3.4 UCC28911
      5. 2.3.5 TLV9062
      6. 2.3.6 TLV74033
      7. 2.3.7 ISO6721B
      8. 2.3.8 TMP6131
    4. 2.4 System Design Theory
      1. 2.4.1 Hardware Design
        1. 2.4.1.1 Modular Design
        2. 2.4.1.2 Auxiliary Flyback Power Supply
        3. 2.4.1.3 DC Link Voltage Sensing
        4. 2.4.1.4 Inrush Current Protection
        5. 2.4.1.5 Motor Phase Voltage Sensing
        6. 2.4.1.6 Motor Phase Current Sensing
        7. 2.4.1.7 Over Current Protection of DRV7308
        8. 2.4.1.8 Internal Overcurrent Protection for TMS320F2800F137
      2. 2.4.2 Three-Phase PMSM Drive
        1. 2.4.2.1 Field-Oriented Control of PM Synchronous Motor
          1. 2.4.2.1.1 Space Vector Definition and Projection
            1. 2.4.2.1.1.1 ( a ,   b ) ⇒ ( α , β ) Clarke Transformation
            2. 2.4.2.1.1.2 α , β ⇒ ( d ,   q ) Park Transformation
          2. 2.4.2.1.2 Basic Scheme of FOC for AC Motor
          3. 2.4.2.1.3 Rotor Flux Position
        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 Hardware Prerequisites for Motor Drive
          1. 2.4.2.4.1 Motor Current Feedback
            1. 2.4.2.4.1.1 Three-Shunt Current Sensing
            2. 2.4.2.4.1.2 Single-Shunt Current Sensing
          2. 2.4.2.4.2 Motor Voltage Feedback
  9. 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
    2. 3.2 Getting Started GUI
      1. 3.2.1 Test Setup
      2. 3.2.2 Overview of GUI Software
      3. 3.2.3 Setup Serial Port
      4. 3.2.4 Motor Identification
      5. 3.2.5 Spin Motor
      6. 3.2.6 Motor Fault Status
      7. 3.2.7 Tune Control Parameters
      8. 3.2.8 Virtual Oscilloscope
    3. 3.3 Getting Started C2000 Firmware
      1. 3.3.1 Download and Install Software Required for Board Test
      2. 3.3.2 Opening Project Inside CCS
      3. 3.3.3 Project Structure
      4. 3.3.4 Test Procedure
        1. 3.3.4.1 Build Level 1: CPU and Board Setup
          1. 3.3.4.1.1 Start CCS and Open Project
          2. 3.3.4.1.2 Build and Load Project
          3. 3.3.4.1.3 Setup Debug Environment Windows
          4. 3.3.4.1.4 Run the Code
        2. 3.3.4.2 Build Level 2: Open-Loop Check With ADC Feedback
          1. 3.3.4.2.1 Start CCS and Open Project
          2. 3.3.4.2.2 Build and Load Project
          3. 3.3.4.2.3 Setup Debug Environment Windows
          4. 3.3.4.2.4 Run the Code
        3. 3.3.4.3 Build Level 3: Closed Current Loop Check
          1. 3.3.4.3.1 Start CCS and Open Project
          2. 3.3.4.3.2 Build and Load Project
          3. 3.3.4.3.3 Setup Debug Environment Windows
          4. 3.3.4.3.4 Run the Code
        4. 3.3.4.4 Build Level 4: Full Motor Drive Control
          1. 3.3.4.4.1 Start CCS and Open Project
          2. 3.3.4.4.2 Build and Load Project
          3. 3.3.4.4.3 Setup Debug Environment Windows
          4. 3.3.4.4.4 Run the Code
          5. 3.3.4.4.5 Tuning Motor Drive FOC Parameters
          6. 3.3.4.4.6 Tuning Field Weakening and MTPA Control Parameters
          7. 3.3.4.4.7 Tuning Current Sensing Parameters
    4. 3.4 Test Results
      1. 3.4.1  Fast and clean Rising/Falling Edge
      2. 3.4.2  Inrush Current Protection
      3. 3.4.3  Thermal performance under 300VDC
      4. 3.4.4  Thermal performance under 220VAC
      5. 3.4.5  Overcurrent Protection by Internal CMPSS
      6. 3.4.6  IPM Efficiency with External Bias Supply under 300VDC
      7. 3.4.7  Board Efficiency with Onboard Bias Supply under 300VDC
      8. 3.4.8  Board Efficiency with External Bias Supply under 220VAC
      9. 3.4.9  Board Efficiency with Onboard Bias Supply under 220VAC
      10. 3.4.10 iTHD Test of Motor Phase Current
      11. 3.4.11 Standby Power Test
    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
    6. 3.6 Getting Started MSPM0 Firmware
  10. 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 PCB Layout Recommendations
      4. 4.1.4 Altium Project
      5. 4.1.5 Gerber Files
    2. 4.2 Software Files
    3. 4.3 Documentation Support
    4. 4.4 Support Resources
    5. 4.5 Trademarks
  11. 5About the Author

Configure the PWM, CMPSS, and ADC Modules

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

Configure PWM and CMPSS base address for motor drive:

// EPWM
#define MTR1_PWM_U_BASE         EPWM2_BASE
#define MTR1_PWM_V_BASE         EPWM3_BASE
#define MTR1_PWM_W_BASE         EPWM4_BASE

// CMPSS->Iu/Iv/Iw
#define MTR1_CMPSS_U_BASE       CMPSSLITE3_BASE
#define MTR1_CMPSS_V_BASE       CMPSSLITE2_BASE
#define MTR1_CMPSS_W_BASE       CMPSSLITE4_BASE

Configure ADC base address and channels for motor drive:

// Three shunts
// Using ADCA/ADCC for current sensing
#define MTR1_ADC_TRIGGER_SOC     ADC_TRIGGER_EPWM2_SOCA  // EPWM2_SOCA

#define MTR1_ADC_I_SAMPLEWINDOW     14
#define MTR1_ADC_V_SAMPLEWINDOW     20

#define MTR1_IW_ADC_BASE        ADCC_BASE      // ADCC-A7/C3*/CMP4  -SOC1
#define MTR1_IV_ADC_BASE        ADCA_BASE      // ADCA-A4*/C14/CMP2 -SOC2
#define MTR1_IU_ADC_BASE        ADCA_BASE      // ADCA-A0*/C15/CMP3 -SOC1

#define MTR1_IW_ADCRES_BASE     ADCCRESULT_BASE         // ADCC-A7/C3*
#define MTR1_IV_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A4*/C14
#define MTR1_IU_ADCRES_BASE     ADCARESULT_BASE         // ADCA-A0*/C15

#define MTR1_IW_ADC_CH_NUM      ADC_CH_ADCIN3           // ADCC-A7/C3*
#define MTR1_IV_ADC_CH_NUM      ADC_CH_ADCIN4           // ADCA-A4*/C14
#define MTR1_IU_ADC_CH_NUM      ADC_CH_ADCIN0           // ADCA-A0*/C15

#define MTR1_IW_ADC_SOC_NUM   ADC_SOC_NUMBER1 // ADCC-A7/C3*  -SOC1-PPB1
#define MTR1_IV_ADC_SOC_NUM   ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2
#define MTR1_IU_ADC_SOC_NUM   ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1

#define MTR1_IW_ADC_PPB_NUM   ADC_PPB_NUMBER1 // ADCC-A7/C3*  -SOC1-PPB1
#define MTR1_IV_ADC_PPB_NUM   ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2
#define MTR1_IU_ADC_PPB_NUM   ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1

Configure peripheral interrupt for motor drive control:

// Interrupt
#define MTR1_PWM_INT_BASE  MTR1_PWM_U_BASE       // EPWM1
#define MTR1_ADC_INT_BASE  ADCC_BASE             // ADCC-A11/C0*-SOC4
#define MTR1_ADC_INT_NUM   ADC_INT_NUMBER1       // ADCC_INT1   -SOC4
#define MTR1_ADC_INT_SOC   ADC_SOC_NUMBER4       // ADCC_INT1   -SOC4

#define MTR1_PIE_INT_NUM   INT_ADCC1             // ADCC_INT1   -SOC4
#define MTR1_CPU_INT_NUM   INTERRUPT_CPU_INT1    // ADCC_INT1-CPU_INT1
#define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1  // ADCC_INT1-CPU_INT1

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

// CMPSS->Iu/Iv/Iw
#define MTR1_CMPSS_U_BASE       CMPSSLITE3_BASE
#define MTR1_CMPSS_V_BASE       CMPSSLITE2_BASE
#define MTR1_CMPSS_W_BASE       CMPSSLITE4_BASE

#define MTR1_IU_CMPHP_SEL   ASYSCTL_CMPHPMUX_SELECT_3  // CMPSS3H-A0*/C15
#define MTR1_IU_CMPLP_SEL   ASYSCTL_CMPLPMUX_SELECT_3  // CMPSS3L-A0*/C15

#define MTR1_IV_CMPHP_SEL   ASYSCTL_CMPHPMUX_SELECT_2  // CMPSS2H-A4*/C14
#define MTR1_IV_CMPLP_SEL   ASYSCTL_CMPLPMUX_SELECT_2  // CMPSS2L-A4*/C14

#define MTR1_IW_CMPHP_SEL   ASYSCTL_CMPHPMUX_SELECT_4  // CMPSS4H-A7/C3*
#define MTR1_IW_CMPLP_SEL   ASYSCTL_CMPLPMUX_SELECT_4  // CMPSS4L-A7/C3*

#define MTR1_IU_CMPHP_MUX       2                     // CMPSS4H-A7/C3*
#define MTR1_IU_CMPLP_MUX       2                     // CMPSS4L-A7/C3*

#define MTR1_IV_CMPHP_MUX       0                     // CMPSS2H-A4*/C14
#define MTR1_IV_CMPLP_MUX       0                     // CMPSS2L-A4*/C14

#define MTR1_IW_CMPHP_MUX       1                     // CMPSS3H-A0*/C15
#define MTR1_IW_CMPLP_MUX       1                     // CMPSS3L-A0*/C15

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 TMS320F280013x Real-Time Microcontrollers Technical Reference Manual.

// XBAR-EPWM
#define MTR1_XBAR_TRIP_ADDRL    XBAR_O_TRIP8MUX0TO15CFG
#define MTR1_XBAR_TRIP_ADDRH    XBAR_O_TRIP8MUX16TO31CFG

#define MTR1_XBAR_INPUT1        XBAR_INPUT1
#define MTR1_TZ_OSHT1           EPWM_TZ_SIGNAL_OSHT1

#define MTR1_XBAR_TRIP          XBAR_TRIP8
#define MTR1_DCTRIPIN           EPWM_DC_COMBINATIONAL_TRIPIN8y

// XBAR-EPWM->Iu/Iv/Iw
#define MTR1_IU_XBAR_EPWM_MUX   XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L      // CMPSS3-HP&LP, A0*/C15
#define MTR1_IV_XBAR_EPWM_MUX   XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L      // CMPSS2-HP&LP, A4*/C14
#define MTR1_IW_XBAR_EPWM_MUX   XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L      // CMPSS4-HP&LP, A7/C3*

#define MTR1_IU_XBAR_MUX        XBAR_MUX04      // CMPSS3-HP&LP, A0*/C15
#define MTR1_IV_XBAR_MUX        XBAR_MUX02      // CMPSS2-HP&LP, A4*/C14
#define MTR1_IW_XBAR_MUX        XBAR_MUX06      // CMPSS4-HP&LP, A7/C3*

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 hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor.

void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle)
{
    HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;

#if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1)
#if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS)
    uint16_t cmpsaDACH;
#endif  // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS)
    uint16_t cmpsaDACL;
    ... ...
#else   // !MOTOR1_DCLINKSS, Three-shunt
        cmpsaDACH = MTR1_CMPSS_DACH_VALUE;
        cmpsaDACL = MTR1_CMPSS_DACL_VALUE;

        ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX);

        ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX);

        ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX);
    ... ...
    return;
} // end of HAL_setupCMPSSs() function

The CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes.

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

    // Configure TRIP 7 to OR the High and Low trips from both
    // comparator 5, 3 & 1, clear everything first
    EALLOW;
    HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0;
    HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0;
    EDIS;
    ... ...
        // What do we want the OST/CBC events to do?
        // TZA events can force EPWMxA
        // TZB events can force EPWMxB
        EPWM_setTripZoneAction(obj->pwmHandle[cnt],
                               EPWM_TZ_ACTION_EVENT_TZA,
                               EPWM_TZ_ACTION_LOW);

        EPWM_setTripZoneAction(obj->pwmHandle[cnt],
                               EPWM_TZ_ACTION_EVENT_TZB,
                               EPWM_TZ_ACTION_LOW);
    ... ...
    // Clear any spurious fault
    EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL);
    EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL);
    EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL);

    return;
}

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

void HAL_setupGPIOs(HAL_Handle handle)
{
    ... ...
    // GPIO2->EPWM2A->M1_UH
    GPIO_setPinConfig(GPIO_2_EPWM2_A);
    GPIO_writePin(2, 0);
    GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);

    // GPIO3->EPWM2B->M1_UL
    GPIO_setPinConfig(GPIO_3_EPWM2_B);
    GPIO_writePin(3, 0);
    GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD);
    ... ...
    return;
}  // end of HAL_setupGPIOs() function

The configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control.

static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle)
{
    HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;

    obj->flagEnablePWM = true;

#if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1)
    if(obj->motorNum == MTR_1)
    {
#if defined(MOTOR1_DCLINKSS)
        // Clear any comparator digital filter output latch
        CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]);
#else   // !MOTOR1_DCLINKSS
        // Clear any comparator digital filter output latch
        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]);

        CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]);

        CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]);
    ... ...
    return;
} // end of HAL_enableMtrPWM() function
static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle)
{
    HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;
    ... ...
#if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2)
    // Clear any comparator digital filter output latch
    CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]);
    CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]);

    CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]);
    CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]);

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