Problems with LPC43XX Timer2 Capture function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems with LPC43XX Timer2 Capture function

357 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rui.araujo on Wed Jul 24 22:17:30 MST 2013
I am using a LPC4337 and I am trying to use the capture function on the timer2.
I am using CMSISv2p10_LPC43xx_DriverLib as a library and I have checked its code and its results on the registers which all seem ok.

Unfortunately it is not working, I also did a quick try by having the timer as a counter which also didn't work.
I have checked that the pin I am using P6_6 is receiving the events correctly.

Here is the code I have written.
TIM_TIMERCFG_Type timer2_cfg;
timer2_cfg.PrescaleOption = TIM_PRESCALE_TICKVAL;
timer2_cfg.PrescaleValue = 1;// prescaler: run at main clock speed!
TIM_Init(LPC_TIMER2, TIM_TIMER_MODE, &timer2_cfg);
TIM_CAPTURECFG_Type timer2_capture;
timer2_capture.CaptureChannel = TIMER_CAPTURE_CHANNEL; //3
timer2_capture.FallingEdge = ENABLE;
timer2_capture.RisingEdge = ENABLE;
timer2_capture.IntOnCaption = DISABLE;
TIM_ConfigCapture(LPC_TIMER2, &timer2_capture);
TIM_MATCHCFG_Type timer2_match;
timer2_match.MatchChannel = 0;
timer2_match.IntOnMatch = DISABLE;
timer2_match.ResetOnMatch = DISABLE;
timer2_match.StopOnMatch = DISABLE;
timer2_match.ExtMatchOutputType = TIM_EXTMATCH_NOTHING;
timer2_match.MatchValue = 0;
TIM_ConfigMatch(LPC_TIMER2, &timer2_match);

// set P6.6 to capture register CAP2.3
scu_pinmux(PORT_DVS_REQUEST, PIN_DVS_REQUEST, 0, FUNC5);
LPC_GIMA ->CAP2_3_IN = (uint32_t) (0x1 << GIMA_CAP2_3_IN_SELECT_Pos)
| GIMA_CAP2_3_IN_PULSE_Msk | GIMA_CAP2_3_IN_SYNCH_Msk
| GIMA_CAP2_3_IN_EDGE_Msk;

TIM_Cmd(LPC_TIMER2, ENABLE);   //Enable timer2


I have run out of ideas of what the problem might be and that's I am looking for help from people that might have used this fuction.
Thanks. 
Labels (1)
0 Kudos
0 Replies