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.
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.
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.
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?