zahra
zahra

Reputation: 11

Losing serial data while transferring with high baud rate

I have read your questions about Serial port communication. But we have a problem with serial port communication.

One problem that i have seen is that : in high baud rate we lose some data in receiver side. Would you tell me why would this happen? and how can I fix it ,please ?

We have a device that send data with 115200 baud rate and the receiver had set to same baud rate , but sometimes some bytes of data get lost while transferring.

Upvotes: 1

Views: 3581

Answers (2)

PeterM
PeterM

Reputation: 2614

115,200 is a pretty high baud rate if you only need to transmit about 300 bytes per second. You might be able to get a more stable connection by dropping the rate lower. It's certainly worth trying if you are able to set both sides of the connection yourself.

Also, how long is your cable? Did you make it yourself? There are lots of things that can contribute to dropping data and cables often play a big part of that.

Lastly, you might want to assume that data will end up being lost and take that into account. At only 300 bytes, you could afford to send more data than you need i.e. you could probably re-transmit any data that might have been corrupted or lost without much penalty. Obviously this depends on whether or not you control the protocol or can configure different speeds on the devices.

Upvotes: 1

Andy
Andy

Reputation: 5278

It could be that you are overflowing the receive buffer of the receiver. Without any more implentation detail it is hard to say.

How many bytes does your Transmitter commonly send?

Does your Transmitter/Receiver devices support flow control? It may be that you will have to use this.

This will effectively enable your Receiver to say to your Transmitter "Hang on, stop sending for a while, let me deal with what I have first."

Hardware flow-control is (commonly) utilised through the RTS (Request To Send) and CTS (Clear To Send) pins.

Take a look at this article, which explains a bit more about it.

Upvotes: 0

Related Questions