setting custom baud rate on UART for MPC52xx.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

setting custom baud rate on UART for MPC52xx.

1,995 Views
Gopal
Contributor I
Hi,
I tried to set baud rate 5 bits/s as it needed by my application.
code snippet as below.

baudrate=5;

ret=ioctl(rfd, TIOCGSERIAL, &serial_info);

if(ret!=0)

{

perror("custom baud rate get");

}

serial_info.flags &= ~ASYNC_SPD_MASK;

serial_info.flags |= ASYNC_SPD_CUST;

serial_info.custom_divisor=serial_info.baud_base / baudrate;

ret=ioctl(fd, TIOCSSERIAL,serial_info);

if(ret!=0)

{

perror("custom baud rate set:");

}

for this I am getting "custom baud rate set: invalid argument" error in run time.

for standard baud rates it working well.

am I doing any thing wrong while accessing tty device?

does 8250 driver for mpc52xx really support custom baudrates?

and particulerly low baud rates like 5 bits/sec and 10.4 kbps.

0 Kudos
1 Reply

638 Views
Ewald
Contributor I
Hi,

we don't use linux. The folling decribes only the possibilities of the processor.
The MPC5200 PSCs cannot generate 5 baud/s, when the system runs with 400MHz.
(This can be easly tested by the MPC5200 graphical config tool from freescale)
10,4 kbaud/s is possible.
The 5 baud/s can be generated by digital I/O, because one
bit is very long 200ms. (The PSC pins must be configured as digital I/O pins)

I believe you application is a K-Line automotive application. In this case
somtimes it is possible to use the fast initialisation instead of 5 baud initialisation.
Fast init is a puls with 25ms low and 25ms high.
This can be generated by a baudrate of 200 baud/s, which is possible for the MPC5200.
Each bit is 5ms, the data byte must contain 0xF0. The four low bits and the start bit
will build the 25ms low puls. If you are interest in K-Line or other automotive tools visit
samtec.de.

Ewald.
0 Kudos