I'm trying to use LPTMR to create a 1ms periodic interrupt for a bare metal simple scheduler. I'm programming for NXP's S32K144 using S32DS for ARM, with the S32K14x RTM SDK for GCC, version 2.0.0 (not the beta).
I have already added the LPTMR component to my project, and used component inspector to adjust a timer configuration to suit. Right now, the config is as below:
Code:
-------------------
const lptmr_config_t lpTmr1_config0 = {
.workMode = LPTMR_WORKMODE_TIMER,
.dmaRequest = false,
.interruptEnable = true,
.freeRun = false,
.compareValue = 1000U,
.counterUnits = LPTMR_COUNTER_UNITS_MICROSECONDS,
.clockSelect = LPTMR_CLOCKSOURCE_RTC,
.prescaler = LPTMR_PRESCALE_4_GLITCHFILTER_2,
.bypassPrescaler = false,
.pinSelect = LPTMR_PINSELECT_TRGMUX,
.pinPolarity = LPTMR_PINPOLARITY_RISING,
};
-------------------
Also, I have created a custom LPTMR0_IRQHandler() function;
And I have added some timer setup code to main():
Code:
-------------------
LPTMR_DRV_Init(INST_LPTMR1, &lpTmr1_config0, TRUE);
LPTMR_DRV_SetInterrupt(INST_LPTMR1, TRUE);
-------------------
However, while debugging, it seems that the interrupt handler is never executed.
What am I missing here?
Also, do I need to clear anything in LPTMR registers before leaving the ISR?
Best regards,
Joao