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.

PWM0 GEN0 Interrupt ADC on count zero & CCS Debug show Interrupt Comp A up?

Guru 56143 points


Version: TivaWare_C_Series-2.1.0.12573

Checking the PWM peripheral configuration in CCS debug reveals GEN0 trigger & interrupt enables are not being configured properly to the reset defaults.

Why is this happening?

// Configure PWM Generators:

    ROM_PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_1, PWM_INT_CNT_ZERO | PWM_TR_CNT_LOAD); 

//*****************************************************************************
//
// Defines for enabling, disabling, and clearing PWM generator interrupts and
// triggers.
//
//*****************************************************************************
#define PWM_INT_CNT_ZERO        0x00000001  // Int if COUNT = 0
#define PWM_INT_CNT_LOAD        0x00000002  // Int if COUNT = LOAD
#define PWM_INT_CNT_AU          0x00000004  // Int if COUNT = CMPA U
#define PWM_INT_CNT_AD          0x00000008  // Int if COUNT = CMPA D
#define PWM_INT_CNT_BU          0x00000010  // Int if COUNT = CMPB U
#define PWM_INT_CNT_BD          0x00000020  // Int if COUNT = CMPB D
#define PWM_TR_CNT_ZERO         0x00000100  // Trig if COUNT = 0
#define PWM_TR_CNT_LOAD         0x00000200  // Trig if COUNT = LOAD
#define PWM_TR_CNT_AU           0x00000400  // Trig if COUNT = CMPA U
#define PWM_TR_CNT_AD           0x00000800  // Trig if COUNT = CMPA D
#define PWM_TR_CNT_BU           0x00001000  // Trig if COUNT = CMPB U
#define PWM_TR_CNT_BD           0x00002000  // Trig if COUNT = CMPB D

  • Mon Ami,

    Code blurb you present does not (really) configure PWM_GEN_0 - does it?     Might the following better meet that objective?

    ROM_PWMGenConfigure(PWM0_BASE, PWM_GEN_0, (PWM_GEN_MODE_UP_DOWN |
                            PWM_GEN_MODE_GEN_SYNC_LOCAL |
                            PWM_GEN_MODE_DB_SYNC_LOCAL | 
                            PWM_GEN_MODE_FAULT_EXT | PWM_GEN_MODE_FAULT_MINPER |
                            PWM_GEN_MODE_DBG_STOP));

    As you/I have past discussed - might your code (shown) abbreviate my past suggestion:

    ROM_PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO);    //   where does this (required) code line (now) reside?
    ROM_PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0, | PWM_INT_CNT_ZERO | PWM_TR_CNT_LOAD);

    And - is it the (bit flawed) rewrite of the near perfect StellarisWare - or your own "invention" - which excised the underbar from key parameters?     Note - swear to God - we spotted - you must have edited/corrected - proper now!

    On the sentence structure front - staff applauds your, "Why is this happening?"     And then cringe at thread's title - which attempts the interrogatory via the (improper) appending of "?"

    Later - if need still exists - I'll examine under a "real" IDE - see if bp's, "issue du jour" holds water...

  • Was referring to the generator trigger and interrupt enables appear to be not configured properly by Tivaware. 

    Gen # + 4 |= ui32Trig don't  = 44,84,C4,104

  • The ? in this case means how come for us back woods Ohio mud slingers not so dressed in white lab coat and black tie.
  • Alternatively ? == baffled perplexed in doubt.
  • HOW could I have known?
    Few "lab coats" in our humble (rent controlled shop) - and surely - none of them, "white!"
    Appending that "?" is a bad habit - will not serve you when you "venture" into fund raising...
  • Tiva code is correct since PWM_GEN_1 = 0x80 + 4 = 84 . Yet debug shows PWM_GEN_0 configured but are not using Gen 0 at this time and it should be 0x0000.0000
  • Later occurred to me EN0-LED0, EN0-LED2 use GPIO ports of GEN0 A/B outputs. Appears CCS debug can't tell the difference in the peripheral AFSEL configuration.
  • Might a "good" carpenter be less quick - to blame his tools?