EmbeddedRelated.com
Forums

SCI baud rate.

Started by mohan kumar October 17, 2003
Hi,

I have been using SCI0 of MC9S12dp256 and communicating with the com1 of PC through Hyperterminal. It seems to work fine (Able receive and transmit ) upto to baud rate 38400. But if I try to configure to 57600 or 115K communication is not working.

The Bus clock is 8Mhz (16MHZ crystal)

I whould like to know whether the DP256 SCI supports baud rate of 115K. if so what should be taken care of.

Thanks and Regards,
mohanss ---------------------------------



Hi,

The problem that you have is that the 16Mhz crystal can't set correct baud
rate divisor for 57k6 and 115k2 (divisor rounded to nearest integer).
The bit lenght gets to long (or short) and a bit is not recognized (I
think the bit tolerance is about 4.5% for RS232-D).

Try instead a 14.7456 MHz crystal which covers a lot of baud rates
(including 57k6 and 115k2). OK you get a longer intruction time but the
differens to 16 MHz isn't that big....

/Joacim Joacim Zetterling R&D System Engineer
Westermo Teleindustri AB
S-640 40 St. Sundby
SWEDEN

Phone int +46-(0)16428000
Fax: int +46-(0)16428001

E-mail:
Internet: http://www.westermo.com


Mohanss,

I'm not an expert, but here's my two pence worth at contributing to the HC68H12 group!

The baud rate is generated from the bus clock by using a divider register SCIxDRH/SCIxDRL. There is a table on page
25 of the document S12CVI2.pdf (HC12 Serial Communications Interface) which shows how the value in this register pair gets smaller for higher Baud rates. You will notice too that the accuracy decreases and this table is for a 25MHz bus.

In your case, 8MHz bus, the value I calculate for the register is 8.68 for 57600 Baud. This has to be rounded up to 9 which may not be providing an accurate enough clock to drive your serial port. Matters get worse when you go up to 115K Baud.

If you have a PLL on your board, you could increase the bus speed, thereby increasing the values in the register which will make the Baud rate more accurate.

Regards,

Michael.

> Sent: Friday, October 17, 2003 12:52 PM
> Subject: [68HC12] SCI baud rate.

> Hi,

> I have been using SCI0 of MC9S12dp256 and communicating with the com1 of PC through Hyperterminal. It seems to work
> fine (Able receive and transmit ) upto to baud rate 38400. But if I try to configure to 57600 or 115K communication is > not working.

> The Bus clock is 8Mhz (16MHZ crystal)

> I whould like to know whether the DP256 SCI supports baud rate of 115K. if so what should be taken care of.

> Thanks and Regards,
> mohanss



With your 16 MHz crystal, & an 8 MHz bus speed, you can use the on-chip
PLL to increase the bus speed to 24 MHz where you can obtain a baud rate
of 115200. A value of 13 (24000000/115200/16) written to the baud rate
register will provide a baud rate of 115200. Make sure you have the
proper XFC components installed before using the PLL.

Regards,
Gordon

mohan kumar wrote:

>Hi,
>
>I have been using SCI0 of MC9S12dp256 and communicating with the com1 of PC through Hyperterminal. It seems to work fine (Able receive and transmit ) upto to baud rate 38400. But if I try to configure to 57600 or 115K communication is not working.
>
>The Bus clock is 8Mhz (16MHZ crystal)
>
>I whould like to know whether the DP256 SCI supports baud rate of 115K. if so what should be taken care of.
>
>Thanks and Regards,
>mohanss >--------------------------------- >
>
>-------------------- >
>">http://docs.yahoo.com/info/terms/ >

--
===============================================================
Gordon Doughman Ph: 937-438-6811
Motorola Semiconductor Fax: 937-434-7457
Field Applications Engineer Pager: 800-759-8352 Pin: 1304089
Suite 175
3131 Newmark Drive
Miamisburg, OH 45342

Check out my HC12 book at:
http://www.rtcbooks.com/programming.php