LPUART receive interrupts supported?

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

LPUART receive interrupts supported?

3,520 Views
fredericksoo
Contributor II

The Reference Manual 47.4.6 says that the transmitter has two interrupts - but does not mention any receiver interrupts.  The register description for CTRL[RIE] indicates that the receive interrupt is triggered on receive buffer full. Are interrupts on receive buffer full supported?  Or is it intended to use DMA and receive interrupt that way?  

I've set the NVIC ISR vector for LPUART1 receive interrupts:

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

S32_NVIC->ISER[1] = 1 << (33 % 32); /* enable IRQ */

S32_NVIC->IP[8] =0x0A; /* priority 10 */

and enabled CTRL[RIE]:

LPUART1->CTRL=0x002C0000;    /* Enable transmitter & receiver, no parity, 8 bit char: receive interrupts enabled*/

and have an interrupt handler:

extern "C" void LPUART1_IRQHandler (void){

// UART RECEIVE

S32_NVIC->ICPR[LPUART1_NIPR_ADDR] = 1 << (LPUART1_IRQ % 32); /* clr any pending IRQ*/

   if((LPUART1->STAT & LPUART_STAT_RDRF_MASK)>>LPUART_STAT_RDRF_SHIFT==1)

   {

      lpuart1_receive = LPUART1->DATA;

   }

}

but am not seeing an interrupt triggered when the receive buffer flag is full; and then it overruns.

0 Kudos
2 Replies

2,005 Views
fredericksoo
Contributor II

Thanks - I found the issues and now it is working:

1) using LPUART 1 - vector is 33 for the LPUART1 TX/RX.  A little confused - as the LPUART0 TX/RX is actually NVIC Interrupt ID 31 (but your example uses 32).

2) I named my ISR routine incorrectly - it is LPUART1_1RxTx_IRQHandler (I had omitted the 'RxTx')

Fred

0 Kudos

2,005 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

There are two interrupts in S32K144 vector table (DS, startup_S32K144.S):

LPUART0_RxTx_IRQHandler /*LPUART0 receive/transmit interrupt*/

LPUART0_ERR_IRQHandler  /*LPUART0 Receive overrun, parity error, framing error… */

 

The vector numbers are 32 and 33 for LPUART0_RxTx_IRQHandler and LPUART0_ERR_IRQHandler respectively.  So you should have:

 

// LPUART1 receive/transmit interrupt

S32_NVIC->ICPR[1] = (1 << (32 % 32));

S32_NVIC->ISER[1] = (1 << (32 % 32));

S32_NVIC->IP[32] = PRIORITY_N;   

 

// LPUART1 Receive overrun, parity error, framing error or noise error

S32_NVIC->ICPR[1] = (1 << (33 % 32));

S32_NVIC->ISER[1] = (1 << (33 % 32));

S32_NVIC->IP[33] = PRIORITY_N;

 

Note the IP index is also the vector number.

 

I have tried received data via UART and the interrupt 32 is triggered when the flag is set.

 

Regards,

Daniel