lpcware

LPC4330 timer capture interrupt

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by sophio on Mon Aug 05 09:11:04 MST 2013
Hello everyone,
I am using LPC4330-Xplorer board. One intention of my project is to use one timer capture to generate an interrupt when a rising edge event happens. Here timer3 capture channel 1 was selected. If there is a rising edge event, the LED will turn on. It is simple, however the interrup never happens in this case namely the value of the IR register never changes. Could anyone help me? Thank you very much in advance!
The related codes are copied as follows:

/*****************************************************************************
* Private functions
****************************************************************************/
/* initialization routine for dual core examples */
static void prvSetupHardware(void)
{......}

void TIMER3_IRQHandler( void )
{

uint32_t reg_val;

reg_val = LPC_TIMER3->IR;
if(reg_val & (1<<5))            //CR1 interrupt
{
  Board_LED_Set(1, 1); //led on
  Board_LED_Set(1, 0); //led off
  IP_TIMER_ClearCapture(LPC_TIMER3, 1);        //reset interrupt
}

}

void TIM_INT_Init(void)
{

    NVIC_DisableIRQ(TIMER3_IRQn);
NVIC_ClearPendingIRQ(TIMER3_IRQn);

IP_TIMER_Reset(LPC_TIMER3); //timer3 disable and reset
Chip_Clock_Enable(CLK_MX_TIMER3);

/* Pin2_1 is configured as T3_CAP1 and pull-down enabled*/
Chip_SCU_PinMux(2, 1,MD_BUK, FUNC6);//MD_PLN_FAST

/*Enable the rising edge capture interrupt of timer3*/
Chip_TIMER_CaptureRisingEdgeEnable(LPC_TIMER3, 1);

/*Enable the rising/falling edge capture interrupt of timer3*/
Chip_TIMER_CaptureEnableInt(LPC_TIMER3, 1);

Chip_TIMER_Enable(LPC_TIMER3);

NVIC_SetPriority(TIMER3_IRQn, IRQ_PRIO_REVCMD);
NVIC_EnableIRQ(TIMER3_IRQn);
}


/*****************************************************************************
* Public functions
****************************************************************************/
/**
* @briefMain for dual core examples
*
* @return  Function should not return.
*/
int main(void)
{
prvSetupHardware();

TIM_INT_Init();

while(1);

return 0;
}

Outcomes