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:
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
已解决! 转到解答。
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
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