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.
Hi Team,
My customer want to using OTSFA/OTSFB of AQSFRC to force PWM5A & PWM5B to low which followed with the PWM5A & PWM5B switch output operation, but the tested waveform of PWM5A&PWM5B shown as figure 2, which from the test waveform, the forcing to low operation didn’t work as expected but followed up with PWM5A & PWM5B switch succeed and PWM5A with Set/Clear operation.
The detailed description shown as attached file,F280049 PWM5A&PWM5B Issue.docx
Could you kindly double check the software configuration and forcing to low operation logic?
Could you kindly give solutions for the PWM5A&PWM5B forcing to low operation and PWM5A&PWM5B switch operation?
It's quite urgent, and Expect for your reply, thanks.
Best Regards
Benjamin
Hi Benjamin,
I want to clarify the problem shown in your attached document. I understand the customer is looking to use the AQSFRC to disable the PWM for a period of time.
In the waveform that you posted from the oscilloscope, is the problem with the waveform that it is HIGH instead of LOW or that you have the pulse before the 83us is reached?
I think the customer is actually wanting to use the Trip Zone feature here. The AQSFRC is a one time event which will change the output on the PWM, but if another Action Qualifier event happens it will take effect on the pin. If the customer wants to truly disable the PWM for a period of time, I believe using the TZFRC register would be a better option.
Regards,
Kris
Hi Benjamin,
I have attached an example here. You can drop this into any of the HRPWM projects for F28004x in C2000Ware for it to work.
The project shows the use of TZFRC to create a CBC interrupt every 3rd PWM period (the example uses the PWM ISR on every 3rd period but the register can be used at any time) which is automatically cleared at the next TBCTR=0. The comments will have more details, but you can monitor GPIO2 and GPIO11 during the example with a scope.
Regards,
Kris
//########################################################################### // // FILE: epwm_trip_zone.c // // TITLE: ePWM module using Trip-Zone submodule. // //! \addtogroup cpu01_example_list //! <h1> EPWM Trip Zone Module (epwm_trip_zone)</h1> //! //! This example configures ePWM2 to perform a software cycle-by-cycle trip-zone. //! The trip is performed every 3rd PWM cycle in epwm2_isr. //! //! During the test, monitor ePWM2 and GPIO11 on a scope. //! //! \b External \b Connections \n //! - EPWM2A is on GPIO2 //! - GPIO11 is the TZ ISR status //!// // //########################################################################### // $TI Release: F2837xD Support Library v3.02.00.00 $ // $Release Date: Jan 23, 2018 15:29:00 CDT 2017 $ // $Copyright: // Copyright (C) 2013-2018 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 "F28x_Project.h" // // Globals // Uint32 EPwm2TZIntCount; // // Function Prototypes // void InitEPwm2Example(void); void InitTzGpio(void); __interrupt void epwm2_tzint_isr(void); __interrupt void epwm2_isr(void); void InitEPwmGpio_TZ(void); // // Main // void main(void) { // // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the F2837xD_SysCtrl.c file. // InitSysCtrl(); // // Step 2. Initialize GPIO: // This example function is found in the F2837xD_Gpio.c file and // illustrates how to set the GPIO to it's default state. // // InitGpio(); // // enable PWM2 // EALLOW; CpuSysRegs.PCLKCR2.bit.EPWM2=1; EDIS; // // For this case just init GPIO pins for ePWM1, ePWM2, ePWM3 // InitEPwmGpio_TZ(); InitTzGpio(); // // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts // DINT; // // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the F2837xD_PieCtrl.c file. // InitPieCtrl(); // // Disable CPU interrupts and clear all CPU interrupt flags: // IER = 0x0000; IFR = 0x0000; // // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in F2837xD_DefaultIsr.c. // This function is found in F2837xD_PieVect.c. // InitPieVectTable(); // // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. // EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.EPWM2_TZ_INT = &epwm2_tzint_isr; PieVectTable.EPWM2_INT = &epwm2_isr; EDIS; // This is needed to disable write to EALLOW protected registers // // Step 4. Initialize the Device Peripherals: // EALLOW; CpuSysRegs.PCLKCR0.bit.TBCLKSYNC =0; EDIS; InitEPwm2Example(); EALLOW; CpuSysRegs.PCLKCR0.bit.TBCLKSYNC =1; EDIS; // // Step 5. User specific code, enable interrupts: // EPwm2TZIntCount = 0; // // Enable CPU INT2 which is connected to EPWM1-3 INT: // IER |= M_INT2; IER |= M_INT3; // // Enable EPWM INTn in the PIE: Group 3 interrupt 1-3 // PieCtrlRegs.PIEIER2.bit.INTx2 = 1; PieCtrlRegs.PIEIER3.bit.INTx2 = 1; // // Enable global Interrupts and higher priority real-time debug events: // EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // // Step 6. IDLE loop. Just sit and loop forever (optional): // for(;;) { asm (" NOP"); } } __interrupt void epwm2_isr(void) { EALLOW; EPwm2Regs.TZFRC.bit.CBC = 1; EDIS; // Clear INT flag for this timer // EPwm2Regs.ETCLR.bit.INT = 1; PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; } // // epwm2_tzint_isr - EPWM2 TZ ISR // __interrupt void epwm2_tzint_isr(void) { GpioDataRegs.GPASET.bit.GPIO12 = 1; GpioDataRegs.GPATOGGLE.bit.GPIO11 = 1; EPwm2TZIntCount++; // // Clear the flags - we will continue to take // this interrupt until the TZ pin goes high // EALLOW; EPwm2Regs.TZCLR.bit.CBC = 1; EPwm2Regs.TZCLR.bit.INT = 1; EDIS; // // Acknowledge this interrupt to receive more interrupts from group 2 // PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; } // // InitEPwm2Example - Initialize EPWM2 configuration // void InitEPwm2Example() { // // Enable TZ1 as one cycle-by-cycle trip sources // EALLOW; EPwm2Regs.TZSEL.bit.CBC1 = 1; // // Set TZA // EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_HI; // // Enable TZ interrupt // EPwm2Regs.TZEINT.bit.CBC = 1; EPwm2Regs.TBPRD = 6000; // Set timer period EPwm2Regs.TBPHS.bit.TBPHS = 0x0000; // Phase is 0 EPwm2Regs.TBCTR = 0x0000; // Clear counter // // Interrupt where we will change the Compare Values // EPwm2Regs.ETSEL.bit.INTSEL = ET_CTR_PRD; // Select INT on Zero event EPwm2Regs.ETPS.bit.INTPRD = ET_3RD; // Generate INT on 3rd event EPwm2Regs.ETSEL.bit.INTEN = 1; // Enable INT // // Setup TBCLK // EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up EPwm2Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV4; // Clock ratio to SYSCLKOUT EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV4; // Slow just to observe on // the scope. // // Setup compare // EPwm2Regs.CMPA.bit.CMPA = 3000; // // Set actions // EPwm2Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM2A on CAU EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM2A on CAD EDIS; } // // InitTzGpio - Initialize TZ GPIOs // void InitTzGpio(void) { // // For External Trigger, GPIO12 as the trigger for TripZone // EALLOW; GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0; // Enable pull-up on GPIO12 (TZ1) GpioCtrlRegs.GPADIR.bit.GPIO12 = 1; // Set GPIO12 to output EDIS; GpioDataRegs.GPASET.bit.GPIO12 = 1; EALLOW; InputXbarRegs.INPUT1SELECT = 12; EDIS; // // For monitoring when the TZ Interrupt has been entered // EALLOW; GpioCtrlRegs.GPAPUD.bit.GPIO11 = 1; // GPIO to toggle when enter TZ ISR GpioCtrlRegs.GPAMUX1.bit.GPIO11 = 0; GpioCtrlRegs.GPADIR.bit.GPIO11 = 1; EDIS; } // // InitEPwmGpio_TZ - EPWM2A GPIO // void InitEPwmGpio_TZ(void) { EALLOW; GpioCtrlRegs.GPAPUD.bit.GPIO2 = 1; // Disable pull-up on GPIO2 (EPWM2A) GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 1; // Configure GPIO2 as EPWM2A EDIS; } // // End of file //