Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 15


 8  
3 
!"

.!6


If you have an existing design that uses RS-232, an FT232R chip can quickly
convert the design to USB. Figure 15-5 shows a circuit that uses RS-232 along
with the same circuit converted to use USB.
In the RS-232 circuit, microcontroller pins connect to a MAX237 interface
chip that converts between TTL and RS-232 logic levels. The example circuit
includes the asynchronous serial interface (TX and RX) plus six generic I/O
pins to support RS-232’s status and control signals. A circuit that doesn’t use all
of the status and control signals requires fewer drivers and receivers. The sche-
matic doesn’t show the MAX237’s capacitors or power and ground connections.
In the USB circuit, the microcontroller port pins connect to the corresponding
pins on an FT232R USB UART. Instead of an RS-232 connector, the circuit
has a USB connector that interfaces to the FT232R. The pins for any unimple-
mented signals can remain open on the FT232R or can be tied to a desired
state.
In most cases, a circuit modified in this way requires no changes to device firm-
ware or applications that communicate with the device. Compared to a an
internal RS-232 port, a USB virtual COM port can have these differences at
the host:


  • Longer delays when reading or writing to RS-232 status and control signals.

  • Longer delays when changing the parity type (such as in 9-bit networking).
    In addition, data throughput at the receiving application can be slow in these
    situations:

  • Receiving less than 62 data bytes. The device prefers sending data packets of
    wMaxPacketSize with each packet consisting of 62 data byes plus two status
    bytes. A device that has less than 62 data bytes to send will wait for one of
    the following events to be true: the chip has accumulated 62 bytes to send,
    or the chip’s internal latency timer has timed out. The default latency time is
    16 ms.

  • Receiving large blocks of data at bit rates of 38.75 kbps or higher. When the
    device continuously provides data packets of wMaxPacketSize, the driver
    holds the received data and passes it to the application when one of the fol-
    lowing is true: the driver has received 4096 bytes, or the latency timer has
    timed out. At fast bit rates, the result can be delayed data at the application.

Free download pdf