« Close

Datasheets and User Guides

App Notes

Software & Driver

 

13.7 Asynchronous Serial [T-Series Datasheet]

Overview

The T-Series devices have UART functionality available that supports normal logic level (CMOS/TTL) asynchronous (asynch) serial communication. The TX (transmit) and RX (receive) lines can appear on any digital I/O.  Baud rates up to 38400 are supported, but the T4/T7 processor is heavily loaded at that rate.  Number of data bits, number of stop bits, and parity are all controllable.

Asynchronous vs. RS-232:

The T4/T7's asynchronous support and the RS-232 standard are the same in terms of timing and protocol, but different in terms of electrical specifications.  Connection to an RS-232 device will require a converter chip such as the MAX233, which inverts the logic and shifts the voltage levels.  On the T4/T7, a low is 0 volts (inputs recognize 0.0 to 0.5) and a high (1) is 3.3 volts (inputs recognize 2.64 to 5.8 volts).  With RS-232, a low (0) is 3 to 25 volts and a high (1) is -3 to -25 volts; RS-232 has unique voltage levels and is inverted.

Lua Scripting:

Lua scripting is often convenient for serial applications.  For example, you might write a script that does the serial communication to get a new reading from the serial device once per second, and puts that reading in a USER_RAM register.  This puts the complications of serial communication in a script running on the T4/T7 itself, and then the host software can just do a simple read of the USER_RAM register when convenient.  We have many serial examples available for Lua scripting.

A direct connection to a serial device is preferable:

This serial link is not an alternative to the USB/Ethernet/WiFi connection. Rather, the host application will write/read data to/from the T4/T7 over USB/Ethernet/WiFi, and the T4/T7 communicates with some other device using the serial protocol. Using this serial protocol is considered an advanced topic. A good knowledge of the protocol is recommended, and a logic analyzer or oscilloscope might be needed for troubleshooting.

If it is practical to run a cable directly from the host computer to the serial device, that is usually a better than putting the T4/T7 in between.  Use a standard USB<=>RS-232 adapter/converter/dongle (or RS-485 or RS-422).

Register Listing

The following registers are relevant to performing asynchronous serial communication.

Asynchronous Serial
Name Start Address Type Access
ASYNCH_ENABLE 5400 UINT16 R/W
ASYNCH_BAUD 5420 UINT32 R/W
ASYNCH_RX_DIONUM 5405 UINT16 R/W
ASYNCH_TX_DIONUM 5410 UINT16 R/W
ASYNCH_NUM_DATA_BITS 5415 UINT16 R/W
ASYNCH_RX_BUFFER_SIZE_BYTES 5430 UINT16 R/W
ASYNCH_NUM_BYTES_RX 5435 UINT16 R
ASYNCH_NUM_BYTES_TX 5440 UINT16 R/W
ASYNCH_TX_GO 5450 UINT16 W
ASYNCH_NUM_STOP_BITS 5455 UINT16 R/W
ASYNCH_PARITY 5460 UINT16 R/W
ASYNCH_NUM_PARITY_ERRORS 5465 UINT16 R/W
ASYNCH_DATA_TX 5490 UINT16 W
ASYNCH_DATA_RX 5495 UINT16 R
ASYNCH_ENABLE
- Address: 5400
1 = Turn on Asynch. Configures timing hardware, DIO lines and allocates the receiving buffer.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_BAUD
- Address: 5420
The symbol rate that will be used for communication. 9600 is typical. Up to 38400 works, but heavily loads the T7's processor.
  • Data type: UINT32  (type index = 1)
  • Readable and writable
  • Default value: 0
ASYNCH_RX_DIONUM
- Address: 5405
The DIO line that will receive data. (RX)
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_TX_DIONUM
- Address: 5410
The DIO line that will transmit data. (TX)
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_NUM_DATA_BITS
- Address: 5415
The number of data bits per frame. 0-8, 0=8.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_RX_BUFFER_SIZE_BYTES
- Address: 5430
Number of bytes to use for the receiving buffer. Max is 2048. 0 = 200
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_NUM_BYTES_RX
- Address: 5435
The number of data bytes that have been received.
  • Data type: UINT16  (type index = 0)
  • Read-only
  • Default value: 0
ASYNCH_NUM_BYTES_TX
- Address: 5440
The number of bytes to be transmitted after writing to GO. Max is 256.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_TX_GO
- Address: 5450
Write a 1 to this register to initiate a transmission.
  • Data type: UINT16  (type index = 0)
  • Write-only
  • Default value: 0
ASYNCH_NUM_STOP_BITS
- Address: 5455
The number of stop bits. Values: 1 = one stop bit, 2 = two stop bits, 0 = one stop bit.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_PARITY
- Address: 5460
Parity setting: 0=none, 1=odd, 2=even.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_NUM_PARITY_ERRORS
- Address: 5465
The number of parity errors that have been detected. Cleared when UART is enabled. Can also be cleared by writing 0.
  • Data type: UINT16  (type index = 0)
  • Readable and writable
  • Default value: 0
ASYNCH_DATA_TX
- Address: 5490
Write data to be transmitted here. This register is a buffer.
  • Data type: UINT16  (type index = 0)
  • Write-only
  • Default value: 0
  • This register is a Buffer Register
ASYNCH_DATA_RX
- Address: 5495
Read received data from here. This register is a buffer. Underrun behavior - fill with zeros.
  • Data type: UINT16  (type index = 0)
  • Read-only
  • Default value: 0
  • This register is a Buffer Register

Examples

For performing asynchronous communication from a computer, see the LJM C examples or the LJM LabView examples.

For performing asynchronous communication on device, see the Lua scripting examples.