<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>RE: How to set a custom baud rate using 2.6 linux distro on MPC5200 based board?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>-----Original Message-----<BR>
From: linuxppc-embedded-bounces@ozlabs.org on behalf of Eric N. Johnson (ACD)<BR>
Sent: Tue 2/15/2005 6:55 PM<BR>
To: linuxppc-embedded@ozlabs.org<BR>
Subject: Re: How to set a custom baud rate using 2.6 linux distro on MPC5200 based board?<BR>
<BR>
<BR>
&gt;I'm trying to set a custom baud rate (500KBaud, in case anyone cares) on<BR>
&gt;one of the PSCs on a MPC5200 board.<BR>
[snip]<BR>
&gt;&nbsp;&nbsp; serial_info.flags = ASYNC_SPD_CUST | ASYNC_LOW_LATENCY;<BR>
&gt;&nbsp;&nbsp;&nbsp; serial_info.custom_divisor = 48;&nbsp; // clock on FTDI chip / 48 == 500KB<BR>
&gt;<BR>
&gt;&nbsp;&nbsp;&nbsp; if ( ioctl(tty_fd, TIOCSSERIAL, &amp;serial_info ) &lt; 0) {<BR>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; perror(&quot;config_serial_port: ioctl TIOCSSERIAL&quot;);<BR>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return(-1);<BR>
&gt;&nbsp;&nbsp;&nbsp; }<BR>
&gt;<BR>
&gt;This compiled fine under the ppc cross-dev tools we have but it fails with<BR>
&gt;an &quot;invalid argument&quot; error when run on the ppc board.<BR>
<BR>
It looks like this code was written for an FTDI serial port.&nbsp; The FTDI is a<BR>
USB to Serial converter that handles baud rate generation very differently<BR>
from a standard UART.<BR>
_______________________________________________<BR>
<BR>
Yes, it was originally written for a USB-to-serial adapter.&nbsp; However it is my belief that the clock divisor thing works with any serial device, including so-called 16550 devices.<BR>
<BR>
I think there may be a problem where TIOCSSERIAL doesn't work for the MPC5200 PSC uart code.&nbsp; It seems that if I get the ports' attributes with TIOCGSERIAL and immediately set the same values on the same port I get an error return from the ioctl call.&nbsp; I'm talking with our BSP vendor about this.<BR>
<BR>
&nbsp;&nbsp;&nbsp; best regards,<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nick Caruso<BR>
</FONT>
</P>

</BODY>
</HTML>