Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uart 16c950 linux speed above B4000000 (4Mbps)

everybody, i'm working with a high speed RS422 pci board (OXPCIe958) under Ubuntu. The device can work up to 15Mbps. I need to work at 10Mbps, but i notice that under Linux, if we use termois, the maximum speed that can be specified is B4000000 (4 Mbps).

Is there any way to specify custom baund rate in linux?? I tried to change the values in termois.h:

#define  B1152000 0010011
#define  B1500000 0010012
#define  B2000000 0010013
#define  B2500000 0010014
#define  B3000000 0010015
#define  B3500000 0010016
#define  B4000000 0010017 --> by default this is the last value

#define  B4500000 0010018   --> Added
#define  B5000000 0010020   --> Added
//#define __MAX_BAUD B4000000 --> Default value
#define __MAX_BAUD B10000000

But changes doesn't work. I cannot understand the meaning of the value assigned to BXXXXXX!!

The device works natively on linux and no driver must be specified. Looking into the device's datasheet, i saw that to specify the target baund rate, we must set some registers that change the prescaler, the latch divisor and the sample clock.

According to the data sheet, tha baund rate is given by:

Baundrate = inputclok/(sampleClock*divisor*prescaler)

Is there a way to set this registers under linux? the driver are in 8250.c and 8250_pci.c

Thanks in advance

like image 366
fdaniii Avatar asked Jun 26 '13 13:06

fdaniii


1 Answers

This page has a Linux kernel patch that adds direct exposure of the registers, so that ioctl() can be used to program custom baud rates. It's pretty old though, but might be useful for you.

like image 171
unwind Avatar answered Nov 12 '22 05:11

unwind