K64F UART LF (\n) problem

Showing results for 
Search instead for 
Did you mean: 

K64F UART LF (\n) problem

Contributor I


we are having a problem with the UART on a FRDM-K64F board. We are trying to communicate with a device that returns LF (line feed) as part of its data and the UART seems to be having problems processing the LF when it is located in some parts of the message.

We are using the KSDK fsl_uart driver, the UART configuration is as follows: 9600 8N1.

We are also using the blocking functions for write and read.

The data we are expecting to receive is: "set uart mode 0x11\r\r\nOK\r<1.00> \r\n" (without the quotes).

The data we receive is: "set uarts0x11\r\r\nOK\r<1.00> \r"

We turned on the Flow Control on the K64F and that's how we determined that the "\n" is making the problems.

Provided below are captures of the oscilloscope with for the messages "set uart mode 0x11\r\r\nOK\r<1.00> \r\n" and "set uart mode 0x11\r\rOK\r<1.00> \r\n". As you can see the message without the "\n" in the middle goes through as expected.

The yellow signal represents the RTS from the K64F and the cyan signal represents the data going to the RX of the K64F.

The RTS was not connected to the CTS of the device we are trying to communicate with as we don't intend to use it on such low baud.

We presume that the problem is with the K64F as the RTS signal goes high for a long time.

     Image for "set uart mode 0x11\r\r\nOK\r<1.00> \r\n":


     Image for "set uart mode 0x11\r\rOK\r<1.00> \r\n":


If anyone has any idea why this is happening, or any way to fix it, that would be nice. :smileygrin:

Thanks in advance,

Stefan Mitic.

0 Kudos
1 Reply

NXP Employee
NXP Employee

Hello Stefan Mitic:

Thank you for using the NXP Community.

- What version of KSDK are you using, v1.3 or v2.0?

- Are you using any RTOS (MQX, FreeRTOS) or just baremetal code?

- Please share your project or at least the code where you call the APIs to receive data. I will try to reproduce the issue.

Looking forward to your response.

Best Regards!

Jorge Gonzalez

0 Kudos