Hi Joey,
Thanks for your replay with practical example of 1 sec LPTMR duration.
Can you please let me know if there is any mistake in my configuration of LPTMR as described below .?
Because i have tried with LPO clock & i was getting +2 ms offset(measured time 100200) for 1 sec(1000000U) timer duration.
My configuration:
static void startHwTimer(uint32_t pulseDuration)
{
lptmr_config_t lptmrConfig;
LPTMR_GetDefaultConfig(&lptmrConfig);
/* Initialize the LPTMR */
LPTMR_Init(LPTMR0, &lptmrConfig);
/* Set timer period. */
LPTMR_SetTimerPeriod(LPTMR0, (uint32_t)USEC_TO_COUNT(pulseDuration, CLOCK_GetFreq(kCLOCK_LpoClk)));
/* Enable timer interrupt */
LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);
/* Enable at the NVIC */
EnableIRQ(LPTMR0_IRQn);
/* Start counting */
LPTMR_StartTimer(LPTMR0);
}
void LPTMR0_IRQHandler()
{
mwGpio_write(3, 6, LOW);
LPTMR_StopTimer(LPTMR0);
LPTMR_ClearStatusFlags(LPTMR0, kLPTMR_TimerCompareFlag);
}