S32K lpuart receive dynamic byte sizes at once with interrupt

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

S32K lpuart receive dynamic byte sizes at once with interrupt

528 Views
afa25
Contributor II

Hi,

I am trying to get uart messages with interrupt. I have seen examples with interrupts however, these examples take the message one byte at a time. I wonder if there is a way to get whole bytes at once.

For example: if I send a message to the board with size 5, ISR should get 5 bytes at once. After that, if I send 47 bytes as an example, ISR should get 47 bytes at once.

Thank you.

Tags (3)
0 Kudos
4 Replies

510 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @afa25 

In the UART chapter of the S32K1 and S32K3 reference manuals, you can find that most family variants have a FIFO that supports 4 words, and some instances support 16.
In other words, the maximum number of characters you could receive per interrupt is the total size of the FIFO.
I can suggest using the UART with DMA together to handle a more significant amount of data.

 

B.R.

VaneB

0 Kudos

502 Views
afa25
Contributor II
Thank you,

Is there any simple example project related to LpUart with DMA?
0 Kudos

498 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @afa25 

Unfortunately, we do not have LPUART DMA examples or training material.

However, there is a LpuartFlexio_Uart_Ip_Example RTD example that can be modified.

  1. Change the Uart method from Using Interrupts to Using DMA in the GUI of the UART driver.
  2. Add DMA driver to the project (Dma_Ip)
  3. Add DMA channels in the GUI of the DMA driver (Dma logic channels)
  4. Link the DMA channels in the UART driver.
  5. Update/generate the RTD code.
  6. Initialize the DMA driver in the code (Dma_Ip_Init()).
0 Kudos

468 Views
afa25
Contributor II

Thank you! 

I will try it. 

0 Kudos