Thomas Dorris

IMX233 custom baud rates

Discussion created by Thomas Dorris on Jun 5, 2012
Latest reply on Oct 26, 2014 by chao li

For legacy purposes, I needed to be able to use the "old standard" way of specifying a custom baud rate in Linux.  And example follows.

 

// configure port to use custom speed instead of 38400
ioctl
(port, TIOCGSERIAL, &ss);
ss
.flags = (ss.flags & ~ASYNC_SPD_MASK) | ASYNC_SPD_CUST;
ss
.custom_divisor = (ss.baud_base + (speed / 2)) / speed;
ioctl(port, TIOCSSERIAL, &ss);

cfsetispeed
(&tios, B38400);
cfsetospeed
(&tios, B38400);

 

The IMX23 UART drivers do not support this, however.  So I modified the drivers accordingly and thought I'd post it up.  NOTE: Technically, the driver should also check that baud is set to 38400 in addition to checking the SPD_CUST flag.  But for our purposes, the CUST flag is a sufficient trigger.

 

This enables custom baud rates on both the application and the debug UARTs.

Outcomes