LPC4330 timer capture interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC4330 timer capture interrupt

880 次查看
lpcware
NXP Employee
NXP Employee
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;
}
标签 (1)
0 项奖励
回复
3 回复数

800 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by username88 on Mon Apr 18 03:38:10 MST 2016

Quote: svenb
In case anybody else stumbles upon this on Google: Yes, you have to select the Tn_CAPm as the input for CAP_n_m in the GIMA, see section 17.4 of the user manual. Then it works.




how do you solve?
0 项奖励
回复

800 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by svenb on Fri Jul 10 09:34:11 MST 2015
In case anybody else stumbles upon this on Google: Yes, you have to select the Tn_CAPm as the input for CAP_n_m in the GIMA, see section 17.4 of the user manual. Then it works.
0 项奖励
回复

800 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by inspire on Tue Feb 17 11:09:30 MST 2015
Hi,

same problem here...is it necessary to do something with the GIMA?
0 项奖励
回复