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.

UCD3138A: FIQ pin is not enabling, and PWM pin is always low

Part Number: UCD3138A

Hi team,

I have a question from my customer. Please see below.

  1. Fast Interrupt Request (FIQ). Fault2 (pin 25) is mapped to FIQ, but it does not trigger FIQ ISR at all. If I mapped the Fault2 to standard interrupt request, the ISR can be triggered, and everything is correct. The code is like this:

#define CIMINT_ALL_FAULT_PIN     (0x40000000) // 30  Fault Pin Interrupt

                …

                GioRegs.FAULTINTENA.bit.FLT2_INT_EN = 1;

                GioRegs.FAULTOUT.bit.FLT2_OUT=1;

                GioRegs.FAULTDIR.bit.FLT2_DIR = 0;

                GioRegs.FAULTIN.bit.FLT2_IN = 0;                                             //1 - Fault pin must be driven High. 0 - Driven Low to trigger Interrupt

                GioRegs.FAULTINTPOL.bit.FLT2_INT_POL = 0;  //Interrupt will be generated on 1 = Rising Edge, 0 = Falling Edge

                //write_reqmask(CIMINT_ALL_FAULT_PIN);

                write_firqpr(CIMINT_ALL_FAULT_PIN);

                enable_interrupt();

                enable_fast_interrupt();

 

If I comment out write_firqpr, and put back write_reqmask instruction, everything works correct. It seems FIQ is not enabled. Here is the function enable_fast_interrupt();

void enable_fast_interrupt(void)

{

       swi_single_entry(0,0,0,4); //code is 4;

}

 

  1. Besides DPWM0 and DPWM1, I also try to make PWM output from pin 8, but I cannot get PWM signal from that pin. The pin is always low. Here is my initialization code:

 

    1. TimerRegs.T16PWM0CMP0DAT.bit.CMP_DAT = 15870; //value to reset counter
    2.        TimerRegs.T16PWM0CMP1DAT.bit.CMP_DAT = 7935; //50%50 duty cycle half of comp 0
    3.     TimerRegs.T16PWM0CMPCTRL.bit.CMP0_INT_ENA = 1;      //Enables compare 0 (reset) interrupt
    4.        TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_ACTION0 = 1;//1 is for clear pin
    5.        TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_ACTION1 = 2;//2 is for clear pin
    6.        TimerRegs.T16PWM0CNTCTRL.bit.CMP_RESET_ENA = 1; //enable reset by comp 0
    7.        TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT = 1; //make sure that default is a 0
    8.        TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_DRV = 1; //put zero into output latch
    9.        TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_ENA = 1; //enable pin as an output
    10.        TimerRegs.T16PWM0CNTCTRL.bit.SW_RESET = 1; //allow counter to run

 

    1.        MiscAnalogRegs.IOMUX.bit.EXT_TRIG_MUX_SEL=3;
    2.        MiscAnalogRegs.IOMUX.bit.JTAG_CLK_MUX_SEL=0;
    3.        MiscAnalogRegs.IOMUX.bit.SYNC_MUX_SEL=2;

I changed line k to m to different value, but it does not work.

 

Thank you!
Lauren

  • You still need to set the bit in reqmask.  All interrupts need to be enabled there regardless of whether they are standard or fast.  To make them fast, enable in requmask and firqpr

  • Hi Ian,

    Thanks for the help. That seemed to resolve the first issue, what about the second?
    Thank you!
    Lauren

  • Sorry I missed that one.  Here's a code that sets up the PWM to do an output.:

    void init_fan(void)
    {
    MiscAnalogRegs.IOMUX.bit.EXT_TRIG_MUX_SEL = 3; //output pwm0 on adc ext trig pin

    TimerRegs.T16PWM0CMP0DAT.bit.CMP_DAT = 625; //value to reset counter
    TimerRegs.T16PWM0CMP1DAT.bit.CMP_DAT = 0; //do not start fan
    TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_ACTION0 = 1;//1 is for clear pin
    TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_ACTION1 = 2;//2 is for clear pin
    TimerRegs.T16PWM0CNTCTRL.bit.CMP_RESET_ENA = 1; //enable reset by comp 0
    TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT = 0; //make sure that default is a 0
    TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_DRV = 1; //put zero into output latch
    TimerRegs.T16PWM0CMPCTRL.bit.PWM_OUT_ENA = 1; //enable pin as an output
    TimerRegs.T16PWM0CNTCTRL.bit.SW_RESET = 1; //allow counter to run
    }

    Note that it puts a 0 into TimerRegs.T16PWM0CMP1DAT.bit.CMP_DAT.  This means 0 on-time for the PWM.

    Later on in the code, the desired on-time is calculated and put into that bitfield:

    TimerRegs.T16PWM0CMP1DAT.bit.CMP_DAT = t; 

  • Hi Ian, that fixed it! Thanks for your prompt attention and great support.

  • OK, I'll close it.