AnsweredAssumed Answered

LpcOpen Input Capture lpc111x

Question asked by Walter Buttazzo on Sep 8, 2016
Latest reply on Sep 19, 2016 by Walter Buttazzo

Hi all,

I'd like to capture a falling edge in PIO3_3 of lpc1115, but my debug session doesn't enter in interrupt Handler

 

Here is my code:

 

Init

 

#define DEMODULATOR_TIMER LPC_TIMER16_0
#define DEMODULATOR_TIMER_IRQ TIMER_16_0_IRQn
#define DEMODULATOR_TIMER_CAPTNUM 0
#define DEMODULATOR_TIMER_IRQHandler TIMER16_0_IRQHandler
#define DEMODULATOR_TIMER_MATCHNUM 0
#define DEMODULATOR_TIMER_MC_VALUE 40000

 

 

/* Pin Setting */
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO3_3, IOCON_FUNC2 | IOCON_DIGMODE_EN | IOCON_HYS_EN); 
Chip_GPIO_SetPinDIRInput(LPC_GPIO, 3, 3);
/* Init Timer */
Chip_TIMER_Reset(DEMODULATOR_TIMER);
/* Reset Timer */
/* Ftimer = Fck/12 -> 48MHz/12 = 4MHz */
Chip_TIMER_PrescaleSet(DEMODULATOR_TIMER, 11);
/* Falling edge */
Chip_TIMER_CaptureFallingEdgeEnable(DEMODULATOR_TIMER, DEMODULATOR_TIMER_CAPTNUM);
/* Enable INT */
Chip_TIMER_CaptureEnableInt(DEMODULATOR_TIMER, DEMODULATOR_TIMER_CAPTNUM);

Chip_TIMER_MatchEnableInt(DEMODULATOR_TIMER, DEMODULATOR_TIMER_MATCHNUM);

Chip_TIMER_ClearMatch(DEMODULATOR_TIMER, DEMODULATOR_TIMER_MATCHNUM);

Chip_TIMER_SetMatch(DEMODULATOR_TIMER, DEMODULATOR_TIMER_MATCHNUM, DEMODULATOR_TIMER_MC_VALUE);

/* Start timer */
Chip_TIMER_Enable(DEMODULATOR_TIMER);
/* Turn on int */
NVIC_SetPriority(DEMODULATOR_TIMER_IRQ, 5);

NVIC_EnableIRQ( DEMODULATOR_TIMER_IRQ);

 

 

/* IRQ Handler*/

void DEMODULATOR_TIMER_IRQHandler(void)
{
if (Chip_TIMER_CapturePending(DEMODULATOR_TIMER, DEMODULATOR_TIMER_CAPTNUM))
{

Chip_TIMER_ClearCapture(DEMODULATOR_TIMER, DEMODULATOR_TIMER_CAPTNUM);

}

else if (Chip_TIMER_MatchPending(DEMODULATOR_TIMER, DEMODULATOR_TIMER_MATCHNUM))

Chip_TIMER_ClearMatch(DEMODULATOR_TIMER, DEMODULATOR_TIMER_MATCHNUM);
}

 

 

 

Interrupt occur but for match compare ONLY.

With my oscilloscope I can see in PIO3_3 the input square wave

 

Any Ideas?

 

Thank a lot

Outcomes