AnsweredAssumed Answered

Interrupt for Capture on Standard Timer 0 not being called

Question asked by Safiullah Hussaini on Jun 20, 2019
Latest reply on Jun 24, 2019 by Safiullah Hussaini

I am trying to initiate a Timer (Timer 0) interrupt on the rising edge of a pulse.

The timer is in the Timer mode so as to count the clocks between the rising edges.

Following is my initialization code


   // Init board hardware.
   // Init FSL debug console.
    PRINTF("Configuring Timer 0...\n");
    const uint32_t port1_pin26_config = ( //Configure as CT_INP3
              IOCON_FUNC3 |
                                            // No addition pin function
                                            // Standard mode, output slew rate control is enabled
                                            IOCON_PIO_SLEW_STANDARD |
                                            // Input function is not inverted
                                            IOCON_PIO_INV_DI |
                                            // Enables digital function
                                            IOCON_PIO_DIGITAL_EN |
                                            // Open drain is disabled
    // PORT1 PIN26
    IOCON_PinMuxSet(IOCON, 1, 26, port1_pin26_config);
    INPUTMUX_AttachSignal(INPUTMUX, 1, kINPUTMUX_CtimerInp3ToTimer0Captsel);
    CTIMER_Init(CTIMER0, &g_ctimer_config);
    CTIMER0->CTCR &= 0x0000000F;
    CTIMER0->CTCR |= ((0x2 << 5) | (1 << 4));
    CTIMER_RegisterCallBack(CTIMER0, &g_ctimer_callback[0], kCTIMER_SingleCallback);
    CTIMER_SetupCapture(CTIMER0, kCTIMER_Capture_1, kCTIMER_Capture_RiseEdge, true);
    CTIMER_EnableInterrupts(CTIMER0, kCTIMER_Capture1InterruptEnable);
However, The callback function for the capture is never called.
The callback code looks like this
void ctimer_capture_callback(uint32_t arg_flags);
void ctimer_match_callback(uint32_t arg_flags);

 * Global Variables
ctimer_config_t g_ctimer_config;
ctimer_callback_t g_ctimer_callback[] = {NULL, NULL, NULL, NULL, NULL, ctimer_capture_callback, NULL, NULL};
uint32_t g_timer_val = 0;
uint8_t g_valid_lock = 0;
 * Function Definition
void ctimer_capture_callback(uint32_t arg_flags)
 if (CTIMER_GetStatusFlags(CTIMER0) & kCTIMER_Capture1InterruptEnable){ //Breakpoint here
The code never reaches the breakpoint ( if (CTIMER_GetStatusFlags(CTIMER0) & kCTIMER_Capture1InterruptEnable){ line) However the timer does get reset on capture so I believe the reset on capture functionality is working.
What am I doing wrong?