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.

TMS320F280049C: Action Qualifier problem

Part Number: TMS320F280049C


Can you help me to see what is wrong with the Action Qualifier part of the code? Run it and say that it can not open the file.

//#############################################################################
//
// FILE:   epwm_ex1_trip_zone.c
//
// TITLE:  ePWM Using Trip-Zone Submodule.
//
//! \addtogroup driver_example_list
//! <h1>ePWM Trip Zone</h1>
//!
//! This example configures ePWM1 and ePWM2 as follows
//!  - ePWM1 has TZ1 as one shot trip source
//!  - ePWM2 has TZ1 as cycle by cycle trip source
//!
//! Initially tie TZ1 high. During the test, monitor ePWM1 or ePWM2
//! outputs on a scope. Pull TZ1 low to see the effect.
//!
//!  \b External \b Connections \n
//!  - ePWM1A is on GPIO0
//!  - ePWM2A is on GPIO2
//!  - TZ1 is on GPIO12
//!
//! This example also makes use of the Input X-BAR. GPIO12 (the external
//! trigger) is routed to the input X-BAR, from which it is routed to TZ1.
//!
//! The TZ-Event is defined such that ePWM1A will undergo a One-Shot Trip
//! and ePWM2A will undergo a Cycle-By-Cycle Trip.
//!
//              _____________             __________________
//              |           |             |                |
//  GPIO12 -----| I/P X-BAR |-----TZ1-----| ePWM TZ Module |-----TZ-Event
//              |___________|             |________________|
//
//
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions 
// are met:
// 
//   Redistributions of source code must retain the above copyright 
//   notice, this list of conditions and the following disclaimer.
// 
//   Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the 
//   documentation and/or other materials provided with the   
//   distribution.
// 
//   Neither the name of Texas Instruments Incorporated nor the names of
//   its contributors may be used to endorse or promote products derived
//   from this software without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################

//
// Included Files
//

#include "driverlib.h"
#include "device.h"
#include "board.h"
#include <math.h>
//
// Globals
//
//void initEPWM(uint32_t base);

//void updateCompare(epwmInformation *epwmInfo);
//static uint32_t  epwm1TZIntCount;
//static uint32_t  epwm1IntCount;
//static uint32_t  epwm3IntCount;

//
// Function Prototypes
//
uint32_t EPwm1TimerIntCount=0;
__interrupt void epwm1ISR(void);
//__interrupt void epwm1TZISR(void);

uint32_t ISRcount =0;
uint32_t REFA_H =0;
uint32_t REFB_H= 0;
uint32_t REFC_H=0;
uint32_t PhaseShift1=0;
uint32_t PhaseShift2=0;
uint32_t PhaseShift3=0;
uint32_t PhaseShift=0;
uint32_t theta, del_theta;
uint32_t Freq=100,Vm= 5000;

void main(void)
{


    Interrupt_initModule();

     
      Interrupt_initVectorTable();

   
    Device_init();

    Device_initGPIO();
    Interrupt_register(INT_EPWM1, &epwm1ISR);



    SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

    Board_init();


    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

   
    Interrupt_enable(INT_EPWM1);

    
    EINT;
    ERTM;

    EPwm1TimerIntCount++;

    while(1)
    {


        NOP;
    }
}




__interrupt void epwm1ISR(void)
{

    ISRcount++;
 
    if( ISRcount <=100)
    {
             GPIO_writePin(myGPIO0, 1);       // GPIO58 is high

             EPWM_setDeadBandDelayPolarity(myEPWM4_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_HIGH);
                         EPWM_setCounterCompareValue(myEPWM4_BASE, EPWM_COUNTER_COMPARE_A, 0);
                         EPWM_setActionQualifierAction(myEPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
                         EPWM_setActionQualifierAction(myEPWM4_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
                         EPWM_setCounterCompareValue(myEPWM3_BASE, EPWM_COUNTER_COMPARE_A, 2500);
                                           //EPWM_setCounterCompareValue(myEPWM22_BASE, EPWM_COUNTER_COMPARE_B, 250);
                                           EPWM_setDeadBandDelayPolarity(myEPWM3_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW);
                                           EPWM_setDeadBandDelayMode(myEPWM3_BASE, EPWM_DB_RED, true);
                                           EPWM_setRisingEdgeDelayCount(myEPWM3_BASE, 5);
                                           EPWM_setDeadBandDelayMode(myEPWM3_BASE, EPWM_DB_FED, true);
                                           EPWM_setFallingEdgeDelayCount(myEPWM3_BASE, 5);
                                           EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
                                           EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
                                           EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
                                           EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
    }
         else if(ISRcount > 100 && ISRcount<=200)
        {
                    GPIO_writePin(myGPIO0, 0);       // GPIO58 is high
                              EPWM_setCounterCompareValue(myEPWM4_BASE, EPWM_COUNTER_COMPARE_A, 0);
                                EPWM_setActionQualifierAction(myEPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
                                EPWM_setActionQualifierAction(myEPWM4_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
                               EPWMsettings for S5 and S7

                                       EPWM_setCounterCompareValue(myEPWM3_BASE, EPWM_COUNTER_COMPARE_A, 2500);
                                       EPWM_setDeadBandDelayPolarity(myEPWM3_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW);
                                       EPWM_setDeadBandDelayMode(myEPWM3_BASE, EPWM_DB_RED, true);
                                       EPWM_setRisingEdgeDelayCount(myEPWM3_BASE, 5);
                                       EPWM_setDeadBandDelayMode(myEPWM3_BASE, EPWM_DB_FED, true);
                                       EPWM_setFallingEdgeDelayCount(myEPWM3_BASE, 5);
                                       EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
                                       EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
                                       EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
                                       EPWM_setActionQualifierAction(myEPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);


           }
         else if(ISRcount > 200 && ISRcount<=300)
        {  GPIO_writePin(myGPIO0, 1);      



        }


         else if(ISRcount > 300 &&ISRcount<=400)
        {  GPIO_writePin(myGPIO0, 0);       


               }

         else
         {
             ISRcount = 0;
         }


    EPwm1TimerIntCount++;

    GPIO_togglePin(myGPIO11);
    
    PhaseShift=((0xFFFF)*Freq*2*500*0.0000001);
    PhaseShift1=PhaseShift1+PhaseShift;
    PhaseShift2=(int16_t)Vm*sin((float)PhaseShift1*(0.000095875));
    PhaseShift3=fabs(PhaseShift2);





    3Info,REFC_H,EPWM1_TIMER_TBPHS);

       EPWM_setPhaseShift(myEPWM2_BASE,PhaseShift3);
       EPWM_setPhaseShift(myEPWM3_BASE, (PhaseShift3/2));
       EPWM_setPhaseShift(myEPWM4_BASE, (PhaseShift3/2));


    

       
    EPWM_clearEventTriggerInterruptFlag(myEPWM1_BASE);

   

    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
}