dataloss in UART

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AbPa_4654881
Level 3
Level 3
10 replies posted 10 questions asked 10 likes given

Hi all,

I am using UART[v2.50] with CY8CKIT-059 that is is configured at 115200 Baud rate, 8 bytes data, parity none, 1 stop bit, oversampling 8 (default). I want to send large .txt file (~2-3 MB) over UART. I am sending that .txt file from my PC COM port ( that is also configured at same specifications ) to CY8CKIT-059 using Tera term (terminal) but I am seeing data loss at receiver side (on CY8CKIT-059). is there any way I can get perfect data on receiver side (no data loss). I have tried Xon/xoff flow control (in tera trem) also but still data loss is there.

Is there possible to use hardware flow control to get rid of data loss? if Yes please help with an example of hardware control in PSOC creator. I am not getting any eample.

or is there any other way I can send that large file to CY8CKIT-059 without any dataloss?

0 Likes
3 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

AbPa,

The UART [V2.50] supports RTS/CTS HW flow control.  That might help.

Another choice is using my Terminal component I submitted.  Terminal Support Component Library

This Terminal component (I call Term) embeds the UART [V2.50] and the USB_UART components into the one component.

The advantage of Term is that if you wrote code for the UART component, you can switch to the USB_UART configuration without changing your API calls.  I've converted many of the common API calls for the UART to USB_UART equivalent calls.  That way you can use the USB port on the CY8CKIT-059 target board seamlessly.

In the USB_UART configuration, the effective data transfer rate is about 1.3Mbps.  The USB_UART is automatically flow controlled and you can set your Terminal program on the PC side to a higher rate such as 1Mbps to achieve more throughput.

There are a few other advantages of the Term component which includes a String_Funcs library and a MenuCmds library for you to create single-character menu command interface quickly and easily.

Check it out.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

AbPa,

Check that UART clock correctly producing 115k (Clk/8). There are usually some small deviations, which can accumulate if transmitted message is too long. You probably have to play with PLL and clock divider settings to find closest frequency. Check UART Tx frequency for deviation (though it is usually OK). Try to increase UART Rx oversampling to 16. Try adding XTAL or MEMS to stabilize the PSoC Master clock.

/odissey1

0 Likes
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello AbPa.

Can you tell us how you determine data is being lost?

Are you counting bytes?

Performing a checksum calculation?

Displaying data on an LCD?

We need a few more details of your 5LP configuration.

What size of RX buffer are you using?

Does 5LP use RX interrupts, or is s/w polling for data available?

Does 5LP use DMA to transfer RX data from UART to somewhere?

Since KIT-059 5LP can not store 2-3MBytes of data, you must be doing something with it.

Is 5LP processing RX data inside the RX ISR?  If so, this is not a good practice as you can easily loose data if the processing takes too long.

If 5LP is processing RX data from main.c, can main.c keep up with the RX data rate?

What clock speed is 5LP running? 24MHz, 48MHz, 80MHz?  Other?

You don't need to provide answers to all the above questions, but we need more info to help you.

Len has suggested/provided an excellent UART component library.

MoTa also has a great UART utilities library (for PSoC 4 and 5LP).

tty_utils a utility sample for CLI type program

It uses RX interrupts.

And good suggestions from odissey1.  Long data transmissions can sometimes get out of sync with mis-matches of baud rates.

As a simple test, program 5LP UART for 9600 and set TeraTerm to match.  Now try the file transfer.  Yes, it will take much-much longer to transfer, but, it will also inform you if you have a s/w bug and/or a s/w bottleneck.

Good luck with your project.

0 Likes