This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: fast current loop&pwm immediate update

Part Number: TMS320F28379D
Other Parts Discussed in Thread: TMDXIDDK379D, C2000WARE

Hello:

The introduction of the fast current loop mentions the pwm immediate update mode, does this refer to CMPCTL [SHDWAMODE] = 1.

In this case, will it cause pwm update confusion, as mentioned in the figure below

  • When using immediate mode, you have to be more careful about when you write to the registers. Pick a safe spot where the value in your CMPs are not being used and then update them then.

    Nima

  • Thanks for your reply, I still can't figure out how to update pwm immediately. The code related to the fast current loop at  ‘C:\ti\c2000\C2000Ware_MotorControl_SDK_3_00_00_00\solutions\tmdxiddk379d\f2837x’  is as follows:

    FCL_initPWM(EPWM1_BASE, EPWM2_BASE, EPWM3_BASE);
    #define EPWM1_BASE 0x00004000U // EPWM1
    #define EPWM2_BASE 0x00004100U // EPWM2
    #define EPWM3_BASE 0x00004200U // EPWM3

    void FCL_initPWM(uint32_t baseA, uint32_t baseB, uint32_t baseC)
    {
    EPWM_disableCounterCompareShadowLoadMode(baseA, EPWM_COUNTER_COMPARE_A);
    EPWM_disableCounterCompareShadowLoadMode(baseB, EPWM_COUNTER_COMPARE_A);
    EPWM_disableCounterCompareShadowLoadMode(baseC, EPWM_COUNTER_COMPARE_A);
    pwmCompA = (uint32_t *)(baseA + EPWM_O_CMPA);
    pwmCompB = (uint32_t *)(baseB + EPWM_O_CMPA);
    pwmCompC = (uint32_t *)(baseC + EPWM_O_CMPA);
    return;
    }
    typedef enum
    {
    EPWM_COUNTER_COMPARE_A = 0, //!< counter compare A
    EPWM_COUNTER_COMPARE_B = 2, //!< counter compare B
    EPWM_COUNTER_COMPARE_C = 5, //!< counter compare C
    EPWM_COUNTER_COMPARE_D = 7 //!< counter compare D
    } EPWM_CounterCompareModule;

    static inline void
    EPWM_disableCounterCompareShadowLoadMode(uint32_t base,
    EPWM_CounterCompareModule compModule)
    {
    uint16_t shadowModeOffset;
    uint32_t registerOffset;

    //
    // Check the arguments
    //
    ASSERT(EPWM_isBaseValid(base));

    if((compModule == EPWM_COUNTER_COMPARE_A) ||
    (compModule == EPWM_COUNTER_COMPARE_C))
    {
    shadowModeOffset = 4U;
    }
    else
    {
    shadowModeOffset = 6U;
    }

    //
    // Get the register offset. EPWM_O_CMPCTL for A&B or
    // EPWM_O_CMPCTL2 for C&D
    //
    registerOffset = base + EPWM_O_CMPCTL + ((uint32_t)compModule & 0x1U);

    //
    // Disable shadow load mode.
    //
    HWREGH(registerOffset) = (HWREGH(registerOffset) |
    (0x1U << shadowModeOffset));
    }

    Among them:base=0x00004000U,compModule=0,so, registerOffset=0x00004000U+0x8U+0,points to EPWM_CMPCTL_LOADAMODE, according to the comments of the code, shouldn't it point to EPWM_CMPCTL_SHDWAMODE, to activate pwm immediate update mode?

    Is there anything wrong in my opinion?

    I'm very sorry to trouble you again.

    I've got it.Thank you all the same.