UART driver limited to 4 bytes of receiving?

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

UART driver limited to 4 bytes of receiving?

Jump to solution
1,240 Views
VolcanicCheese
Contributor III

Hello,

I am trying to implement lpuart rtos example driver code with a MIMXRT 1020 dev board as the master and Arduino Uno as the servant. I used a pre-made level converter to match signal to 3.3V. When testing the example code the with the lpuart config to UART2 (same issue with UART1), the receiving has a hardware buffer overrun issue when needed to receive a message longer than 4 bytes. I tried different setting of baud rate, receive buffer and background buffer. Also, when using baud rate of 115200, some of the message get corrupted. This issue was resolved using a lower baud-rate. Currently, I am speculating that the issue is software because with a lower baud rate it is able to receive any byte size less than or equal to 4 bytes. I was wondering if anyone has experiences with this issue? Thank you!

0 Kudos
1 Solution
1,229 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @VolcanicCheese :

 

Please refer to the readme file, 

The LPUART example for FreeRTOS demonstrates the possibility to use the LPUART driver in the RTOS. The example uses single instance of LPUART IP and writes string into, then reads back chars.
After every 4B received, these are sent back on LPUART.

From the source code, we can see the recv_buff is 4 bytes.

uint8_t recv_buffer[4];

 

You can modify it according to your project.

 

Regards

Daniel

 

 

View solution in original post

0 Kudos
4 Replies
1,230 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @VolcanicCheese :

 

Please refer to the readme file, 

The LPUART example for FreeRTOS demonstrates the possibility to use the LPUART driver in the RTOS. The example uses single instance of LPUART IP and writes string into, then reads back chars.
After every 4B received, these are sent back on LPUART.

From the source code, we can see the recv_buff is 4 bytes.

uint8_t recv_buffer[4];

 

You can modify it according to your project.

 

Regards

Daniel

 

 

0 Kudos
1,208 Views
VolcanicCheese
Contributor III

Sorry for the late reply, Yes I did that already and did not solve the problem. I tried sending it chunks, but that did not solve the problem. It sends and receive the message "some" successfully. Then, when continuing it starts to receive "omes". Then it would send "omes". Then receive back "meso". This cycle of first byte going to last byte continuously happens.

0 Kudos
1,190 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @VolcanicCheese :

 

Which version of SDK you are using? I would suggest you download the latest SDK from below link and try it again.

https://mcuxpresso.nxp.com/en/welcome

 

Regards

Daniel

Regards

Daniel

0 Kudos
1,140 Views
VolcanicCheese
Contributor III

Thank you. The problem was the limitation of the hardware of using arduino uno with a bidirectional logic level converter.

0 Kudos