Hi everyone,
I'm working in a new project with a KL02 KSD 3.0 and SDK 1.3. I've created a small program and I'm using a LPTMR to increment a variable but the program never jumps to the interrutp function.
Does anyone know what could be the problem?
I'm using the folowing sample code:
main.c
int main(void)
{
// Configure LPTMR.
lptmr_state_t lptmrState;
lptmr_user_config_t lptmrUserConfig =
{
.timerMode = kLptmrTimerModeTimeCounter, /*! Use LPTMR in Time Counter mode */
.freeRunningEnable = false, /*! When hit compare value, set counter back to zero */
.prescalerEnable = false, /*! bypass prescaler */
.prescalerClockSource = kClockLptmrSrcLpoClk, /*! use 1kHz Low Power Clock */
.isInterruptEnabled = true
};
// Configure board specific pin muxing
hardware_init();
// Initialize LPTMR
LPTMR_DRV_Init( 0, &lptmrState, &lptmrUserConfig );
// Set the timer period for 1 msecond
LPTMR_DRV_SetTimerPeriodUs( 0, 1000000 );
// Specify the callback function when a LPTMR interrupt occurs
LPTMR_DRV_InstallCallback( 0, LptmrTick );
// Start counting
LPTMR_DRV_Start( 0 );
for (;;) // Forever loop
{
//__asm("NOP");
if( systemCounter != 0 )
{
if( systemCounter > 2 )
{
systemCounter = 0;
}
}
else
{
__asm("NOP");
LPTMR_HAL_GetCounterValue(LPTMR0);
//LPTMR_DRV_IRQHandler(0U);
}
}
}
static void LptmrTick( void )
{
systemCounter++;
}
fsl_lptmr_irq.c
#if (FSL_FEATURE_SOC_LPTMR_COUNT > 0U)
void LPTMR0_IRQHandler(void)
{
LPTMR_DRV_IRQHandler(0U);
}
#endif
Thankyou.