S32K312 _UART_DMA_Data_Loss

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

S32K312 _UART_DMA_Data_Loss

Jump to solution
1,183 Views
LiekLi
NXP Employee
NXP Employee

Hi All,

My customer is developing T-box. They use uart to communicate with a 5G module, and meet an issue. The 5G module continuesly sends data with UART in a very shot interval, about 1-2ms, 230400bps. Then we will see severe  frame will lost.

  Here we can see the function call:

LiekLi_0-1668408015735.jpeg

LiekLi_1-1668408030506.jpeg

Seems in the uart IDLE irq, the RTD low level code will stop the DMA and receiving, then open it again. This mechanism will create a receiving gap, during this gap, the DMA cannot receive data. So if the sending interval is too short, it may lose frames.    

The SDK we used is  S32K3_RTD_2_0_0_D2203_ASR_REL_4_4_REV_0000_20220331.

Do we have some demo code to handle the UART DMA receiving with ping-pang buffer?

Thanks very much for support.

 

Best Regards,

Liek

 

0 Kudos
1 Solution
1,173 Views
Jeremy_He
NXP Employee
NXP Employee

Hi Liek,

After testing, you can use below code to replace the AbortReceivingData( ) function and UartReceivingData function to reduce the gap. And I attached a dual buffer example with S32K344 and lower version RTD for your reference, it can be easily migrate to RTD2.0.1. 

 

             /* Enable LPUART0 idle receiving */

        IP_LPUART_0->CTRL |= LPUART_CTRL_ILIE(1);

        Lpuart_Uart_Ip_SetRxBuffer(INST_LPUART4, uart4_DMA_recv_buffer1, RX_BUFFER_SIZE);

        /*reset the Buffer address to DMA as well.*/

        IP_TCD->TCD1_DADDR = uart4_DMA_recv_buffer1; /*in my code TCD1 is used for UART RX, please choose the right TCD in your application*/

        IP_TCD->CITER1.TCD1_CITER_ELINKNO = RX_BUFFER_SIZE;

 

 

 

Best Regards,

Jeremy

View solution in original post

0 Kudos
3 Replies
1,174 Views
Jeremy_He
NXP Employee
NXP Employee

Hi Liek,

After testing, you can use below code to replace the AbortReceivingData( ) function and UartReceivingData function to reduce the gap. And I attached a dual buffer example with S32K344 and lower version RTD for your reference, it can be easily migrate to RTD2.0.1. 

 

             /* Enable LPUART0 idle receiving */

        IP_LPUART_0->CTRL |= LPUART_CTRL_ILIE(1);

        Lpuart_Uart_Ip_SetRxBuffer(INST_LPUART4, uart4_DMA_recv_buffer1, RX_BUFFER_SIZE);

        /*reset the Buffer address to DMA as well.*/

        IP_TCD->TCD1_DADDR = uart4_DMA_recv_buffer1; /*in my code TCD1 is used for UART RX, please choose the right TCD in your application*/

        IP_TCD->CITER1.TCD1_CITER_ELINKNO = RX_BUFFER_SIZE;

 

 

 

Best Regards,

Jeremy

0 Kudos
1,159 Views
LiekLi
NXP Employee
NXP Employee
Hello Jeremy,

Thanks very much for your support, it works.
0 Kudos
938 Views
guochuan
Contributor III

hi @LiekLi 

How many bytes is the DMA transmission? I use dma transmission, 100ms to send 100 bytes once, can not enter the send completion interrupt, is it normal?

0 Kudos