AnsweredAssumed Answered

S32K144 multiple interrupt enable

Question asked by Pradeep Aithal on Dec 18, 2019
Latest reply on Dec 31, 2019 by Daniel Martynek

I am trying to enable multiple interrupts one after the other, but only one interrupt which is enabled first is activated.

Please find below the snippet of the code (in this case only LPIT0 is interrupt is generated)

 

void NVIC_IRQs_Init (void)

{

  S32_NVIC->ICPR[1] = 1 << (48 % 32);  /* IRQ48-LPIT0 ch0: clr any pending IRQ*/

  S32_NVIC->ISER[1] = 1 << (48 % 32);  /* IRQ48-LPIT0 ch0: enable IRQ */

  S32_NVIC->IP[48] = 0x3;             /* IRQ48-LPIT0 ch0: priority 0 of 0-15*/

 

  S32_NVIC->ICPR[1] |= (1 << (33 % 32));  /* IRQ33-LPUART ch1: clr any pending IRQ*/

  S32_NVIC->ISER[1] |= (1 << (33 % 32));  /* IRQ33-LPUART ch1: enable IRQ */

  S32_NVIC->IP[33] = 0x1;             /* IRQ33-LPUART ch1: priority 2 of 0-15*/

}

 

void LPIT0_Ch0_IRQHandler (void)

{

  LPIT0->MSR |= LPIT_MSR_TIF0_MASK; /* Clear LPIT0 timer flag 0 */

          /* Perform read-after-write to ensure flag clears before ISR exit */

}

 

void LPUART1_RxTx_IRQHandler (void)

{

       char receive;

       if(LPUART1->STAT & LPUART_STAT_RDRF_MASK)

              {

              receive= LPUART1->DATA;            /* Read received data*/

              }

       while((LPUART1->STAT & LPUART_STAT_TDRE_MASK)>>LPUART_STAT_TDRE_SHIFT==0);

}

 

If i initialize UART interrupt only, then UART interrupt will be activated.

 

PN: Designed with the help of S32K cookbook

Outcomes