I use UART between two system (which have 2 proccesors). The uart of transmiter has clock frequency off 100MHz. and the uart of the receiver has a clock of 125MHz. The baud rate I use is 1e6. I can see that in some of the messages there is a bit flip.

Can it be because of the baud rate? Should I use another baud rate?

  • \$\begingroup\$ Are you saying the UART peripheral in the two systems is set up at different baud rates? Or that the clock frequency of the two processors is different? If the former, then yes, you absolutely must have them at the same baud rate. \$\endgroup\$ – DiBosco Sep 19 '17 at 12:12
  • 2
    \$\begingroup\$ What you should do is proofread your posts. This short question has a ridiculous number of typos, which is annoying and insulting to the people from whom you want advice. Is this really the first impression you want to make? \$\endgroup\$ – Dave Tweed Sep 19 '17 at 12:25
  • \$\begingroup\$ @DiBosco- I said that the clock frequency of the two processors is different. \$\endgroup\$ – sara r Sep 19 '17 at 12:29
  • 3
    \$\begingroup\$ You did not, you said the transmitter and receiver had different clock frequencies. That is not clear whether you mean the processors or the UART peripherals and you still haven't answered. We're kindly trying to help you, so stop being so defensive and clarify yourself. \$\endgroup\$ – DiBosco Sep 19 '17 at 12:35
  • 1
    \$\begingroup\$ @DiBosco - by all means I didn't mean to be defensive. I edited the question. \$\endgroup\$ – sara r Sep 19 '17 at 13:02

For UART communication, both ends need to run at the same baud rate, ±3% or so for most cases. 3% error allows for ¼ bit time error in the middle of the 8th data bit.

While the UART baud rate is usually derived from the main oscillator of a processor, there is usually the opportunity to divide it down to select 16x the desired baud rate. For common UART hardware, the internal clock to the UART would therefore need be 16 MHz to achieve 1 MBaud.

Note that neither 100 MHz nor 125 MHz can be divided by a integer and result in 16 MHz ±3%. You need to check the documentation that what you are trying to do is really possible with the hardware you have. It could be that neither processor is really running its UART at 1 MBaud. You likely need a much slower baud rate where 16x the baud rate can be achieved by dividing both the clocks by a integer.

Even if you really are getting 1 MBaud from both ends, keep in mind that such a fast signal won't make it thru common RS-232 converter chips. Basically, these are just ordinary digital signals between two chips on the same board.

  • \$\begingroup\$ The divide by 16 is not necessarily an issue; there are a number of micros these days that have UART peripherals with fractional divide to derive the baud rate. \$\endgroup\$ – DiBosco Sep 19 '17 at 13:02
  • \$\begingroup\$ @Olin Lathrop - So which baud rate do you recommend to use? \$\endgroup\$ – sara r Sep 19 '17 at 13:06
  • 1
    \$\begingroup\$ @DiB: It may not be a issue, as I said. However, it is definitely something that needs to be checked, since 16x is very common. \$\endgroup\$ – Olin Lathrop Sep 19 '17 at 13:12
  • \$\begingroup\$ @sara: As I said, find something that can be derived from both clocks divided by a integer, unless of course you have unusual UART hardware with something like a PLL in its clock chain. I've never seen that, but it could be out there. This should all be in the datasheet, of course. \$\endgroup\$ – Olin Lathrop Sep 19 '17 at 13:13
  • 1
    \$\begingroup\$ @OlinLathrop I appreciate you said it may not be an issue, but I respectfully disagree that it's unusual to find fractional divide these days. It's pretty common on modern processors in my experience and you get perfectly adequate accurancy. \$\endgroup\$ – DiBosco Sep 19 '17 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.