I recently encountered a problem while debugging the S32K314 serial port. Previously, I was using the GD32/STM32 platform, and when using the serial port for real-time printing, my approach was as follows: the application layer processed the printed characters, and the underlying write function was called to send them out via interrupt.
Joker_Y_2-1781951653320.png
Joker_Y_4-1781951712695.png
Joker_Y_5-1781951735385.png
This data is written directly to the data register and sent out quickly. Therefore, there's no need to panic when the application layer receives a large amount of data, as there's a queue, and data transmission is fast. However, when using S32K3, I found that the asynchronous send function `Lpuart_Uart_Ip_AsyncSend` is relatively slow, with nested layers. Relatively speaking, for the same number of bytes of printed data, S32K3 is much slower than GD32. AI provides a solution.
Joker_Y_6-1781952019622.png
In the application layer, the write-by-write method is changed to writing to the underlying layer using a large buffer. Then, the underlying write function and interrupt are handled in the following way.
Joker_Y_7-1781952213976.png
Joker_Y_8-1781952251883.png
This method does improve speed, but it requires a lot of RAM. Is there a better way that is better in terms of both space and efficiency?
do you use any operating system at MCU level or just baremetal?
Operating system used
Hi@ Joker_Y
If possible, you can try to implement LPUART transmission directly using registers.
Could you please provide an example of how to do this?