📄 usb-device-cdc-serial-project.html
字号:
<!DOCTYPE PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Atmel Corporation - USB to Serial Converter 1.4</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<h1>USB to Serial Converter Project 1.4</h1>
<div id="breadcrumb">
<a href="../index.html">Main</a> >
<a href="usb-framework.html">USB Framework</a> >
USB to Serial Converter
</div>
<h2>Purpose</h2>
<p>
This application demonstrates how to use the Communication Device Class (CDC)
to create a virtual COM port on a host computer. Such a device can be used as
a bridge between legacy applications still using RS-232 ports, and computer
without serial ports.
</p>
<div class="requirements">
<h2>Hardware Requirements</h2>
<p>
This package can be used with the following Atmel evaluation boards:
<ul>
<li>AT91SAM7S-EK (except AT91SAM7S32)</li>
<li>AT91SAM7X-EK</li>
<li>AT91SAM7SE-EK</li>
<li>AT91SAM9260-EK</li>
<li>AT91SAM9263-EK</li>
<li>AT91SAM9RL-EK</li>
<li>AT91SAM9XE-EK</li>
<li>AT91SAM9G20-EK</li>
</ul>
</p>
</div>
<h2>Description</h2>
<p>
When the evaluation board is plugged to the host with a USB cable, it enumerates
using the CDC class. The operating system may ask for a driver to install the
device.
</p>
<p>
After the device is installed, a new serial port should become available. The data
sent through this port is echoed on the USART of the device; Conversely, data
received on the USART is forward to the USB host.
</p>
<p>
Here is a snapshot of the traces output by the application over the DBGU when
it is working properly:
<blockquote>
<code>
-- CDC serial driver example --<br />
CDCDSerialDriver_Initialize<br />
USBD_Init<br />
Conn Conn Hlr Res<br />
Hlr Res<br />
Hlr EoBRes CfgEpt0<br />
Hlr Susp<br />
Hlr Res<br />
Hlr EoBRes CfgEpt0<br />
Hlr Ept0 Stp NewReq Std gDesc Dev Write0(18)<br />
...<br />
Hlr EoBRes CfgEpt0<br />
Hlr Ept0 Stp NewReq Std sAddr Write0(0)<br />
Hlr Ept0 Wr 0 EoT SetAddr(1)<br />
Hlr Ept0 Stp NewReq Std gDesc Dev Write0(18)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Cfg Write0(9)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Cfg Write0(67)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Qua Stall0<br />
Hlr Ept0 Sta<br />
Hlr Ept0 Stp NewReq Std gDesc Str0 Write0(4)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Str1 Write0(28)<br />
...<br />
Hlr Ept0 Wr 4 EoT<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Str0 Write0(4)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Str1 Write0(28)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Dev Write0(18)<br />
...<br />
Hlr Ept0 Stp NewReq Std gDesc Cfg Write0(67)<br />
...<br />
Hlr Ept0 Stp NewReq Std sCfg SetCfg(1) CfgEpt3 CfgEpt1 CfgEpt2 Write0(0)
Read1(4Hlr Ept0 Wr 0 EoT ConfigurationChanged<br />
0) Hlr Ept0 Stp NewReq gLineCoding Write0(7)<br />
...<br />
Hlr Ept0 Stp NewReq sControlLineState(0, 0) Write0(0)<br />
</code>
</blockquote>
</p>
<p class="warning">
WARNING: on the SAM7X/XC evaluation kit, the project only works in internal flash.
</p>
<h2>Usage</h2>
<ol>
<li>
Build the application and download it inside the evaluation board. Please refer
to the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6132.pdf">SAM-BA User Guide</a>,
the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6310.pdf">GNU-Based Software Development</a>
application note or to the <a href="http://www.iar.se/website1/1.0.1.0/78/1/index.php?">IAR EWARM User Guide</a>,
depending on your chosen solution.
</li>
<li>
On the computer, open the DBGU port with a terminal application
(e.g. HyperTerminal on Microsoft Windows).
</li>
<ul>
<li>Settings: 115200 bauds, 8 bits, 1 stop bit, no parity, no flow control.</li>
</ul>
<li>
Start the application.
</li>
<li>In the terminal window, the following text should appear:</li>
<blockquote>
<code>
-- USB Device CDC Serial Project 1.4 --
</code>
</blockquote>
<li>
Connect the USB cable to the board. Traces should start to
appear on the terminal. Eventually, the operating system
will report that a 'AT91USBSerial' device has been detected,
and may ask for its driver.
<br /><img src="img/hardwarefound.png" />
<br /><img src="img/hardwarewizard.png" />
</li>
<li>
If the host is running Microsoft Windows, the <strong>6119.inf</strong> file
must be provided during the installation of the device. It is located in the
"/at91lib/usb/device/cdc-serial/drv" directory.
</li>
<li>
Once the device is properly configured, a new serial port should be appear
on the host computer.
</li>
<li>
Disconnect the serial cable from the DBGU port of the board, and connect it
to the USART port.
</li>
<li>
Open the virtual COM port in any terminal application. Data entered in the
virtual COM port terminal should appear on the USART terminal, and vice-versa.
</li>
<ul>
<li>Settings: 115200 bauds, 8 bits, 1 stop bit, no parity, no flow control.</li>
</ul>
</ol>
<h6>Atmel Corporation ©2008</h6>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -