TS-4900 COM Ports: Difference between revisions

From embeddedTS Manuals
No edit summary
(Fixups)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
This board uses UARTs from both the CPU and the FPGA.  The CPU uart 0 (/dev/ttymxc0) is dedicated to console for Linux and U-boot and not suggested to be reused.  The other CPU UARTs for ttymxc1-4 are usable for end applications.  These support up to 5Mb/s UART data with DMA.
This board uses UARTs from both the CPU and the FPGA.  The CPU UART 0 (/dev/ttymxc0) is a dedicated console for Linux and U-Boot and not suggested to be reused.  The other CPU UARTs for ttymxc1 through ttymxc4 are usable for end applications.  These support up to 5Mb/s UART data with DMA.


The FPGA also emulates a MAX3100 UART interface accessible at /dev/ttyMAX0-2.  These UARTs support a total throughput of about 115200<ref>Idle periods do not count towards the total throughput limitation., but they include hardware that makes implementing RS-485 half duplex software very simple.  If higher throughput is needed, the [[#FPGA_Crossbar|FPGA crossbar]] can be adjusted to use a CPU UART with TXEN support instead.
The FPGA also emulates a MAX3100 UART interface accessible at /dev/ttyMAX0-2.  These UARTs support a total throughput of about 115200<ref>Idle periods do not count towards the total throughput limitation.</ref>.  These UARTs include hardware that makes implementing RS-485 half duplex software extremely simple.  If higher throughput is needed, the [[#FPGA_Crossbar|FPGA crossbar]] can be adjusted to use a CPU UART with TXEN support instead.


{{Note|Our SPI interface matches the max3100 almost entirely, except optionally a single 8-bit transaction can be sent to act as a chip select between the three uarts supported on our interface.  The default FPGA supports 3 UARTs on this interface.  This is handled automatically by our driver (max3100-ts).}}
{{Note|Our SPI interface matches the max3100 almost entirely, except optionally a single 8-bit transaction can be sent to act as a chip select between the three uarts supported on our interface.  The default FPGA supports 3 UARTs on this interface.  This is handled automatically by our driver (max3100-ts).}}


RS-485 half duplex's direction control is built into the ttyMAX UARTs.  By default they are connected to the RS-485 ports and no code is required for the transmit enable to toggle.  The CPU UARTs however do not have transmit enable built in.  The FPGA however includes a core that will toggle transmit enable for ttymxc1/ttymxc3, but it needs to know the baud rate, and symbol size (data bits, parity, stop bits).
The RS-485 half duplex direction control is built into the ttyMAX UARTs.  By default, they are connected to the RS-485 ports and no code is required for the transmit enable to toggle.  The CPU UARTs however do not have transmit enable built in.  The FPGA provides support for transmit enable on ttymxc1/ttymxc3, but additional setup steps are required so the FPGA can properly time the transmit enable output. The FPGA needs to know the baud rate, and symbol size (data bits, parity, stop bits) that the UART will be run at


For example:
For example:
<source lang=bash>
<source lang=bash>
# Configure mxc1 and mxc3 as 115200, 8n1
# Configure ttymxc1 and ttymxc3 as 115200, 8n1


stty -F /dev/ttymxc1 115200 cs8 -cstopb
stty -F /dev/ttymxc1 115200 cs8 -cstopb
Line 18: Line 18:
</source>
</source>


The tshwctl tool will read the UART settings from the moment when it is run and it sets up the FPGA's timing for TXEN.  Your baud rate and mode settings should be set before running this.
The 'tshwctl' tool will read the UART settings and set up the FPGA timing for TXEN automaticallyThe baud rate and mode settings must be set before running the 'tshwctl' command!


Using the FPGA for either the ttyMAX uarts, or the CPU uarts, the TXEN timing will happen well under a single bit time <ref>This is a requirement for half duplex MODBUS</ref> of any baud rate possible by the hardware.
When using the FPGA for either the ttyMAX UARTs or the CPU UARTs, the TXEN timing will happen well under a single bit time <ref>This is a requirement for half duplex MODBUS</ref> of any baud rate possible by the hardware.


{{:Standard UART Examples}}
{{:Standard UART Examples}}


<References />
<References />

Latest revision as of 18:02, 28 September 2018

This board uses UARTs from both the CPU and the FPGA. The CPU UART 0 (/dev/ttymxc0) is a dedicated console for Linux and U-Boot and not suggested to be reused. The other CPU UARTs for ttymxc1 through ttymxc4 are usable for end applications. These support up to 5Mb/s UART data with DMA.

The FPGA also emulates a MAX3100 UART interface accessible at /dev/ttyMAX0-2. These UARTs support a total throughput of about 115200[1]. These UARTs include hardware that makes implementing RS-485 half duplex software extremely simple. If higher throughput is needed, the FPGA crossbar can be adjusted to use a CPU UART with TXEN support instead.

Note: Our SPI interface matches the max3100 almost entirely, except optionally a single 8-bit transaction can be sent to act as a chip select between the three uarts supported on our interface. The default FPGA supports 3 UARTs on this interface. This is handled automatically by our driver (max3100-ts).

The RS-485 half duplex direction control is built into the ttyMAX UARTs. By default, they are connected to the RS-485 ports and no code is required for the transmit enable to toggle. The CPU UARTs however do not have transmit enable built in. The FPGA provides support for transmit enable on ttymxc1/ttymxc3, but additional setup steps are required so the FPGA can properly time the transmit enable output. The FPGA needs to know the baud rate, and symbol size (data bits, parity, stop bits) that the UART will be run at

For example:

# Configure ttymxc1 and ttymxc3 as 115200, 8n1

stty -F /dev/ttymxc1 115200 cs8 -cstopb
tshwctl --autotxen 1

stty -F /dev/ttymxc3 115200 cs8 -cstopb
tshwctl --autotxen 3

The 'tshwctl' tool will read the UART settings and set up the FPGA timing for TXEN automatically. The baud rate and mode settings must be set before running the 'tshwctl' command!

When using the FPGA for either the ttyMAX UARTs or the CPU UARTs, the TXEN timing will happen well under a single bit time [2] of any baud rate possible by the hardware.

All of these UARTs are accessed using the standard /dev/ interfaces. See these resources for information on programming with UARTs in Linux.

  1. Idle periods do not count towards the total throughput limitation.
  2. This is a requirement for half duplex MODBUS