Asynchronous Serial communication throwing "over fram error"
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Asynchronous Serial communication throwing "over fram error"
Tx source is transmitting data at 1200 baud rate, and my application is receiving data at 1200 baud rate,
my application reads correct data, but it throws over fram error in between, I am not able to find out why?
Anyone has solution for this problem?
I program serial comms for my work, and I have to be honest - I have no idea what the above statement means. Post the error you get/some code that generates the error/the error number you get from whatever function you're calling that fails.
One thing that could cause that is disabling the transmitting UART between packets while it's attempting to transmit whatever padding or filler bytes you might be sending (or maybe even during the final stop bit). Or even more likely, disabling whatever logic is between the transmitting and receiving UARTs.
If that's what's happening, it can be solved by putting a short delay after the packet is transmitted but before anything is disabled.
But if you're transmitting a frame-check value (CRC or checksum) with each packet, you can safely ignore all UART errors. If the receiving process recalculates the frame-check and it matches, then the packet is good regardless of what the UART gripes about.
Framing errors generally mean that a stop bit was expected, but not found. There can be a number of causes, most of which are configuration errors. If the sender and receiver do not agree about the format of the data, it is easy to cause framing errors. You have stated a bitrate (1200 bps), but not the rest of the data format. There is word size, (almost always 8 or 7 bits), parity type, if any, and number stop bits. Make sure both ends of the communications channel are using the same configuration.
It is also possible that the data actually is getting corrupted on the wire. This can result from improper cabling, failing transmitter or receiver electronics, or external noise sources. Do you have a ground pin connecting the two hosts/devices? One of the devices may have a faulty timing source (usually a crystal, or an oscillator on-board the CPU). The clocks of both transmitter & receiver must be in agreement or the receiver will see an invalid bit where it expects to see a stop bit. If this is the case, it should be easier to reproduce the fault when sending certain bytes, but not so easy with other bytes. If you are able to control the byte stream in both directions, try sending streams of data and compile some statistics about which bytes cause more errors. If there is a big spike in the number of occurrences for certain bytes, it could point to timing problems.
--- rod.
One thing that could cause that is disabling the transmitting UART between packets while it's attempting to transmit whatever padding or filler bytes you might be sending (or maybe even during the final stop bit). Or even more likely, disabling whatever logic is between the transmitting and receiving UARTs.
If that's what's happening, it can be solved by putting a short delay after the packet is transmitted but before anything is disabled.
But if you're transmitting a frame-check value (CRC or checksum) with each packet, you can safely ignore all UART errors. If the receiving process recalculates the frame-check and it matches, then the packet is good regardless of what the UART gripes about.
Yes, I meant UART reports a framing error!....transmission application is not supposed to be changed, and it does not have any CRC included, and there is around 300ms of delay for every 200 bytes of transmission!
Framing errors generally mean that a stop bit was expected, but not found. There can be a number of causes, most of which are configuration errors. If the sender and receiver do not agree about the format of the data, it is easy to cause framing errors. You have stated a bitrate (1200 bps), but not the rest of the data format. There is word size, (almost always 8 or 7 bits), parity type, if any, and number stop bits. Make sure both ends of the communications channel are using the same configuration.
It is also possible that the data actually is getting corrupted on the wire. This can result from improper cabling, failing transmitter or receiver electronics, or external noise sources. Do you have a ground pin connecting the two hosts/devices? One of the devices may have a faulty timing source (usually a crystal, or an oscillator on-board the CPU). The clocks of both transmitter & receiver must be in agreement or the receiver will see an invalid bit where it expects to see a stop bit. If this is the case, it should be easier to reproduce the fault when sending certain bytes, but not so easy with other bytes. If you are able to control the byte stream in both directions, try sending streams of data and compile some statistics about which bytes cause more errors. If there is a big spike in the number of occurrences for certain bytes, it could point to timing problems.
--- rod.
Hello rod, firstly, the data format has 10 bits, i.e 1 startbit,8 data bits,1 stopbit...in total 10 bits...both transmitting and receiving side
has 1200 baud rate, infact i am receiving the exact data,but sometimes in between receiving UART throws "over fram error"...I don't think in this case
there might be a problem with cables, because same cables i've been using for testing purpose, it is not giving
any problem!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.