I am having trouble using the KW36 board. The problem is: the data receiving buffer area of the serial port is not big enough. However, I have not found any place to modify it. Can you know how to modify it?
Thanks in advance
Hi Tang, I hope you're doing well!
Just to confirm, which communication protocol are you using?
In the case of UART, you could take a look at the driver example for LPUART included in the SDK of the KW36. In that example, they use a ring buffer that can be configured in different to have a different size, maybe it will be useful to you.
Please take a look and tell me if that works for you.
First of all, thank you very much for answering my question. I am using uart, can I only modify the ring buffer in the modified buffer? Is there a way to directly modify the buffer? What function should I use to receive data after modifying the ring buffer? Is the LPUART_ReadBlocking function ok? Still need to use the LPUART_TransferReceiveNonBlocking function to receive data.
The example shows a way to use an additional second buffer for UART data reception, this second buffer's size can be changed. This is done for optimization purposes so that you can use set the buffer to be the size you need.
Also, that one example receives data in a blocking way, but one of the other examples in the same directory shows how to do it using interrupts so it's a non-blocking implementation.
Could you please share more details about your final application or why do you need a bigger buffer?
Thank you for your help. I am a graduated college student. In the process of internship, my goal is to realize uart communication between two development boards. After I send a string of data, another development board will return at least 40 at a time. The data of the bytes, when I use the normal LPUART_WriteBlocking function, the data reception overflow occurs, so that all the data cannot be received. So I want to solve this problem by modifying the size of the data receive buffer. Thank you again for your help.
Could you please make sure you're clearing the Rx FIFO after receiving data? Because that could be the reason why you're getting a data overflow.
Also, there is a field in the LPUART FIFO Register called RXFIFOSIZE, however, it's a read-only field which will tell you the current size of the Buffer.
Thank you for answering my question again.My understanding is that the data sent from another MCU is sent at once, and overflow has occurred when I have not had time to receive the data. This is what I saw through the debug mode. So I just want to achieve the ultimate goal by modifying the size of the buffer.In addition, if I need to implement the function, can I only use the ring buffer to achieve it?
If you are getting Rx overruns it is because you are not responding fast enough to clear the Rx registers in the LPUART.
Increasing the SW buffer size will not help since this will not stop HW overruns.
You should use DMA reception at the UART Rx to ensure that no overrun can occur.
Ok, thank you very much, I will try to see if it is useful.
Retrieving data ...