2024年4月29日发(作者:)
2011 IEEE Symposium on Computers & Informatics
FPGA Implementation of RS232 to Universal
serial bus converter
, (PhD)
2
Rama
Valupadasu
(Ph
D), ,
3
.o
Chunduri, PhD,
Assoc. Professor. VCEW sor, NIT, Warangal Professor, NIT, Warangal
vsrtej@
agnivesh91@ cbrr@
4. 5.
i Rekha, , vi, ,
sor Assoc. Professor. VCEW
LUC, Mantin, Malaysia vaagvijs_15@
madakranthirekha@
Abstract—
Universal Serial Bus (USB) is a new personal computer
interconnection protocol, developed to make the connection of peripheral
devices to a computer easier and more efficient. It reduces the cost for the
end user, improves communication speed and supports simultaneous
attachment of multiple devices (up to127)RS232, in another hand, was
designed to single device connection, but is one of the most used
communication protocols. An embedded converter from RS232 to USB
is very interesting, since it would allow serial-based devices to
experience USB advantages without major changes. This work describes
the specification and development of such converter and it is also a useful
guide for implementing other USB devices. The main blocks in the
implementation are USB device, UART (RS232 protocol engine) and
interface FIFO logic. The USB device block has to know how to detect
and respond to events at a USB port and it has to provide a way for the
device to store data to be sent and retrieve data that have been received
UART consists of different blocks which handle the serial
communication through RS232 protocol. There are a set of control
registers to control the data transfer. The interface FIFO logic has FIFO
to bridge the data rate differences between USB and RS232 protocols.
1
USB is a new personal computer interconnection standard
developed by industry and telecommunication leaders,
which implements the Plug and Play technology. It allows
multiple devices connection (up to 127) ranges. The use of a the
devices attachment to PCs. USB is a low cost, easing solution
and supports transfer rates up to 12Mbs, comprehending the low-
speed and mid-speed data converter from a serial interface to
USB would free a serial communication port to other
applications, allowing a device that uses a serial interface to
communicate using an USB interface. USB on the other hand is a
bus system which allows more than one peripheral to be
connected to a host computer via one USB port. Hubs can be
used in the USB chain to extend the cable length and allow for
even more devices to connect to the same USB port. The
standard not only describes the physical properties of the
interface, but also the protocols to be used. Because of the
complex USB protocol requirements, communication with USB
ports on a computer is always performed via a device driver. This
way, we are not limited to the availability of a serial port and we
can experience the USB advantages. Using a converter allows us
to have the device unchanged, making the converter responsible
for treating the differences between the protocols. This work was
based on protocol engine which can be managed by exchanging
data with a PC across a serial interface. Most of the times, this
communication is not done constantly, since it is necessary to
have a serial port available just for it. This paper presents the
converter implementation, focusing on the development process,
which comprehends the device itself and the PC-side software
that will communicate with it. This methodology can be extended
to other devices. We first present some important USB standard
concepts. Then, we define the system specification, divided on
host and device requirements. After, we describe the hardware
(UART) features and software design and implementation.
Finally, we discuss about achieved results and future work
II.
Index Terms—
First-In-First-Out, RS-232, Universal
Asynchronous Receive Transmit, Universal Serial Bus.
I. INTRODUCTION
This paper describes the specification and implementation of a
converter from RS232 to USB (Universal Serial Bus). This
converter is responsible for receiving data from a peripheral
device’s serial interface and sending it to a computer’s USB
interface. In the same way, it must be able to send data from the
PC’s USB interface to the
device. The problems faced with
the old standards stimulated the development of a new
communication protocol, which should be easier to use,
faster, and more efficient. RS232 is a definition for serial
communication on a 1:1 base. RS232 defines the interface
layer, but not the application layer. To use RS232 in a
specific situation, application specific software must be
written on devices on both ends of the connecting RS232
cable. RS232 ports can be either accessed directly by an
application, or via a device driver in the operating system.
PROBLEM DESCRIPTION
The USB specification describes bus attributes, protocol
definition, programming interface and other features required to
design and build systems and peripherals compliant with the
USB standard. We briefly explain features used in our project.
978-1-61284-691-0/11/$26.00 ©2011 IEEE237
The USB interface does not give this flexibility. When however
an RS232 port is used via an USB to RS232 converter, this
flexibility should be
present in some way. Therefore to use an
RS232 port via an USB port, a second device driver is
necessary
which emulates a RS232 UART, but communicates via USB.
the firmware must also contain a report descriptor that defines
the format for transmitted and received device data.
A. Requests
USB works as a Master/Slave bus, where the USB Host is the
Master and the devices are the Slaves. The only system resources
required by a USB system are the memory locations used by
USB system software and the memory and/or I/O address space
and IRQ line used by the USB host controller. USB devices can
be functional (displays, mice, etc) or hubs, used to connect other
devices in the bus. They can be implemented as low or high-
speed devices. Low-speed devices are limited to a maximum 1.5
Mb/s rate. Each device has a number of individual registers -
known as Endpoints which are indirectly accessed by the device
drivers for data exchange. Each endpoint supports particular
transfer characteristic has a unique address and direction. A
special case is Endpoint 0, which is used for control operations
and can do bi-directional transfers. It must be present in all
devices. According to the device’s characteristics, other types of
endpoints can be defined. USB Host verifies the attachment and
detachment of new devices, initiating the enumeration process
and managing all the following transactions. It is responsible to
install device driver (based on information provided by device
descriptors), to automatically reconfigure the system (hot
attachment) and to collect statistics and status of each device.
USB on the other hand is a bus system which allows more than
one peripheral to be connected to a host computer via one USB
port. Hubs can be used in the USB chain to extend the cable
length and allow for even more devices to connect to the same
USB port. The standard not only describes the physical
properties of the interface, but also the protocols to be used.
Because of the complex USB protocol requirements,
communication with USB ports on a computer is always
performed via a device driver. Device’s descriptors specify USB
devices attributes and characteristics and describe device
communication requirements (Endpoint Descriptors). The USB
host uses this information to configure the device, to find its
driver, and to access it. Devices with similar functions are
grouped into classes [1, 2] in order to share common features and
even use the same device drivers. Each class can define their own
descriptors (class-specific descriptors), as for example, HID
(Human Interface Device) Class Descriptors and Report
Descriptors. The HID class consists of devices used by people to
control computer systems. It defines a structure that describes a
HID device, with specific communication requirements.
According to the converter characteristics, it can be implemented
as a HID device, using already developed HID drivers. A HID
device’s descriptors must support an Interrupt IN endpoint and
The USB protocol is based on requests sent by the host
and processed by the USB devices. These requests can be
directed to a device or a specific endpoint in it. Standard requests
must be implemented by all devices and are used for configuring
a device and controlling the state of its USB interface, among
other features. Two HID-specific requests must be supported by
the converter: Set Report and Get Report. These requests enable
the device to receive and send generic device information to the
host. Set Report request is the only way the host can send data to
a HID device, once it does not have an Interrupt OUT endpoint
B. Communication Flow
USB is a shared bus and many devices might use it at the same
time. The devices share the bandwidth using a protocol based on
tokens and commanded by the host. USB communication is
based on transferring data at regular intervals called frames. A
frame is composed by one or more transactions that must be
executed in a 1 ms time. USB data transfers are typically
originated by a USB Device Driver when it needs to
communicate with its device. It supplies a memory buffer used to
store the data in transfers to or from the USB device. The USB
Driver provides the interface between USB Device Driver and
USB Host Controller, translating transfer requests into USB
transactions, consistent with the bandwidth requirements and
protocol structure. Some of these transfers consist of a large
block of data, which need to be splitted into several transactions.
The Host Controller generates the transaction based on the
Transfer Descriptor, which describes the frame sharing among
the several devices requests. When a transaction is sent to the
bus, all devices see it. Each transaction begins with a packet that
determines its type and the endpoint address. The USB driver
controls this addressing scheme. Inside the device, the USB
Device Layer comprehends the actual USB communication
mechanism and transfer characteristics. USB Logical Device
implements a collection of endpoints that comprise a given
functional interface, which can be manipulated by its respective
USB client.
C. Transfer Types
The USB specification defines four transfer types: Control,
Interrupt, Isochronous and Bulk. Control transfers send requests
and data relating to the device’s abilities and configuration. They
can also be used to transfer blocks of information for any other
purpose. Control transfers consist of a Setup stage, followed by a
Data stage, which is composed of one or more Data transactions,
and a Status stage. All data transactions in a Data Stage must be
in the same direction (In or out). Interrupt transfers are typically
used for devices that need to transfer data at regular period of
time, and consequently must be polled periodically. The polling
interval is defined in the Endpoint Descriptor. The data payload
238
发布评论