S32K116 LPIT high frequency interrupt

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

S32K116 LPIT high frequency interrupt

1,133 Views
rjmalmeida0
Contributor III

Hi, i'm trying to toggle a pin at a frequency higher than 1MHz using the LPIT. I've configured the Sys, Bus and peripheral clock to the SOSC @ 40MHz configured frequency (as seen on printscreen). The issue appears when  I try to configure the LPIT to interrupt every 40 ticks (or periods). The frequency of the pin toggle should be 1MHz but it goes down to 500kHz (approx). And when I put values lower than 40, the frequency slowly goes up from the 500kHz, at every lower value. Am I missing something? Below is my configuration inside main function and the ISR.

int main(void) {
 /* Write your local variable definition here */
 /* Initialize system and peripheral clocks */
 CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
   g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
 CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);
 /* Initialize Pin settings*/
 PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
 /* Install interrupt */
 INT_SYS_InstallHandler(LPIT0_IRQn, &LPIT_ISR, (isr_t *) 0);
 /* Enable interrupt */
 INT_SYS_EnableIRQ(LPIT0_IRQn);
 /* Initialize LPIT Timer */
 LPIT_DRV_Init(INST_LPIT1, &lpit1_InitConfig);
 LPIT_DRV_InitChannel(INST_LPIT1, 0U, &lpit1_ChnConfig0);
 LPIT_DRV_StartTimerChannels(INST_LPIT1, (1 << 0U));

 for (;;){}

  return exit_code;
} 

void LPIT_ISR(void)
{
 PTB->PTOR = (((uint32_t)(((uint32_t)((1 << 13U)))<<GPIO_PTOR_PTTO_SHIFT))&GPIO_PTOR_PTTO_MASK);
 /* Clear LPIT channel flag */
 LPIT0->MSR = (1 << 0U);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks in advance

Labels (1)
0 Kudos
1 Reply

829 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Rui, 

Could you please share your project with me so I can reproduce the behavior you mentioned and make some tests on my side? 

Best regards, 

Victor 

0 Kudos