Serial Ports

The WM2000 has two serial ports. In addition to their "standard use" as serial ports under the control of Tibbo BASIC/C code:

Serial debugging

Serial debugging is effected through lines RX1 and TX1 of serial port 1.

Serial debugging can be enabled and disabled through:

When serial debugging is enabled, Tibbo BASIC/C apps have no access to serial port 1 because TiOS will not allow setting ser.num to 1.

The three modes of the serial ports

Each UART can work in one of three modes: UART, Wiegand, or clock/data.

UART mode

UART mode supports full and half-duplex communications.

The full-duplex interface is typically used for RS232, RS422, full-duplex RS485, or "serial TTL" (CMOS) communications.

In UART full-duplex mode, each port has TX and RX lines, as well as RTS and CTS lines, which are optionally used for the flow control. When flow control is enabled, the WM2000 will control the RTS and CTS lines automatically.

The half-duplex interface is typically associated with half-duplex RS485 communications. In this mode, a serial port uses TX, RX, and RTS lines, the latter serving as the direction control line. Direction control is automatic and does not require any intervention from your Tibbo BASIC/C program.

TX and RX lines cannot be relocated. RTS and CTS lines can be reconfigured. For RTS, any unused GPIO line can be assigned to work as the RTS line of a serial port. For CTS, only interrupt lines 0 and 1 (GPIO lines 2 and 3) can be selected. Flexible remapping of RTS and CTS lines is facilitated by the I/O mapping properties offered by the ser. object.

DTR and DSR lines often found on RS232 ports are not controlled by the ser. object. It is the responsibility of your Tibbo BASIC/C application to take care of these lines. Therefore, you can choose which GPIO lines of the WM2000 will be used as DTR and DSR lines in your system.

The WM2000 supports all common UART modes — none/even/odd/mark/space parity and 7/8 bits per character — at the following baudrates: 110 / 300 / 600 / 1,200 / 2,400 / 4,800 / 9,600 / 19,200 / 38,400 / 57,600 / 115,200 / 230,400 / 460,800 / 921,600.

Wiegand mode

The Wiegand interface is often used in security products. A large number of magnetic card and RFID readers support this interface. The ser. object allows you to both send and receive data streams in the Wiegand format.

Wiegand requires only two interface lines — W0 and W1. Here is how these lines map to the "traditional" lines of a serial port:

TX

W1 output

RX

W1 input

RTS

W0 output

CTS

W0 & W1 input

As shown in the table, the CTS line is supposed to receive a "logical AND" of incoming W0 and W1 signals. This requires external circuitry — see Wiegand and Clock/Data Circuit Examples for details. No additional circuitry is required to output Wiegand data.

W1 output (on TX) and W1 input (on RX) cannot be remapped, while W0 output (on RTS) can be reassigned to any suitable GPIO line. W0&W1 input (on CTS) can be remapped, but possible choices are limited to interrupt lines 0 and 1 (GPIO 2 and 3).

Clock/data mode

The clock/data interface is also a very popular reader interface. The ser. object allows you to receive and send data streams in the clock/data format.

As the name implies, this interface requires two data lines — CLOCK and DATA. Here is how these lines map to the "traditional" lines of the serial port:

TX

DATA output

RX

DATA input

RTS

CLOCK output

CTS

CLOCK input

As in UART mode, DATA output (on TX) and DATA input (on RX) cannot be remapped, while CLOCK output (on RTS) can be reassigned to any suitable GPIO line. CLOCK input (on CTS) can be remapped, but possible choices are limited to interrupt lines 0 and 1 (GPIO 2 and 3).

No additional circuitry is required to handle clock/data streams.

For more information, see the documentation for the ser. object in the TIDE, TiOS, Tibbo BASIC, and Tibbo C Manual.