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: Using T24 TCAP and interrupt

Part Number: UCD3138A

I have a need to capture and calculate frequency of an incoming signal. I've landed the signal on ADC_EXT_TRIG (pin 8) for me. I'm struggling to find the right combination of pin enables, iomux mapping, and interrupt enables to allow the rising (or falling) edge to trigger standard_interrupt().  Here's a snip of code (I've built from having something simple to throwing the kitchen sink you see below):

// Setup PWM0(SYNC) for TCAP
MiscAnalogRegs.GLBIOEN.bit.ADC_EXT_TRIG_IO_EN = 1;
MiscAnalogRegs.IOMUX.bit.EXT_TRIG_MUX_SEL = 1; // EXT_TRIG ALT functioned as TCAP
MiscAnalogRegs.GLBIOOE.bit.ADC_EXT_TRIG_IO_OE = 0;

TimerRegs.T24CAPCTRL.bit.CAP_SEL = 3; // TCAP sourced from (SYNC) pin
TimerRegs.T24CAPCTRL.bit.EDGE = 0x1; // Trigger on rising edge only
TimerRegs.T24CAPCTRL.bit.CAP_INT_ENA = 1; // Enable interrupt

disable_fast_interrupt(); //make sure fast interrupt is disabled
disable_interrupt();
write_reqmask(CIMINT_ALL_TMR_CAPT0); //(0x00100000) //enable T24 TCAP
enable_interrupt();
enable_fast_interrupt(); //make sure fast interrupt is enabled for OVP shutdown

In standard_interrupt I check for 

if( 1 == TimerRegs.T24CAPCTRL.bit.CAP_INT_FLAG )

 

Not seeing any interrupts when I'm darn sure I've got solid edges/signal at the micro's pin.  Thoughts?

  • I think the two global I/O register writes must be messing you up. I tried running without them, and I had no problem getting the interrupt bit to set in the INTREQ register. You certainly don't want the global I/O register writes - they are a competing system that gives a different way to use the pins as GPIO.

    Also note that you clear the interrupt when you read from the capture data register.
  • OK, so I'm sure your suggestion is correct for the RCG package. But for the RMH (small pin package), because I don't have a dedicated SYNC and TCAP pins, it actually works to get down to the following I/O muxing/definitons:

    MiscAnalogRegs.GLBIOEN.bit.ADC_EXT_TRIG_IO_EN = 1;
    MiscAnalogRegs.IOMUX.bit.EXT_TRIG_MUX_SEL = 1; // EXT_TRIG ALT functioned as TCAP
    MiscAnalogRegs.GLBIOOE.bit.ADC_EXT_TRIG_IO_OE = 0;

    //TimerRegs.T24CAPCTRL.bit.CAP_SEL = 3; // TCAP sourced from (SYNC) pin
    TimerRegs.T24CAPCTRL.bit.EDGE = 0x1; // Trigger on rising edge only
    TimerRegs.T24CAPCTRL.bit.CAP_INT_ENA = 1; // Enable interrupt

    So, the functional block pin direction (commented out line), is seemingly causing the problem in the RMH. I tried multiple combinations of the none, some, all of the GLBIO pin definitions while keeping the local CAP_SEL bit.  Nothing worked until I took the CAP_SEL bit definition out.  Regardless, working now!  Tx as always, Ian!