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.

TMS320F280039C: EPWM_skipping triangular compare_function_But to use dead band functionality.

Part Number: TMS320F280039C
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Hi,

I want to use an epwm of c2000 controller. I have a custom algorithm, where I have a pulse state (on/off) of the inverter is the output of my logic. So that is why, I don't want to use the Compare function and EPWM1A and EPWM1B compare value updating. But I wish to use the dead band feature of EPWM. So, at what point I need to update the pulse output of my logic. For example, ISR rate is 4kHZ TBPRD is 12500. I want to turn on the top switch and bottom switch to off of a leg of inverter. Here, I don't have a modulating wave, that is why I want to skip the CMPA CMPB functionality. Please suggest me the function in EPWM that helps me to use dead band.

Thank you 

  • Hi Dharmendra,

    If CMPA and CMPB are not in control of outputs A and B, what events do you want to trigger the changing of the outputs? There are several ways to control the outputs directly such as through trip-zone or action qualifier software force, inverting the signals via the dead-band module can also work but this is not the intended use-case for the dead-band module. Could you provide some explanation or diagram of what events should affect the PWM outputs and when?

    Thank you,

    Luke

  • Hi Jones,

    I am building an custom algorithm for inverter switching. Where, my outputs are ON/OFF states of the inverter. i.e., it is not a modulating wave and no need to compare the with the triangular. But, I want to use the deadband functionality of the epwm. That is why, i want to know where I need to update the EPWM BASE after the Action qualifier or some where ?and how to use it is my question. Here I am attatching a screen shot of the custom algorithm. and EPWMA and EPWMB sequence i am getting from my algorithm with an ISR rate of 4kHZ. I just want to provide deadband to the outputs. The updation happens with ISR rate.is it possible to bypass or disable AQ functionality and to use deadband directly.

    Thank you

  • Hi Dharmendra,

    Let me know if the following is correct:

    • Your EPWM should have a constant duty cycle of 50%
    • output B should always be inverted from output A

    The following diagram in the TRM shows the common operating modes of the dead-band module:

    This table shows the necessary settings for each of the above modes:

    The following diagram shows how the dead-band module operates with the appropriate registers and bitfields:

    If you are using SysConfig, you can select one of the classical operating modes and then simply configure your rising edge and falling edge delays. I would recommend trying one of the epwm dead-band examples in C2000Ware to understand how the dead-band module works.

    Let me know if you have any further questions.

    Thank you,

    Luke

  • Hi jones,

    1.The EPWMA and EPWMB are complementary.

    2.But those are not of 50% duty cycle. It is variable duty cycle.

    I have referred the reference manual and the sysconfig examples also. I understood that, I have to change the Action qualifier output or deadband input epwm.

    EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);

    EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);

    EPWM_setActionQualifierContSWForceAction(EPWM1_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_SW_OUTPUT_HIGH);

    But the EPWM_AQ_OUTPUT_A can be settable based on the following events

    - event
    //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO - Time base counter equals
    //! zero
    //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD - Time base counter equals
    //! period
    //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA - Time base counter up equals
    //! COMPA
    //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA - Time base counter down
    //! equals COMPA
    //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB - Time base counter up equals
    //! COMPB
    //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB - Time base counter down
    //! equals COMPB
    //! - EPWM_AQ_OUTPUT_ON_T1_COUNT_UP - T1 event on count up
    //! - EPWM_AQ_OUTPUT_ON_T1_COUNT_DOWN - T1 event on count down
    //! - EPWM_AQ_OUTPUT_ON_T2_COUNT_UP - T2 event on count up
    //! - EPWM_AQ_OUTPUT_ON_T2_COUNT_DOWN - T2 event on count down

    But those are again carrier dependents and CMPA and CMPB.

    I want to make AQOUTPUT_A based on my custom algorithm output as (1 or zero ) or TBPRD I wasn't sure. 

    There by the deadband can be utilized.

    Thank you 

  • Hi Dharmendra,

    My apologies I am still unclear on why you do not want to use the action qualifier module. I'm assuming you are using up-down count mode and want a rising edge on CMPA_UP and a falling edge on CMPA_DOWN. What exactly are you trying to accomplish using the dead-band module? Are you trying to apply rising edge or falling edge delay to the signal coming from the action qualifier module? If you don't use the action qualifier module, there will be no rising or falling edges to apply a delay to, so the dead-band module will be useless besides being able to invert output A or output B for an entire period.

    Could you provide an example of the PWM waveform you want to achieve along with the inputs to your algorithm that would result in that waveform? From there I can offer suggestions of how you would achieve this PWM output.

    Thank you,

    Luke

  • Hi Luke,

    I am working on a customized algorithm known as Finite set Model predictive control, unfortunately which doesn't provide modulating wave and gives direct switching states of the inverter. The output of my algorithm is either ON/OFF commands of the top switch (EPWMA) of an inverter leg. Obviously, the bottom leg (EPWMB) should be complementary. My algorithm no need of triangular comparison, that is why I don't want to use the triangular at all. But I want to use the deadband functionality alone of the epwm. That means I already has what should be the inverter state and no need of comparison with triangular Hence, up/down or up-down count these all I don't want to use.

    The example for your reference are, switching pattern which doesn't have a fixed duty cycle as follows.  Hence, I wish to bypass the Action qualifier and want to update the output of the AQ ePWM outputs directly.

    Thank you

  • Hi Dharmendra,

    Thank you for the explanation. Is the ON/OFF command coming from an external device, or is this calculated by the F280039C device? There are a few different ways you could implement this:

    • Use the action qualifier software force (this will be asynchronous to your EPWM period)
    • If the ON/OFF command is coming from an external device as a high or low signal, you can use the CLB to take that signal in as an input, send it to the CLB output, and override the output of the EPWMA action qualifier, and then apply dead-band as you would normally.
    • Update the action qualifier settings between each period to either set or clear EPWMA on CTR=zero depending on the ON/OFF status. This would be synchronous to your EPWM period but there would be a delay between the ON/OFF command and when it's reflected in the output.

    Let me know which of these solutions would be most suitable for your application, I can provide assistance on implementing your chosen solution.

    Thank you,

    Luke

  • Hi Luke,

    The ON/OFF command is not coming from external. It is a custom algorithm that was written in code itself.

    That is nothing but action qualifier output.

    The suggestions you provided, in that  AQ depends on CTR, algorithm must be independent of counter. That's the problem luke.

    That is why I am asking, How can we send the algorithm output to the AQ outputs.

    In a simple words, if you have a ON/OFF states of epwmxA and epwmxB you  want provide deadband to the  sequence.

    Thank you

  • Hi Dharmendra,

    Are you using the continuous action qualifier software force or the one-time action qualifier software force? By default, the continuous action qualifier force is dependent on TBCR=0, however you can configure this to be independent TBCTR=0 and the action qualifier event can take effect on the next TBCLK edge. The one-time software force always takes effect on the next TBCLK edge. This is controlled through the AQSFRC and AQCSFRC registers.

  • Hi Luke,

    Actually, it didn't solve the requireme to provide the deadband.Because time base clk acts faster than the ISR rate. Here rising edge and falling edge pwmDBcnt used as 700.Here you may see the code snippet


    AQ_state1 = (1 + (1 * sabc.value[0]));
    if (AQ_state1 == 1)
    {
    EPWM_setCounterCompareValue(
    EPWM1_BASE,
    EPWM_COUNTER_COMPARE_A, 11500);
    EPWM_setActionQualifierSWAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW);

    }
    if (AQ_state1 == 2)
    {
    EPWM_setCounterCompareValue(
    EPWM1_BASE,
    EPWM_COUNTER_COMPARE_A, 1000);
    EPWM_setActionQualifierSWAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH);
    }
    AQ_state2 = (1 + (1 * sabc.value[1]));
    if (AQ_state2 == 1)
    {
    EPWM_setCounterCompareValue(
    EPWM2_BASE,
    EPWM_COUNTER_COMPARE_A, 11500);
    EPWM_setActionQualifierSWAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW);
    }
    if (AQ_state2 == 2)
    {
    EPWM_setActionQualifierSWAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH);
    EPWM_setCounterCompareValue(
    EPWM2_BASE,
    EPWM_COUNTER_COMPARE_A, 1000);
    }
    AQ_state3 = (1 + (1 * sabc.value[2]));
    if (AQ_state3 == 1)
    {
    EPWM_setCounterCompareValue(
    EPWM5_BASE,
    EPWM_COUNTER_COMPARE_A, 11500);
    EPWM_setActionQualifierSWAction(EPWM5_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW);
    }
    if (AQ_state3 == 2)
    {
    EPWM_setCounterCompareValue(
    EPWM5_BASE,
    EPWM_COUNTER_COMPARE_A, 1000);
    EPWM_setActionQualifierSWAction(EPWM5_BASE, EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH);
    }
    EPWM_forceActionQualifierSWAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B);
    EPWM_forceActionQualifierSWAction(EPWM2_BASE, EPWM_AQ_OUTPUT_B);
    EPWM_forceActionQualifierSWAction(EPWM5_BASE, EPWM_AQ_OUTPUT_B);

    As of my understandng, it is not possible with the epwm. Lets try another approach with GPIO's. where, I can directly assign the state of GPIO of top switch of an inverter leg as sabc.value[0] (which is an output of custom algorithm) and not of the sabc to the bottom switch of the same leg. Now the hurdle is, How to create a deadband between those two if GPIO's are directly used. instead of epwm

    GPIO_writePin(0, sabc.value[0]); //epwm1A
    GPIO_writePin(1, !(sabc.value[0])); //epwm1B
    GPIO_writePin(2, sabc.value[1]); //epwm2A
    GPIO_writePin(3, !(sabc.value[1])); //epwm2B
    GPIO_writePin(16, sabc.value[2]); //epwm5A
    GPIO_writePin(17, !(sabc.value[2])); //epwm5B

    But how to provide deadband of 3or 4us with to between the two pulses of a same leg.

    Thank you.

  • Hi Dharmendra,

    You will not have much control of the timing by writing to GPIOs directly, I'm not sure how you would achieve a precise 4us deadband between the two signals' edges using this approach.

    I noticed you are forcing the action qualifier event on output B in your code. If the dead-band module is using output A to derive both outputs, this code will not have any effect on your output. Could you try changing this to EPWM_forceActionQualifierSWAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A)?

    What do you mean by this statement:

    "Because time base clk acts faster than the ISR rate."

    Do you mean your ISR lasts longer than a single EPWM period? I thought you were not using the PWM period in your application, so why would this be relevant? 

    If you could provide a scope shot of your current waveform using PWM and describe what is wrong with the waveform that would be helpful.

    Thank you,

    Luke