• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » trip zone not triggering interrupt on F28335
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • Forums

    trip zone not triggering interrupt on F28335

    This question is not answered
    IVan Hobbs1
    Posted by IVan Hobbs1
    on May 17 2012 21:14 PM
    Prodigy70 points

    I use the trip zone module on the F28335 to stop/enable the PWM signals, manually of if an error occurs. When I force a OSHT trip the interrupt is triggered, but if a trip occurs on TZ1 the interrupt is not invoked. I configure GPIO12 as follow:

    void ConfigTZ(){

        EALLOW;
        GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0;            // Enable pull-up on GPIO12 (TZ1)

        GpioCtrlRegs.GPACTRL.bit.QUALPRD1 = 0x00;     // enable input qualification
        GpioCtrlRegs.GPAQSEL1.bit.GPIO12  = 1;         // (TZ1) synch qualification
        GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 1;          // Configure GPIO12 as TZ1
        EDIS;

            // enable cycle by cycle trip
            EALLOW;                                                                   // Trip zone registers are EALLOW protected
            EPwm1Regs.TZSEL.bit.OSHT1         = 1;                // Trip zone 1 used for this sub module
            EPwm1Regs.TZCTL.bit.TZA         = 10;                // Force PWMA low
            EPwm1Regs.TZCTL.bit.TZB         = 10;                // Force PWMB low
            EPwm1Regs.TZEINT.bit.OST         = 1;                // enable trip zone interupt
            EDIS;

    }

    void PWMAEnable(void)
    {
        if(EPwm1Regs.TZFLG.bit.OST)
        {
            EALLOW;
            EPwm1Regs.TZCLR.bit.OST = 1;
            EPwm1Regs.TZCLR.bit.INT = 1;
            EDIS;
        }
    }

        // disable all the PWM channels by forcing a one-shot trip
        #define PWMADisable() {                        \
            EALLOW;                                    \
            EPwm1Regs.TZFRC.bit.OST = 1;            \
            EDIS;                                    \
                              \
        }

    I'm I missing something obvious?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Brett Larimore
      Posted by Brett Larimore
      on May 18 2012 09:12 AM
      Mastermind18430 points

      Ivan,

      I haven't fully looked through your code, but I believe that you want to write "2" (10 in binary) to EPwm1Regs.TZCTL.bit.TZA and EPwm1Regs.TZCTL.bit.TZB. 


      Thank you,
      Brett

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • IVan Hobbs1
      Posted by IVan Hobbs1
      on May 18 2012 09:35 AM
      Prodigy70 points

      Brett,

      Thank you for spotting that, luckily 10 decimal is 1010 binary so the register was still ok. changed to 0x2, but still get the same issue. Looking at p.3 of spraar4.pdf it seems like the async trip occurs but the sync block is not triggering the OSHT trip latch, which will trigger the interrupt.

      Regards

      Ivan

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on May 18 2012 10:12 AM
      Expert5985 points

      Ivan,

      If I understand your problem correctly, you are receiving the interrupt but are not seeing any output change on the PWM, correct?

      I believe you need to take a look at 

      EPwmxRegs.TZCTL.bit.TZA = TZ_FORCE_HI;
      EPwmxRegs.TZCTL.bit.TZB = TZ_FORCE_LO;

      to set the state of the PWM output in the event of a trip.

      Kris

      Correction.. I overlooked the TZCTL.  These should be fine.  Please verify the problem though :)

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • IVan Hobbs1
      Posted by IVan Hobbs1
      on May 18 2012 10:15 AM
      Prodigy70 points

      Kris,

      I get it the other way around. The output of the PWM signals goes low as intended, but I don't get the interrupt. I get the interrupt if I do a software forced trip.

      Ivan

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on May 18 2012 10:17 AM
      Expert5985 points

      Thanks Ivan,

      Can you post your PIE configuration?

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • IVan Hobbs1
      Posted by IVan Hobbs1
      on May 18 2012 10:22 AM
      Prodigy70 points

      Kris,

      Please see the code take-outs below, this is the sections that I used tho setup the interrupt. Please let me know if you need more.

          EALLOW;  // this is needed to write to eallow protected registers

          PieVectTable.EPWM1_TZINT     = &epwmTZ1_isr;

          EDIS;    // This is needed to disable write to EALLOW protected registers

             // enable trip zone interrupts in the pie
             PieCtrlRegs.PIEIER2.bit.INTx1 = 1;

          // enable cpu int2 which is connected to the pwm trip zone blocks
          // enable cpu int3 which is connected to the pwm blocks
          IER |= M_INT2;
          IER |= M_INT3;

          EINT;
          ERTM;           // Enable Global realtime interrupt DBGM

      Regards

      Ivan

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on May 18 2012 10:26 AM
      Expert5985 points

      Excellent, this looks good.  How long are you holding GPIO12 low when you are testing for the trip interrupt?  What you may want to try is setting GPIO12 to async by changing your GPAQSEL to:

         GpioCtrlRegs.GPAQSEL1.bit.GPIO12 = 3;  // Asynch input GPIO12 (TZ1)

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • IVan Hobbs1
      Posted by IVan Hobbs1
      on May 18 2012 10:33 AM
      Prodigy70 points

      I've got it down for about 100us. I tried the async option but still have the same problem. I have more than one source tripping TZ1. In the interrupt I want to decode it from the GPIO pins.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on May 18 2012 10:41 AM
      Expert5985 points

      Ivan,

      In your original post, it looks like you are using this as a ISR, correct?

      void PWMAEnable(void)
      {
          if(EPwm1Regs.TZFLG.bit.OST)
          {
              EALLOW;
              EPwm1Regs.TZCLR.bit.OST = 1;
              EPwm1Regs.TZCLR.bit.INT = 1;
              EDIS;
          }
      }

      However, in your PIE configuration you set the PWM1_TZ interrupt to a different function.  Am I misunderstanding the use of the PWMAEnable() function?

       PieVectTable.EPWM1_TZINT     = &epwmTZ1_isr;

      Second question, can you tell me if when GPIO12 trips the PWM output, if you look at the EPwm1Regs.TZFLG.bit.OST register, is this flag set?  If this is set, is the EPwm1Regs.TZFLG.bit.INT set?

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • IVan Hobbs1
      Posted by IVan Hobbs1
      on May 18 2012 11:15 AM
      Prodigy70 points

      Kris,

      I use void PWMAEnable(void) to enable the PWM signals via a command through the SCI port. I call the function interrupt void epwmTZ1_isr(void) when a TZ1 interrupt occurs. The idea is that this interrupt is triggered either by software or a low on TZ1. The enable function clears all the flag so more interrupts can occur. When the PWM is running I must be stopped by either a command:

      void PWMADiable(){

      EALLOW;                                   

      EPwm1Regs.TZFRC.bit.OST = 1;

      EDIS;

      }

      of a low on TZ1(GPIO12).

      The issue is that a low on TZ1 doesn't trigger the interrupt, but the PWM signals are forced low.

      Both the flags are set when when GPIO12 trips the PWM.

      Regards

      Ivan

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on May 18 2012 11:18 AM
      Expert5985 points

      Ivan,

      Thanks for the explanation.  Hmm... if both of these flags are set that implies that the TZ has been latched (as seen on the PWM output) and an interrupt signal sent to the PIE.  How are you verifying that your ISR is not being reached?  Breakpoint, software, etc?

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • IVan Hobbs1
      Posted by IVan Hobbs1
      on May 18 2012 12:11 PM
      Prodigy70 points

      I'm toggling a GPIO pin and checking it on a scope. I'll bash through the code some more to see if I can find something I'm missing.

      Ivan

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Kris Parrent
      Posted by Kris Parrent
      on May 18 2012 13:31 PM
      Expert5985 points

      Might be worth checking the status of the PIE flags as well, just to make sure there is not a previous interrupt that did not get acknowledged or similar.  I would also recommend just setting a breakpoint on the first command of the ISR for debug purposes.

      Kris

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use