6

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

Robert H
  • 10,659
  • 17
  • 63
  • 102
fdaniii
  • 95
  • 5
  • It is possible to set a non-standard baudrate, see [this answer](http://stackoverflow.com/a/7152671/1340631) – scai Jun 26 '13 at 13:56
  • This method returns back that a maximum baund rate is 4000000... it seems that doesn't work! – fdaniii Jun 27 '13 at 13:09

1 Answers1

6

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.

Sjoerd
  • 68,958
  • 15
  • 118
  • 167
unwind
  • 364,555
  • 61
  • 449
  • 578
  • I modified the patch adding the access to the whole set of registers. Thanks – fdaniii Jul 09 '13 at 16:09
  • I noted that if i send a data streaming to the board at 12.5Mbps only the firsts 170-200 bytes can be received without errors! if i divide the data streaming in blocks with a delay between them (delay of about 40ms, corresponding to about 4Mbps) the whole set of data can be received without errors! It seems that there is a linux limit to 4Mbps. It is correct? – fdaniii Jul 17 '13 at 15:40
  • @fdaniii I don't think there's such an official limit, no. But remember that Linux is not a real-time operating system, so if your application needs constant access to the CPU in order to service high rates of incoming data, there might be problems. I'd check the size of the UART buffers, if you can increase them to hold more data and then still manage to "catch up" when you have the CPU you might be able to sustain the transfer. – unwind Nov 29 '16 at 08:49