TS-7840 16550

From embeddedTS Manuals

The TS-7840 includes a National Semiconductor 16550A compatible register interface for accessing the FPGA based UARTs. These must be accessed a byte at a time. These use GPIO IRQs from bank0.

By default these UARTs have a crystal of 1.8432MHz. The max baud rate of a 16550 is the input frequency / 16. With the default 1.8432MHz clock this allows typical baud rates of 115200 to 300 baud. There is a command included in our BSP set_uart_baud which can set custom clocks. For example, to use 3MBaud on ttyS1:

root@tsa38x:~# set_uart_baud -p 0 --baud 3000000
port=0
requested_baud=3000000
actual_baud=3000000.000000
baud_ppm_error=823999

This was able to meet the 3M baud rate with minimal ppm error. In your application code, you would tell Linux to use 115200 baud. This will select a divide by 1 for the new clock rate and get 3000000 baud.

If you were to use an unusual baud rate this will print the closest actual_baud rate the clock is capable of reaching. Even if the actual_baud rate is different, as long as the difference between the two devices is < 10% they will typically still be able to communicate.

The 16550s already have existing drivers in our BSP, but the registers are accessible here:

PCIe BAR0 Offset UART IRQ GPIO
0x80 ttyS1 FPGA GPIO Bank 0 IO 0
0x88 ttyS2 FPGA GPIO Bank 0 IO 1
0x90 ttyS3 FPGA GPIO Bank 0 IO 2
0x98 ttyS4 FPGA GPIO Bank 0 IO 3
0xa0 ttyS5 FPGA GPIO Bank 0 IO 4
0xa8 ttyS6 FPGA GPIO Bank 0 IO 5
0xb0 ttyS7 FPGA GPIO Bank 0 IO 6
0xb8 ttyS8 FPGA GPIO Bank 0 IO 7
0xc0 ttyS9 FPGA GPIO Bank 0 IO 8