<!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>
>I'm trying to set a custom baud rate (500KBaud, in case anyone cares) on<BR>
>one of the PSCs on a MPC5200 board.<BR>
[snip]<BR>
> serial_info.flags = ASYNC_SPD_CUST | ASYNC_LOW_LATENCY;<BR>
> serial_info.custom_divisor = 48; // clock on FTDI chip / 48 == 500KB<BR>
><BR>
> if ( ioctl(tty_fd, TIOCSSERIAL, &serial_info ) < 0) {<BR>
> perror("config_serial_port: ioctl TIOCSSERIAL");<BR>
> return(-1);<BR>
> }<BR>
><BR>
>This compiled fine under the ppc cross-dev tools we have but it fails with<BR>
>an "invalid argument" error when run on the ppc board.<BR>
<BR>
It looks like this code was written for an FTDI serial port. 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. 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. 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. I'm talking with our BSP vendor about this.<BR>
<BR>
best regards,<BR>
<BR>
Nick Caruso<BR>
</FONT>
</P>
</BODY>
</HTML>