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.

TMS320F2800137: F2800137 problems

Part Number: TMS320F2800137


hi expert !

I have two questions I would like to inquire about:

First: Running cmpss on the TMS320F2800137LAUNCHXL development board_ Ex1_ Asynch demo, follow the prompts in the figure below to ground or connect ADCINA2 to 3.3V voltage. PWM7B (GPIO13) does not have PWM signal output. May I ask what and how to achieve this demo function?

Secondly, regarding the AC voltage loop PI algorithm, your company has many PI algorithm functions, as follows: DCL_ RunPI_ C1 (), DCL_ RunPI_ C1 (), DCL_ RunPI_ C2 (), DCL_ RunPI_ C3(), DCL_ RunPI_ C4(), DCL_ RunPI_ C5 (), DCL_ RunPI_ C6 (), DCL_ RunPI_ C7(); May I ask which comparison is an AC voltage loop?

best regards!

yong

  • Hi Yong,

    Apologies in the delayed response due to the thanksgiving holiday. 

    I've pass this thread to other device expert who can respond with concrete answer to your first question, but for now I can answer the second question.

    You can use any PI configuration for voltage loop as you see fit, the following are the designated codename for each PI configuration.

    DCL_runPI_C1 : Series configuration (C)

    DCL_runPI_C2 : Series configuration (ASM)

    DCL_runPI_C3: Parallel configuration (C)

    DCL_runPI_C3: Parallel configuration (ASM)

    DCL_runPI_C5: Parallel w/ enhanced anti-windup (C)

    DCL_runPI_C6: Series w/ Tustin integrator (C)

    DCL_runPI_C7: Series w/ Tustin integrator (ASM)

    It's recommended to use assembly version of the implementation, for more info please refer to the DCL user's guide.

    Best,

    Sen Wang

     

  • First: Running cmpss on the TMS320F2800137LAUNCHXL development board_ Ex1_ Asynch demo, follow the prompts in the figure below to ground or connect ADCINA2 to 3.3V voltage. PWM7B (GPIO13) does not have PWM signal output. May I ask what and how to achieve this demo function?

    Hi Yong,

    In this example, in order to output ePWM output you will need to configure the ePWM output pins. With the following code.

    Please let me know if this fixes the issue:

    //
    //
    // EPWM7_A - GPIO Settings
    //
    #define GPIO_PIN_EPWM7_A 28
    #define myEPWM7_EPWMA_GPIO 28
    #define myEPWM7_EPWMA_PIN_CONFIG GPIO_28_EPWM7_A
    //
    // EPWM7_B - GPIO Settings
    //
    #define GPIO_PIN_EPWM7_B 29
    #define myEPWM7_EPWMB_GPIO 29
    #define myEPWM7_EPWMB_PIN_CONFIG GPIO_29_EPWM7_B
    
    GPIO_setPinConfig(myEPWM7_EPWMA_PIN_CONFIG);
    // AGPIO -> GPIO mode selected
    GPIO_setAnalogMode(28, GPIO_ANALOG_DISABLED);
    GPIO_setPadConfig(myEPWM7_EPWMA_GPIO, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(myEPWM7_EPWMA_GPIO, GPIO_QUAL_SYNC);
    
    GPIO_setPinConfig(myEPWM7_EPWMB_PIN_CONFIG);
    GPIO_setPadConfig(myEPWM7_EPWMB_GPIO, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(myEPWM7_EPWMB_GPIO, GPIO_QUAL_SYNC);

    I will go ahead and file a JIRA ticket on this since this should have already been configured, apologize for any confusion and thank you for bringing this to our attention!

    Best,

    Ryan Ma

  • hi expert !

    The routine configured pin 13 in PWM;

    I made the modifications according to your instructions, but I was unable to complete the experimental phenomenon

    best regards

    yong

  • Maybe I didn't express myself clearly!

    I use cmpss_ Ex1_ Asynch demo to test CMPSS and XBAR performance, CMPIN1P (ADCINA2) has an input of 3.3V or 0V, and PWM7B (GPIO13) has no pulse output

  • Hi Yong,

    Apologize, it appears ePWM7B or GPIO13 is not working. Could you choose any other ePWM base like ePWM6 with a different GPIO output? Please let me know if this works and we can fix this for our future release. Apologize for the confusion.

    Best,

    Ryan Ma

  • //#############################################################################
    //
    // FILE:   cmpss_ex1_asynch.c
    //
    // TITLE:  CMPSS Asynchronous Trip
    //
    //! \addtogroup driver_example_list
    //! <h1> CMPSS Asynchronous Trip </h1>
    //!
    //! This example enables the CMPSS1 COMPH comparator and feeds the asynchronous
    //! CTRIPOUTH signal to the GPIO4/OUTPUTXBAR3 pin and CTRIPH to GPIO13/EPWM7B.
    //!
    //! CMPSS is configured to generate trip signals to trip the EPWM signals.
    //! CMPIN1P is used to give positive input and internal DAC is configured 
    //! to provide the negative input. Internal DAC is configured to provide a
    //! signal at VDD/2. An EPWM signal is generated at GPIO13 and is configured
    //! to be tripped by CTRIPOUTH.
    //!
    //! When a low input(VSS) is provided to CMPIN1P,
    //!     - Trip signal(GPIO4) output is low
    //!     - PWM7B(GPIO13) gives a PWM signal
    //!
    //! When a high input(higher than VDD/2) is provided to CMPIN1P,
    //!     - Trip signal(GPIO4) output turns high
    //!     - PWM7B(GPIO13) gets tripped and outputs as high
    //!
    //! \b External \b Connections \n
    //!  - Give input on CMPIN1P (The pin is shared with ADCINA2)
    //!  - Outputs can be observed on GPIO4 and GPIO13 using an oscilloscope
    //!
    //! \b Watch \b Variables \n
    //!  - None
    //!
    //
    //#############################################################################
    //
    //
    // $Copyright:
    // Copyright (C) 2023 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"
    
    //
    // Function Prototypes
    //
    void initEPWM(void);
    
    //
    // Main
    //
    void main(void)
    {
        //
        // Initialize device clock and peripherals
        //
        Device_init();
    
        //
        // Disable pin locks and enable internal pullups.
        //
        Device_initGPIO();
    
        //
        // Initialize PIE and clear PIE registers. Disables CPU interrupts.
        //
        Interrupt_initModule();
    
        //
        // Initialize the PIE vector table with pointers to the shell Interrupt
        // Service Routines (ISR).
        //
        Interrupt_initVectorTable();
    
        //
        // Set up ePWM7 to take CTRIPH as TRIP4 for its DC trip input
        //
        initEPWM();
    
        //
        // Board Initialization
        // - Configure GPIO4 to output CTRIPOUT1H (routed through XBAROUTPUT3)
        // - Setup the Output X-BAR to output CTRIPOUTH on OUTPUTXBAR3
        // - Configure the high comparator of CMPSS1
        // - Enable CMPSS and configure the negative input signal to come from
        //   the DAC
        // - Use VDDA as the reference for the DAC and set DAC value to midpoint for
        //   arbitrary reference.
        // - Configure the output signals. Both CTRIPH and CTRIPOUTH will be fed by
        //   the asynchronous comparator output.
        //
        Board_init();
        GPIO_setAnalogMode(13U, GPIO_ANALOG_DISABLED) // Fix needed for example to work properly
    
        //
        // Configure GPIO13 to output CTRIPH (routed through ePWM TRIP4 and ePWM7)
        //
        GPIO_setPinConfig(GPIO_13_EPWM7_B);
    
        //
        // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
        //
        EINT;
        ERTM;
    
        //
        // Loop indefinitely
        //
        while(1)
        {
            //
            // Trip flag is set when CTRIP signal is asserted
            //
            if((EPWM_getTripZoneFlagStatus(EPWM7_BASE) &
                EPWM_TZ_FLAG_OST) != 0U)
            {
                //
                // Wait for comparator CTRIP to de-assert
                //
                while((CMPSS_getStatus(CMPSS1_BASE) & CMPSS_STS_HI_FILTOUT) != 0U)
                {
                    ;
                }
    
                //
                // Clear trip flags
                //
                EPWM_clearTripZoneFlag(EPWM7_BASE, EPWM_TZ_INTERRUPT |
                                       EPWM_TZ_FLAG_OST);
            }
        }
    }
    
    //
    // initEPWM - Function to configure ePWM7 and the ePWM X-BAR to take CTRIPH as
    //            the DC trip input
    //
    void initEPWM(void)
    {
        //
        // Disable the ePWM time base clock before configuring the module
        //
        SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
    
        //
        // Set the time base clock prescalers to /1
        //
        EPWM_setClockPrescaler(EPWM7_BASE, EPWM_CLOCK_DIVIDER_1,
                               EPWM_HSCLOCK_DIVIDER_1);
    
        //
        // Initializing dummy values for ePWM counter and period
        //
        EPWM_setTimeBaseCounter(EPWM7_BASE, 0);
        EPWM_setTimeBasePeriod(EPWM7_BASE, 0xFFFF);
    
        //
        // Set-up compare
        //
        EPWM_setCounterCompareValue(EPWM7_BASE, EPWM_COUNTER_COMPARE_B, 0x8000);
    
        //
        // Set actions
        //
        EPWM_setActionQualifierAction(EPWM7_BASE,
                                      EPWM_AQ_OUTPUT_B,
                                      EPWM_AQ_OUTPUT_HIGH,
                                      EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
    
        EPWM_setActionQualifierAction(EPWM7_BASE,
                                      EPWM_AQ_OUTPUT_B,
                                      EPWM_AQ_OUTPUT_LOW,
                                      EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    
        //
        // Configure ePWM7B to output high on TZB TRIP
    
        //
        EPWM_setTripZoneAction(EPWM7_BASE, EPWM_TZ_ACTION_EVENT_TZB,
                               EPWM_TZ_ACTION_HIGH);
    
        //
        // Trigger event when DCBH is high
        //
        EPWM_setTripZoneDigitalCompareEventCondition(EPWM7_BASE,
                                                     EPWM_TZ_DC_OUTPUT_B1,
                                                     EPWM_TZ_EVENT_DCXH_HIGH);
    
        //
        // Configure DCBH to use TRIP4 as an input
        //
        EPWM_enableDigitalCompareTripCombinationInput(EPWM7_BASE,
                                                      EPWM_DC_COMBINATIONAL_TRIPIN4,
                                                      EPWM_DC_TYPE_DCBH);
    
        //
        // Enable DCB as OST
        //
        EPWM_enableTripZoneSignals(EPWM7_BASE, EPWM_TZ_SIGNAL_DCBEVT1);
    
        //
        // Configure the DCB path to be unfiltered and asynchronous
        //
        EPWM_setDigitalCompareEventSource(EPWM7_BASE,
                                          EPWM_DC_MODULE_B,
                                          EPWM_DC_EVENT_1,
                                          EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    
        //
        // Sync the ePWM time base clock
        //
        SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
    
        //
        // Configure TRIP4 to be CTRIP1H using the ePWM X-BAR
        //
        XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
        XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX00);
    
    
        //
        // Clear trip flags
        //
        EPWM_clearTripZoneFlag(EPWM7_BASE, EPWM_TZ_INTERRUPT |
                               EPWM_TZ_FLAG_OST);
    
        //
        // Put the time base counter into up-count mode
        //
        EPWM_setTimeBaseCounterMode(EPWM7_BASE, EPWM_COUNTER_MODE_UP);
    }

  • ok,I can output epwm signals using PWM6,

    However, for CMPIN1P (ADCINA2) input of 3.3V or 0V, PWM6 does not output a high level.

    The CMSS module does not seem to trip through the Xbar signal.

    yours

    yong

  • Will need to pull in a CMPSS expert on this issue and we will provide an update by EOD tomorrow. 

    Best,

    Ryan Ma

  • Okay, looking forward to your good news

    thanks

    yong

  • Hi Yong,

    1) As in this device the pin GPIO13 is muxed with adc pins (pin 29 is AGPIO), you need to define it as GPIO. To do that, you need to use function GPIO_setAnalogMode(13U, GPIO_ANALOG_DISABLED).  You should add it after Board_init() in cmpss_ex1_asynch.c. 

    2) I tried the latest code Ryan sent you with EPWM6_B routed to the output.

    Here you can see the results when I connected A2 to 3.3V and 0:

    Please let me know if you have any questions.

    Regards,

    Hadi

  • thank you ,Hadi!

    Using GPIO_setAnalogMode(13U, GPIO_ANALOG_DISABLED) Implement this experiment ;

    But the code Ryan sent me still hasn't achieved the display effect of the oscilloscope. I wonder if it is necessary to reconfigure the CMPSS and Xbar modules

    yong

  • Hi Yong,

    Could you try starting off with the existing example, re-import that example and add the GPIO_setAnalogMode(13U, GPIO_ANALOG_DISABLED); line.

    This should let the example work as expected.

    Best,

    Ryan Ma

  • Yes, I have made this example work as expected

    Maybe I didn't express myself clearly enough;

    I mean, the code you provided did not work as expected (the code was output by PWM6)

    thank you Ryan Ma

    best

  • Hi Yong,

    Thank you for clarifying, I will update my response by referring to our example and adding the set analogmode driverlib function.

    Could you mark the thread as resolved once this is completed?

    Thank you!

  • OK

    regards

    yong