2
\$\begingroup\$

For a 24MHz system, the local clock error associated with transmitting 10-bit character frames at 38.4 Kbaud using the SCI of a Freescale Micro is 0.16%.

How? I can't figure out the math that actually makes sense to get that number. Any ideas? I'm sure it's easy.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ @Keegan - you will have to let us know which Freescale part you are using to give you an accurate answer. \$\endgroup\$
    – semaj
    Nov 30, 2010 at 17:14

3 Answers 3

5
\$\begingroup\$

Typically an asynchronous communication pin is sampled at 16 times the bit rate. This implies a baudrate generator of:

\$\frac{24000000}{16}\frac{1}{38400} = 39.0625 \$

Since the resulting integer value is 39, the resulting error is:

\$\frac{0.0625}{39.0625} = 0.0016 \$

or 0.16%

\$\endgroup\$
0
3
\$\begingroup\$

Here's a tool (for AVR) that demonstrates the calculations. It's all about integer divison of the baud rate and system clock.

http://www.wormfood.net/avrbaudcalc.php

\$\endgroup\$
2
\$\begingroup\$

I don't have the Freescale datasheet.

But 24MHz / 38400 baud is exactly 625 cycles per symbol.

I will guess that there is an unavoidable divide in the clock or baudrate generator, so the desired ratio is half of 625 or 312.5. The closest an integer counter can come is 312.

312 is 0.16% lower than 312.5

\$\endgroup\$
8
  • \$\begingroup\$ i also do not have the datasheet. i would bet markrages is spot on. \$\endgroup\$
    – Kortuk
    Nov 30, 2010 at 16:56
  • \$\begingroup\$ @markrages - Could you please explain why the desired ratio is half? \$\endgroup\$
    – semaj
    Nov 30, 2010 at 17:17
  • 1
    \$\begingroup\$ I'd guess that the divide by two is because the hardware is oversampling the RS232 bits \$\endgroup\$ Nov 30, 2010 at 17:23
  • 1
    \$\begingroup\$ @Joby, I don't believe this is correct. For an asynchronous port such as RS232, the hardware typically oversamples by a factor of 16x, not 2x. \$\endgroup\$
    – semaj
    Nov 30, 2010 at 17:27
  • 1
    \$\begingroup\$ @semaj 2^4=16 so assuming you don't divide to be less then 1 the percent error will work out the same. \$\endgroup\$
    – Kellenjb
    Nov 30, 2010 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.