MCP2221
USB 2.0 to I
2
C/UART Protocol Converter with GPIO
Features
Universal Serial Bus (USB)
• Supports Full-Speed USB (12 Mb/s)
• Implements USB Protocol Composite Device:
- Communication Device Class (CDC) for
USB-to-UART Conversion
- Human Interface Device (HID) for I
2
C Device
Control and Configuration
• 128-Byte Buffer to Handle Data Throughput at
Any Supported UART Baud Rate:
- 64-Byte Transmit
- 64-Byte Receive
• Human Interface Device (HID) for Both
I
2
C Communication and Control:
64-Byte Buffer to Handle Data Throughput at
Any I
2
C Baud Rate
• Fully-Configurable VID and PID Assignments and
String Descriptors
• Bus-Powered or Self-Powered
• USB 2.0-Compliant: TID# 40001594
I
2
C/SMBus
• The Device Runs as an I
2
C Master. The Data to
Write/Read on the I
2
C Bus is Conveyed by the
USB Interface
• I
2
C Master
- Up to 400 kHz Clock Rate
- Supports 7-Bit or 10-Bit Addressable
Devices; 10-Bit Addressable Devices are
Supported through the PC Host Library
- Supports Block Reads/Writes of up to 65,535
Bytes
• SMBus Master
- Supports All of the SMBus Transfers
- SMBus Functionality Is Achieved through a
Combination of Chip and Support Library
Processing
- Up to 400 kHz Clock Rate
General-Purpose Input/Output (GPIO) Pins
• Four General-Purpose Input/Output Pins
• All GP Pins Can Be Assigned to Other
Functionalities
USB Driver and Software Support
• Enumerates as a Composite USB Device (CDC
and HID) Using Standard Drivers for Virtual Com
Port (VCP) on the Following Windows
®
Operating
Systems: XP
®
(SP3), Vista
®
, 7, 8 and 8.1
• Configuration Utility for Establishing a Custom
Boot-Up Configuration
• I
2
C/SMBus Terminal
• Windows DLL
Other Functionalities
• UART Activity LED Outputs (UT
X
and UR
X
)
• SSPND Output Pin
• USBCFG Output Pin (Indicates When the
Enumeration Has Completed)
• Three ADC Inputs
• One DAC with Two Possible Output Options
• Clock Reference Output: 12 MHz or Other
Configurable Values
• External Interrupt Edge Detection
CDC and Universal Asynchronous
Receiver/Transmitter (UART) Options
• Communications Device Class (CDC) for the
USB-to-UART Option
• Responds to
SET LINE CODING
Commands to
Dynamically Change Baud Rates
• Supports Baud Rates: 300-115200
• UART T
X
and R
X
Pins Only
• Serial Number Used During the CDC
Enumeration Can Be Enabled by Using the
Microchip-Provided Configuration Utility or by
Calling the Proper API from the Support Libraries
for this Device
Other
• Operating Voltage: 3.0 to 5.5V
• Electrostatic Discharge (ESD) Protection: > 4 kV
Human Body Model (HBM)
• Industrial (I) Operating Temperature: –40°C to
+85°C
• Automotive AEC-Q100 Qualified
2014-2017 Microchip Technology Inc.
DS20005292C-page 1
MCP2221
Package Types
MCP2221
PDIP/SOIC/TSSOP
V
DD
MCP2221
4 x 4 QFN*
NC
NC
14
V
SS
13
12 D+
11 D-
10 V
USB
9 SCL
5
UT
X
6
GP2
7
GP3
8
SDA
V
DD
GP0
GP1
RST
UR
X
UT
X
GP2
1
2
3
4
5
6
7
14 V
SS
13 D+
12 D-
11 V
USB
10 SCL
9
8
SDA
GP3
GP0
GP1
RST
UR
X
1
2
3
4
16
15
EP
17
* Includes Exposed Thermal Pad (EP); see
Table 1-1.
Block Diagram
CONFIG
USB
Bus
USB Module &
Transceiver
USB HID
USB CDC
BUS MATRIX
I
2
C Master
I
2
C
Bus
T
X
D/R
X
D
Internal
Oscillator
UART
IOC
GPIO
ADC/DAC
PIN
MUX
GP Pins
CLKR
DS20005292C-page 2
2014-2017 Microchip Technology Inc.
MCP2221
1.0
FUNCTIONAL DESCRIPTION
The MCP2221 is a USB-to-UART serial converter that
enables USB connectivity in applications that have
UART and/or I
2
C interfaces. The device reduces
external components by integrating the USB
termination resistors and the oscillator needed for USB
operation.
The MCP2221 has four GP pins for miscellaneous
functionalities (including GPIO, USBCFG, SSPND,
Clock Output, ADC, DAC and interrupt detector).
See
Table 1-1
and
Section 1.7 “Pin Mux Module”
for
details about the pin functions.
TABLE 1-1:
PINOUT DESCRIPTION
Standard Function
General purpose I/O or alternate SSPND (OUT)
function pin
LED_UR
X
Alternate Functions
Signals when the host has
entered Suspend mode
(OUT) UART R
X
LED activity output
(factory default)
Clock Reference Output
ADC Channel 1
UART T
X
Led activity output
(factory default)
External interrupt edge detector
PDIP,
Pin
Pin
SOIC, QFN
Name
Type
SSOP
GP0
2
1
I/O
GP1
3
2
I/O
General purpose I/O or alternate CLKR (OUT)
function pin
ADC1 (IN)
LED_UT
X
(OUT)
IOC (IN)
Reset input (with internal pull-up) N/A
UART R
X
pin (input)
UART T
X
pin (output)
N/A
N/A
RST
UR
X
UT
X
GP2
4
5
6
7
3
4
5
6
I
I
O
I/O
General purpose I/O or alternate USBCFG (OUT) USB device configured status
(factory default)
function pin
ADC2 (IN)
ADC Channel 2
DAC1 (OUT)
DAC Output 1
General purpose I/O or alternate LED_I2C (OUT)
function pin
ADC3 (IN)
DAC2 (OUT)
I
2
C Data line
I
2
C Clock line
N/A
N/A
USB-I
2
C traffic indicator (factory
default)
ADC Channel 3
DAC Output 2
GP3
8
7
I/O
SDA
SCL
V
USB
9
10
11
8
9
10
I/O
I/O
USB USB Power pin (internally
connected to 3.3V)
Should be locally bypassed with
a high-quality ceramic capacitor
USB USB D-
USB USB D+
P
—
P
—
Ground
Not Connected
Power
Exposed Thermal Pad (EP)
Do not electrically connect.
D-
D+
V
SS
NC
V
DD
EP
12
13
14
—
1
—
11
12
13
14
15
16
17
2014-2017 Microchip Technology Inc.
DS20005292C-page 3
MCP2221
1.1
Supported Operating Systems
1.3.1
GET/SET LINE CODING
The following operating systems are supported:
• Windows
®
– XP (SP3), Vista, 7, 8 and 8.1
• Linux
®
– any distribution with support for CDC
and HID classes
• Mac OS
®
– all versions – beginning with 10.7
The
GET_LINE_CODING
and
SET_LINE_CODING
commands are used to read and set the UART
parameters while in operation. For example, terminal
applications (e.g., Putty, RealTerm, Hyperterminal,
etc.) send the
SET_LINE_COMMAND
when connecting
to the port. The MCP2221 responds by setting the baud
rate only.
The other parameters (Data Bits, Parity, Stop Bits)
remain unchanged.
Note:
MCP2221 supports only eight Data bits,
no Parity, and one Stop bit.
1.1.1
ENUMERATION
The MCP2221 enumerates as a composite USB device
after Power-on Reset (POR). The device enumerates
as both a Human Interface Device (HID) for I
2
C, GPIO
control, and as CDC for the USB-to-UART converter.
1.1.1.1
USB HID
1.3.1.1
Rounding Errors
The MCP2221 enumerates as an HID, so the device
can be configured, while the I
2
C and GPIO can be
controlled. A DLL package, with example applications
and tools, is supplied by Microchip on the device web
page on the Microchip web site,
www.microchip.com.
Primary baud rate settings (with associated rounding
errors) are shown in
Table 1-2.
If baud rates other than the ones shown in the table are
used, the error percentage can be calculated using
Equation 1-1
to find the actual baud rate.
1.1.1.2
USB CDC
TABLE 1-2:
Desired Rate
300
1200
2400
4800
9600
19200
38400
57600
115200
The CDC enumeration implements the USB-to-UART
data translation.
UART PRIMARY BAUD
RATES
Actual rate
300
1200
2400
4800
9600
19200
38339
57692
115385
% Error
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.16%
0.16%
0.16%
1.2
Bus-Matrix Module
The Bus-Matrix module is the heart of the MCP2221.
All other modules are tied together and controlled via
the Bus-Matrix module. This module manages the data
transfers between the USB and the UART, the I
2
C
Master module, as well as the command requests
generated by the USB host controller and commands
for controlling the function of the UART, GPIO, ADC,
DAC and Clock Output.
1.2.1
UART
The control module interfaces to the UART and USB
modules.
EQUATION 1-1:
SOLVING FOR ACTUAL
BAUD RATE
1.2.2
ACCESSING THE DEVICE
The MCP2221 can be accessed for reading and writing
via USB host commands. The device cannot be
accessed or controlled via the UART interface.
12MHz
ActualRate = -----------------
-
int
x
Where:
12MHz
x = -----------------------------------
DesiredBaud
1.3
UART Interface
1.3.2
The MCP2221 UART interface consists of the T
X
and
R
X
data signals.
The UART is configurable for several baud rates. The
available baud rates are listed in
Table 1-2.
CUSTOM BAUD RATES
Custom baud rates are configured by sending the
SET_LINE_CODING
USB command. See
Section 2.0
“USB Enumeration Process”
for more information.
DS20005292C-page 4
2014-2017 Microchip Technology Inc.
MCP2221
1.4
Device Configuration
FIGURE 1-1:
The MCP2221 keeps all the essential device
configuration settings stored in Flash memory.
Device configuration settings affect the way the
MCP2221 behaves at run time.
The settings are stored into the Flash memory on the
device. Some of the settings are also copied into
SRAM at Power-Up/Reset.
These device configuration settings reside in the
following two distinct areas of Flash memory:
• Chip Settings
The Chip Settings area stores the key MCP2221
parameters – USB parameters, ADC/DAC
reference voltage choice, start-up DAC value,
Clock Reference output (CLKR) frequency and
duty cycle values.
• GP Settings
The GP Settings area stores the GP designation
settings. For GP settings that are assigned to
GPIO output operation, output values (logic
1
or
0)
are also specified.
Even though the MCP2221 places a partial copy of the
Chip Settings in SRAM, the following Chip Settings
always reside in Flash:
• USB Manufacturer/Product and Serial Number
descriptors
• USB VID and PID pair
• USB options (e.g., the requested amount of
current that is presented to the USB host during
the USB enumeration process)
The SRAM settings (GP and partial Chip Settings) can
be modified through USB HID commands and they will
have an effect on the following device features:
• GP pin designation (switch between GPIO,
dedicated or special functions modes)
• GPIO direction and output value (only for GPIO
outputs) – for the GPs assigned to work in GPIO
mode
• Clock Output duty cycle and value – if GP1 is
assigned for CLKR mode (Clock Reference
output mode), by modifying the SRAM settings,
the clock frequency and duty cycle can be
changed at run time
• DAC value and voltage reference used – the DAC
value setting as well as the voltage reference
used for it are stored in SRAM settings and they
can be changed at run time. Through this
mechanism, at run time the user can change the
DAC value, as well as the voltage reference.
• ADC voltage reference value – the voltage
reference used for ADC conversions can be
changed by altering its corresponding SRAM
setting
• Interrupt-on-change (IOC) detector settings – if
GP1 is assigned for IOC mode, the SRAM
settings are used for setting up the triggers used
for external interrupt detection (positive or
negative edge detection, or both)
CHIP SETTINGS RUN
TIME MANAGEMENT
Power-up Reset
Copy FLASH Chip and
GP settings to SRAM
USB enumeration
and configuration
complete
No
SRAM settings
changes needed
Yes
Change the
SRAM settings
1.4.1
POWER-UP RESET DEVICE
CONFIGURATION BEHAVIOR
At Power-up Reset, the MCP2221 configures the
device options (GP designation, special function pins
parameters and USB enumeration options) according
to the Flash settings. Then, the Flash Chip Settings and
GP Settings are loaded into SRAM to allow for their
temporary modification at run time.
Chip Settings of the Device Configuration Flash are
copied partially into SRAM. Only the run-time-modifiable
parameters are copied into SRAM.
GP Settings of the Device Configuration Flash (GP
settings area) are copied entirely into the SRAM. By
copying the GP settings completely into SRAM, the
user is allowed to completely change the GP
designation at run time.
The SRAM copy of the settings can be altered at run
time in order to change certain device behavior, e.g.,
GP designation (the GPs can be re-assigned for a
different type of operation than the one assigned at
Power-up) and special parameters (DAC value,
ADC/DAC voltage references, Clock output value).
2014-2017 Microchip Technology Inc.
DS20005292C-page 5