AN721 CP21 XX D EVICE C U S T O MI Z A T I O N G U I D E Relevant Devices This application note applies to the following devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108, CP2110, CP2112, CP2114, CP2130 1. Introduction This document explains the steps required to customize a fixed function USB device. It is intended for developers creating products based on the CP210x/CP211x/CP2130 USB Bridge Controllers. It contains information about obtaining a Vendor ID (VID) and Product ID (PID) for a CP210x/CP211x/CP2130 product and describes the steps necessary for customizing the device descriptors. Refer to www.silabs.com/interface for the latest revisions of this document and other application notes related to the CP210x/CP211x/CP2130 device families. 1.1. USB Logos and Certification Testing USB is a widely used peripheral. The USB Implementers Forum, Inc. has introduced trademark-protected logos for use with qualified USB products. To use the logo, USB products are required to meet the standards of the USB Implementers Forum. For a product to have compliance and/or certification implies that the USB product has been tested by the USB-IF to meet the specification. Each type of USB product requires specific testing to be listed on the Integrators List. This is important not only to OEMs but to consumers because products tested and certified by the USB-IF are assured to work together. Compliance testing exists to help manufacturers measure how well their products match the respective USB specification. If a product has passed USB-IF compliance testing, the company can use the USB logo on the products. 1.2. USB Vendor IDs and Product IDs Each device on a USB bus must have a unique Vendor ID (VID), Product ID (PID), and serial number combination. This ID system uniquely identifies the different devices on the bus to avoid conflicts. The PC uses the VID/PID to find the drivers (if any) to be used for the USB device. The VID/PID must be unique in that each USB device with the same VID/PID will use the same driver, and it is strongly recommended to make the PID unique to a particular design. The USB devices of a given VID/PID combination can be serialized, which allows the operating system to track not only a particular model, but also a specific board of that model. Vendor IDs are owned by the vendor company and assigned by the USB Implementers Forum (USB-IF) only. Details about obtaining a unique VID can be found at www.usb.org/developers/vendor. To obtain the right to license the USB-IF logo, register the product's VID and PID with USB-IF and submit the product to the USB-IF Compliance Program. USB-IF Compliance Program details are available at www.usb.org/developers/compliance. Once the product is certified, it can be added to the USB-IF Integrators List, and the “Certified USB” logo can be used on the product. The default Silicon Labs VID is 0x10C4 and the default Silicon Labs PID is dependent on the device. To obtain a unique PID for your CP210x/CP211x/CP2130-based product, visit http://www.silabs.com/RequestPID. Note that customization of the USB strings is optional, but is strongly recommended. A unique VID/PID combination will prevent the driver from conflicting with any other USB driver. Rev. 1.2 10/13 Copyright © 2013 by Silicon Laboratories AN721 AN721 2. Basic Device Customization The steps to customize the CP210x family of devices is slightly different than customizing the CP211x and CP2130 devices. The CP210x devices require a driver, but the CP211x devices do not because they are of the HID class, which is natively supported by most operating systems. The next two sections describe the recommended steps for customizing the device based on the family, either the CP210x, CP211x, or CP2130. 2.1. Summary of Steps for Customizing the CP210x Non-HID USB Devices The CP210x family of devices provides communication from USB to UART. This requires a driver to interface to the device. There are two types of drivers provided. One is the Virtual COM port (VCP) driver which allows the device to appear to the PC’s application software as a COM port. This driver is always used first to connect to the Device Customization Software program to change the PID since by default this driver has the same VID and PID as what is programmed in the default devices. After the Device Customization Software program is used to change the PID, the driver must match the new values that have been loaded in the device from the Device Customization Software. If the user wants to communicate to the device via a high level application program, a USBXpress driver can be used which provides this functionality. This driver must be downloaded and installed after using the Device Customization Software. Then the USBXpress driver or VCP driver (which ever one will be used) should be updated to make sure the driver matches the VID and PID in the device. A PC cannot have both the VCP and USBXpress drivers loaded with the same VID and PID, as this would cause USB device identification conflicts. In the end, only one driver can be used, either the VCP or the USBXpress. There are VCP and USBXpress drivers for various operating systems, which are all listed on the website at http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx for the VCP driver and at www.silabs.com/usbxpress for the USBXpress driver. The process described below must be followed each time a new operating system must be supported. If the driver has been certified for Windows 7 32-bit and then it is necessary to support Windows 7 64-bit, then the driver must be recertified. The Microsoft certification process must be initiated again, and the reseller fee must be paid to Microsoft for the 64-bit version of the driver. Microsoft requires this certification process which involves Windows hardware quality labs testing (WHQL). It certifies that the hardware or software has been tested by Microsoft to ensure compatibility. Device drivers that pass the WHQL tests are given a digitally signed certification file, which prevents Windows from displaying a warning message that the driver has not been certified by Microsoft. Figure 1 shows the default VID and PID values for the device and drivers. To establish communication with the driver, the VID and PID of the device must match the driver. Notice that the default CP210x device VID and PID match the default VCP driver VID and PID numbers. 2 Rev. 1.2 AN721 Stock VCP Driver Stock USBXPress Driver CP2101-CP2104: VID: 0x10C4 PID: 0xEA60 CP2105: VID: 0x10C4 PID: 0xEA70 CP2108: VID: 0x10C4 PID: 0xEA71 CP2101-CP2104: VID: 0x10C4 PID: 0xEA61 Default Firmware in Device CP2101-CP2104: VID: 0x10C4 PID: 0xEA60 CP2105: VID: 0x10C4 PID: 0xEA70 CP2108: VID: 0x10C4 PID: 0xEA71 Figure 1. Default VID and PID Values for Driver vs Firmware The steps to customize the CP210x USB devices are as follows: 1. Request a unique PID from Silicon Labs for your new product design: http://www.silabs.com/RequestPID, or obtain a VID/PID from usb.org. 2. Download the VCP driver appropriate for your operating system here: http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx. The stock VCP driver from the website should match the default VID and PID in the CP210x. The VCP driver must be installed with matching VID and PID to communicate to the device. 3. Run the Device Customization Software program described in the next sections to change the descriptors in the device. 4. (USBXpress Users Only): If the desired driver is USBXpress, it can be download here: www.silabs.com/usbxpress. This driver allows direct access using Silicon Labs API commands to control the device. When this driver is initially downloaded it will not have the matching VID/PID of the CP210x devices. See Figure 1 for the default driver and device VID/PID. 5. Use the USB Driver Customization Wizard and instructions in AN220SW and AN220 “USB Driver Customization” https://www.silabs.com/Support%20Documents/TechnicalDocs/an220.pdf to update the driver for the new PID and any other descriptors that have been changed from Step 3. Be certain to use the version of AN220 software which corresponds to the correct driver when generating the modified drivers. Take care to verify that these customized drivers are completely correct, as none of the files in the driver package can change in any way once the driver has been certified. If you do not have the correct version of the AN220 software, please contact our support team www.silabs.com/contactsupport. Update either the VCP driver (COM port) or USBXpress driver (API commands) to match the device. The USB Driver Customization Wizard customizes the driver by changing the hardware installation files (.inf) in the driver package. The strings contained in the .inf files affect what is displayed in the “Found New Hardware Wizard” dialogs, Device Manager and the Registry. Any changes to the Windows® installation .inf files will require new Windows Hardware Quality Labs (WHQL) tests. Rev. 1.2 3 AN721 6. (Microsoft Windows Only): The customized driver is eligible for WHQL re-seller submissions to certify the driver. These submissions do not have the high cost and testing requirements of an original driver submission. To certify a customized VCP or USBXpress driver, register at the WinQual site https://sysdev.microsoft.com to obtain a WinQual account with your company. Internet Explorer is the only web browser that can be used with the WHQL website. A Verisign ID is needed to register an account (instructions for obtaining one are available at Microsoft's website: http://msdn.microsoft.com/en-us/library/windows/hardware/hh801887?ppud=4. The correct Verisign ID is the CodeSigner Standard http://www.verisign.com/code-signing/microsoft-authenticode/index.html?sl=header. 7. (Microsoft Windows Only): After obtaining a WinQual account, notify the Silicon Labs support team www.silabs.com/contactsupport to be added as a registered Reseller. Provide the driver type (VCP or USBXpress) and version (e.g., v6.5) when requesting Reseller status. 8. (Microsoft Windows Only): Silicon Labs will add your company as a registered reseller. Your company must complete the provided directions to finish the recertification process. Note: For further detailed instructions on Microsoft’s submission process for recertification for a customized driver please view the document attached to the KnowledgeBase article called “How to Recertify a Customized Driver Package.pdf” located here: http://cp-siliconlabs.kb.net/article.aspx?article=89180&p=4120. 2.2. Summary of Steps for Customizing the CP211x HID USB Devices The CP211x family does not require a driver because it is automatically recognized as part of the HID class, which simplifies the process. Most operating systems include native drivers. The CP211x will not fit a standard HID device type such as a keyboard or mouse. Any CP211x PC application will need to use the specific CP211x HID specification to communicate with it. This low-level HID specification is documented and provided by Silicon Labs in the form of a DLL. The following are the steps to follow to customize the CP211x HID USB devices to ensure a unique VID/PID combination: 1. Request a unique PID from Silicon Labs for a new design: http://www.silabs.com/RequestPID. 2. Use the Device Customization Software program described in Section 3 below to change the descriptors in the firmware of the device. 2.3. Summary of Steps for Customizing CP2130 USB-to-SPI Devices The CP2130 family of devices provides communication from USB to SPI. This requires a driver to interface to the device. In most cases, a generic USB driver, such a Microsoft's WinUSB or the open source libUSB driver, can be used with the CP2130. All that is required is to generate a proper driver INF file that associates a CP2130 with a specific USB VID/PID with the generic USB driver. The CP2130 evaluation kit ships with a WinUSB driver and INF file that includes support for the default CP2130 VID/PID. In order to customize the CP2130, the user must install this stock driver in order for the CP21xx Customization Software to communicate with the device. Once the CP2130 has been customized and the VID and/or PID have changed, the user must customize the driver to recognize the new VID/PID. The CP2130 data sheet lists WinUSB drivers for various Windows operating systems. The steps described below must be followed each time a new operating system is to be supported. If the driver has been certified for Windows 7 32-bit and it becomes necessary to support Windows 7 64-bit, then the driver must be recertified. The Microsoft certification process must be initiated again, and the reseller fee must be paid to Microsoft for the 64-bit version of the driver. Microsoft requires this certification process, which involves Windows hardware quality labs testing (WHQL). It certifies that the hardware or software has been tested by Microsoft to ensure compatibility. Device drivers that pass the WHQL tests are given a digitally-signed certification file, which prevents Windows from displaying a warning message that the driver has not been certified by Microsoft. Figure 2 shows the default VID and PID values for the device and drivers. To establish communication with the driver, the VID and PID of the device must match the driver. Notice that the default CP2130 device VID and PID match the default WinUSB driver VID and PID numbers. 4 Rev. 1.2 AN721 Stock WinUSB Driver CP2130: VID: 0x10C4 PID: 0x87A0 Default Firmware in Device CP2130: VID: 0x10C4 PID: 0x87A0 Figure 2. Default VID and PID Values for Driver vs. Firmware Perform the following steps to customize the CP2130 USB devices: 1. Request a unique PID from Silicon Labs for your new product design: http://www.silabs.com/RequestPID, or obtain a VID/PID from usb.org 2. Download the WinUSB driver appropriate for your operating system from here: http://www.silabs.com/CP2130EK The stock WinUSB driver from the web site should match the default VID and PID in the CP2130. The driver must be installed with matching VID and PID to communicate to the device. 3. Run the Device Customization Software program described in the following sections to change the descriptors in the device. 4. Modify a copy of the stock WinUSB driver hardware installation file (.inf) for the new PID and any other descriptors that have been changed from Step 3. Take care to verify that these customized drivers are completely correct, as none of the files in the driver package can change in any way once the driver has been certified. The strings contained in the .inf file affect what is displayed in the “Found New Hardware Wizard” dialogs, Device Manager, and the Registry. Any changes to the Windows® installation .inf files will require new Windows Hardware Quality Labs (WHQL) tests. 5. (Microsoft Windows Only): The customized driver is eligible for WHQL re-seller submissions to certify the driver. These submissions do not have the high cost and testing requirements of an original driver submission. To certify a customized WinUSB driver, register at the WinQual site: (https://sysdev.microsoft.com) to obtain a WinQual account with your company. Internet Explorer is the only web browser that can be used with the WHQL web site. A Verisign ID is needed to register an account (instructions for obtaining one are available at the Microsoft web site: http://msdn.microsoft.com/en-us/library/windows/hardware/hh801887?ppud=4 The correct Verisign ID is the CodeSigner Standard: http://www.verisign.com/code-signing/microsoft-authenticode/index.html?sl=header. 6. (Microsoft Windows Only): After obtaining a WinQual account, notify the Silicon Labs support team (www.silabs.com/contactsupport) (click on “Open a support request”) to be added as a registered Reseller. Provide the driver type (CP2130 WinUSB) and version (e.g., 1.0) when requesting Reseller status. 7. (Microsoft Windows Only): Silicon Labs will add your company as a registered reseller. Your company must complete the provided directions to finish the recertification process. Note: For further detailed instructions on Microsoft’s submission process for recertification for a customized driver, please view the document attached to the KnowledgeBase article called “How to Recertify a Customized Driver Package.pdf” at: http://cp-siliconlabs.kb.net/article.aspx?article=89180&p=4120. Rev. 1.2 5 AN721 3. Device Customization Software The descriptors and other configurable options of the devices in the CP210x/CP211x/CP2130 families are modifiable using the Windows program CP21xx Device Customization Software.exe (Figure 3). The software program automatically recognizes the device that is plugged into the PC. When the CP21xxCustomizationUtility.exe is launched, the program searches the Windows registry for any CP21xx devices attached to the PC. The full path information for all of the devices found is inserted into the “Select Device” drop-down list, and the first device is selected automatically. This CP21xxCustomizationUtility.exe program is included in the software zip file in this application note. The descriptions of how to use the program is described in more detail in the following sections for the different families of devices. Be aware that one-time programmable (OTP) devices can only be changed once. The program can access the fields but will not be able to program them more than once. The CP21xx Device Customization Software uses the Windows Host API functions implemented by all the DLL files for the different families of devices mentioned. The Host API functions give read/write access to the descriptors contained in programmable areas of a connected device. Another option is implementing a custom application using the host API with the DLL suited to the individual needs of a particular production environment. The descriptors can also be set in the factory at production time for large orders. Contact your Silicon Laboratories sales representative for details. Drop Down List of Connected Devices SET IDs Options Edit Values Here Baud Rate Alias Options Port I/O Options Click Here to save values into flash Status Logging Status Status Logging Logging Log to a File Figure 3. Device Customization Software General Overview 6 Rev. 1.2 AN721 The above program is an example of the CP2110 device, but the program is similar for all devices. There are three main sections that can be edited. The first one is the Set IDs section as shown. Below that is the Baud Rate Alias section and then below that is the Port Configuration settings. Changes can be made in each of these sections and saved by clicking on the “Program Device” button. This will save the values into flash or one-time programmable memory. If any of these three main sections are blank it is because there is no configuration for the Baud Rate Alias or Port Configuration. All devices will have the SETID Configuration. The Status Logging window updates and prints out all the transactions to verify the device has programmed correctly. 4. Changing Device Settings for the CP2110, CP2114, and CP2130 The CP2110, CP2114, and CP2130 are all one-time programmable devices. The various customizable fields of the CP2110/CP2114/CP2130 devices are only programmable one time using the program. Be careful to change all settings under every tab before clicking the “Program Device” button. Figure 4. CP2110, CP2114, and CP2130 Device Customization Software Set IDs Window When the Device Customization Software is launched, the program searches for any CP2110/CP2114/CP2130 devices attached to the PC. The full path information for all of the devices found is inserted into the "Device Selection" drop-down list, and the first device is selected automatically. There is a SET IDs window and a Port Configuration Window for both these devices. Rev. 1.2 7 AN721 4.1. Set IDs Tab CP2110, CP2114, and CP2130 Devices Figure 4 shows the following modifiable parameters for the CP2110/CP2114/CP2130: 1. VID—The Vendor ID is a four hexadecimal digit number such as 10C4. 2. PID—The Product ID is a four hexadecimal digit number such as EAB0. 3. Power—This is a two hexadecimal digit number such as 10 with a maximum setting of 250. Note this number corresponds to units of current in 2 mA increments. Therefore a value of 10 corresponds to 32 mA. 4. Power Mode—There are three different power mode options. Click the field to see the options. 00 corresponds to Bus Powered, 01 is Self Powered with Voltage Regulator Disabled, 02 is Self Powered with Voltage Regulator Enabled. 5. Release Version—The release version is a numerical identifier of the device release version. Each field is a decimal number value 0–99. The first two digits are the major version number and the last two are the minor digits. 0100 corresponds to Major Version 01, Minor Version 00. Figure 5. CP2110/CP2114 Flush Buffers Options 6. Flush Buffers (CP2110/CP2114 only)—The flush buffers options shown above in Figure 5 allows open and close options on the RX and TX. Check the options required for the application. 7. Manufacturer—This is the name of the company manufacturing the product. 8. Product Description—The Product Description can be any sequence of up to 126 characters. Usually this is text which provides a description of the device, such as CP2103 USB to UART Bridge Controller. 9. Serial Number—The Serial Number can be any sequence of up to 63 characters. 10.Transfer Priority (CP2130 only)—The CP2130 supports double-buffered USB OUT transfers in high-priority write mode or double-buffered USB IN transfers in high-priority read mode. 8 Rev. 1.2 AN721 4.2. Port Configuration Settings CP2110, CP2114, and CP2130 The Port Configuration settings are available by clicking on the “Port Configuration” Tab. Click on the number in the value box to access a drop down menu of options for each pin configuration. Refer to the data sheet for further explanation of the different options available. After a value has been changed it will be highlighted in yellow. Click the Program Device button when complete. The GPIO pin settings in the CP2110/CP2114/CP2130 can be modified to set the pins for input, Output Push-Pull, or Output Open Drain. Figures 6, 7, and 8 show the port configurations for the CP2110, CP2114, and CP2130, respectively. The alternate pin options are different and the default values are different. The GPIO pin configuration options and alternative functions are selectable from the drop down menu when clicking on the value. Figure 6. CP2110 Port Configuration Settings Rev. 1.2 9 AN721 Figure 7. CP2114 Port Configuration Settings 10 Rev. 1.2 AN721 Figure 8. CP2130 Port Configuration Settings The Suspend Value setting allows the option for the latch to be enabled on any of the selected pins shown in Figure 9. A similar menu is available for the Suspend Mode allowing a selection between open-drain and push-pull for the different pins in suspend mode. Rev. 1.2 11 AN721 Figure 9. CP2110/CP2114/CP2130 Suspend Value Settings See “AN434: CP2110/4 Interface Specification” and “AN792: CP2130 Interface Specification” for a full description of each of the customizable parameters. If using the Device Customization Software to program multiple devices, the customized values can be saved to a text file using the File Save and File Save As commands. When connecting a new device, use the File Open command to retrieve the saved settings, which are then directly programmable to the new device. Notes: 1. Avoid connecting more than one device containing the same VID, PID, and serial number combination. 2. CLK must be configured as a “CLK Output -Push Pull” before configuring the “CLK Output Divider” setting. The Manufacturer String, Product String, and Serial Number are automatically converted to Unicode strings before programming. 12 Rev. 1.2 AN721 4.3. DAC Configuration Application (CP2114 ONLY) The DAC Configuration utility is accessed by clicking on the “Advanced” tab and selecting “DAC Configuration CP2114” shown in Figure 10. This is an application that allows audio configuration strings to be sent to the onetime programmable memory or RAM. The audio string is used by the CP2114 to configure the DAC/CODEC. Figure 10. Advanced Settings DAC Utility Rev. 1.2 13 AN721 Figure 11 shows a screen shot of the DAC Utility. Section 4.4 details all the configuration settings for the utility. Figure 11. DAC Configuration 14 Rev. 1.2 AN721 4.4. Application Command Descriptions 4.4.1. Get CP2114 Capabilities This button will report the current configuration of the one-time programmable memory. With the default pin configuration and no jumpers installed on GPIO.5, GPIO.6, GPIO.7, or GPIO.8, the utility will display the following: * CP2114 Caps AvailableBootIndices: 0x20 AvailableOtpConfigs: 0x1D CurrentBootConfig: 0xFF AvailableOtpConfigSpace: 0x1532 The AvailableBootIndices: 0x20 parameter indicates that all 32 boot index slots are available for programming. The AvailableOtpConfigs: 0x1D parameter indicates that there are 29 CP2114 configurations available in the one-time programmable memory. The CP2114 EVB ships with three default configurations in OTP at the following indices: Index 0: Audio out and audio in streams both set to Asynchronous with CS42L55 DAC settings. Index 1: Audio out and audio in streams both set to Asynchronous with WM8523 DAC settings. Index 2: Audio out and audio in streams both set to Asynchronous with PCM1774 DAC settings. The CurrentBootConfig parameter with a value of 0xFF indicates the CP2114 will not configure any DAC devices on a reset or boot.This occurs when DAC select input feature is turned on and no jumpers are installed on GPIO.5, GPIO.6, GPIO.7, and GPIO.8. DAC select input feature is turned on and the GPIO value is set to “Use OTP Boot Config” while no valid boot config entry is found in the one-time programmable memory. DAC select input feature is turned off and there is no valid Boot Config entry in the one-time programmable memory. The CP2114 has 32 programmable boot configuration entries by default. (The CP2114 boot configuration can be changed up to a total of 32 times.) The final parameter, AvailableOtPConfigSpace: 0x1532 indicates there are 0x1532 (5426) bytes of programmable memory available to support new configurations. 4.4.2. Reset Device This button forces a CP2114 reset. 4.4.3. Load Config Text from File Loads configuration text from a file into the Config Text window. 4.4.4. Save Config Text to File Saves the text in the Config Text window to a file. 4.4.5. Write Config Text to RAM Writes the configuration displayed in the Config Text window into the CP2114 RAM. The DAC configurations are also written to the DAC. This operation will cause the CP2114 to disconnect and reconnect on the USB bus. This configuration is not retained on device reset. 4.4.6. Write Config Text to OTP Writes the configuration in the Config Text window to the one-time programmable memory. The configuration does not become the active configuration in RAM unless it’s specified in CP2114 Boot Config or via DAC select GPIO pins followed by power cycling or resetting the device. 4.4.7. Read CP2114 Config from OTP After specifying the configuration number in the text box to the right of the button and clicking the button, the utility will display the one-time programmable memory configuration in the output window. Rev. 1.2 15 AN721 4.4.8. Set CP2114 Boot Config After specifying the configuration number in the text box to the right of the button and clicking the button, the boot configuration index is programmed into the one-time programmable memory space. Note: The CP2114 boot configuration index can be changed up to 32 times. 4.4.9. Get DAC Registers Displays one or more DAC registers in the output window. To display a contiguous range of DAC registers enter the starting register address in the Start Address field and the number of registers to read in the Num Registers field. Click Get DAC Registers and the register values will be displayed in the status window as hex comma-separated values. 4.4.10. Save Final Device Customization to File Save the final 5.5 kB of customized data into a file for one-time programming in production. 4.5. Using the CP2114 DAC Application Use the following steps to program the CP2114 using the DAC configuration utility: 1. Click Get CP2114 Capabilities and note the boot index, available OTP boot index slots, and available OTP config space. 2. Click Load Config Text from File if there is one available; otherwise write the config text into the Config Text window directly. 3. Click Write Config Text to RAM. This will cause CP2114 to re-enumerate over USB. Once CP2114 device is seen by the Host again, verify the device's audio functionalities including volume control and mute control. Adjust the value in Config Text if necessary and repeat Write Config Text to RAM until desired result is achieved. 4. Verify the DAC registers have the desired setting by entering the Start Address and Num Registers and clicking Get DAC Registers. 5. Click Save Config Text to File to save a copy of the text in the Config Text window. 6. Click Write Config Text to OTP after all functionalities have been completely verified in RAM. The new config will consume one Boot Config index slot and some one-time programmable config space. The index of this new config should be the next available index. For example, if Get CP2114 Capabilities returned AvailableOtpConfigs of 0x1D, this Configuration index will be 3. 7. Enter the index of the new config and click Read CP2114 Config from OTP. Verify the data returned is as expected. 8. Click Get CP2114 Capabilities and verify the available OTP config space is (2+Config Data bytes) less than the previous value. The firmware inserts 2-byte length before the Config Data when writing to OTP. Available OTP Configs should be 1 less than the previous value. 9. Enter the Configuration index of the new Config and click Set CP2114 Boot Config to make CP2114 to boot from the new Config. 10. Reset the CP2114. 11. Verify CP2114 boots up properly with DAC functioning properly. Verify volume and mute integration with the Host. Click Save Final Device Configuration to File for OTP programming in production. 16 Rev. 1.2 AN721 5. Changing Device Settings CP210X There are six different CP210x devices. The CP2104 and CP2105 are one time programmable (OTP), therefore it is important to be careful when programming these since they cannot be programmed multiple times. The CP2101CP2104 are all USB to single UART devices. The CP2105 is a USB to dual UART and the CP2108 is a USB to quad UART. 5.1. SET IDs CP210x Devices All CP210x devices have strings that can be modified in the SETIDs window. Figure 12. CP210x SET IDs Figure 12, “CP210x SET IDs,”shows the modifiable parameters for all the CP210x devices. The CP2105 device shown on the left has 2 interface strings because it is a dual UART device. The CP2108 on the right has 4 interface strings because it is a quad UART device. There are 4 different interfaces. The single interface devices CP2101CP2104 do not require an interface string since with only one interface there is only one option. The interface strings are unique to the CP2105 and CP2108 since they have multiple interfaces. All the devices contain the following parameters: 1. VID—The Vendor ID is a four hexadecimal digit number such as 10C4. 2. PID—The Product ID is a four hexadecimal digit number such as EA60. 3. Power—This is a two hexadecimal digit number such as 10 with a maximum setting of 250. Note this number corresponds to units of current in 2 mA increments. Therefore a value of 10 corresponds to 32 mA. 4. Power Mode—There are three different power mode options. Click the field to see the options. 00 corresponds to Bus Powered, 01 is Self Powered with Voltage Regulator Disabled, 02 is Self Powered with Voltage Regulator Enabled. 5. Release Version—The release version is a numerical identifier of the device release version. Each field is a decimal number value 0–99. The first two digits are the major version number and the last two are the minor digits. 0100 corresponds to Major Version 01, Minor Version 00. Rev. 1.2 17 AN721 6. Product Description—The Product Description can be any sequence of up to 126 characters. Usually this is text which provides a description of the device, such as CP2103 USB to UART Bridge Controller. 7. Interface String—The string that identifies the different interface. This parameter is only present in the CP2105 and the CP2108, which have multiple interfaces. 8. Serial Number —The Serial Number can be any sequence of up to 63 characters. 9. Device Mode—The mode of the interface on the device, either GPIO or Modem Mode. This parameter is only present on CP2105. 5.2. Baud Rate Alias Configuration (CP2102, CP2103) The CP2102 and CP2103 have Baud Rate Alias Configuration Settings. Changing the values in this table will cause the CP210x to translate 1 of 32 fixed UART baud rates to a desired baud rate shown in Figure 13. All ranges for a requested baud rate are shown. Figure 13. Baud Rate Configuration 18 Rev. 1.2 AN721 Baud rate aliasing refers to configuring a specific baud rate range to target a baud rate that is different from the default baud rate. Further support information can be found in the device data sheet for the CP2102/CP2103, which have this feature. The application-requested baud rate ranges are static and can never be changed. The actual UART baud rate corresponding to a particular baud rate range is fully customizable. This customization is done using a Windows Dynamic Link Library (DLL) named CP210xManufacturing.DLL. Using the functions available in this API (GetBaudRateConfig() and SetBaudRateConfig()) the EEPROM settings can be changed using the USB connection. Each line displays a range of baud rates that an application might request. There is a desired baud rate to use in that range and the actual baud rate that is used. To change the current configuration click on the desired baud rate number and enter in a new value. The Actual Baud Rate field will update to show the closest baud rate the hardware can achieve. Normally these two numbers will not be exactly the same, but as long as the actual baud rate is within 3% of the desired baud rate, the communication channel will work correctly. 5.3. Port Configuration (CP2103, CP2104, CP2105, CP2108) The CP2103, CP2104, CP2105 and CP2108 all have modifiable port settings. These port settings have three types of interface pins. The UART/Modem interface pins consist for the signals RI, DCD, DTR,DSR,TXD,RXD,RTS and CTS. These signals are used for UART communication and the associated handshaking. The second type of interface pin is for general purpose input/output (GPIO). This type consists of all signals named GPIO.x where x is a number. these signals are available for any user-defined function. the final type of interface pin is for power control and consists of SUSPEND and SUSPEND signals. These signals are used to gate power consumption of external circuitry for bus-powered USB products. The following interface pin configuration options are available. 5.3.1. Mode The mode setting controls whether the interface pin operates in push-pull or open-drain mode. This setting is not available on the RXD pin. See Sections 5.3.8 and 5.3.9 for details concerning pin modes. 5.3.2. Reset Latch Value This setting controls the initial value of the interface pin latch, after a device reset. Not available on RXD, TXD, SUSPEND, SUSPEND, and GPIO pins set for device-controlled function. See Section 5.3.11 for details concerning pin reset behavior. 5.3.3. Weak Pull-Ups This setting enables a weak pull-up for all interface pins. This setting applies to the device as a whole and cannot be configured for each pin independently. Upon reset, weak pull-ups are enabled. 5.3.4. GPIO Pin Function By default, the GPIO pins are controlled manually by host-based software using the CP210xRuntime.DLL and an open handle to the COM port to read and write the latch. Alternatively, the CP210x device can automatically control certain GPIO pin latches for a predetermined function. When operating in this mode, the GPIO pin will no longer be available using the CP210xRuntime.DLL. Host writes will have no effect, and host reads will be logic high. This device-controlled function is available as shown in Table 1. Rev. 1.2 19 AN721 Table 1. GPIO Pin Function Pin Name Function Behavior GPIO.0 Transmit LED Toggles when there is UART data to transmit; otherwise logic high GPIO.1 Receive LED Toggles when there is data on the UART receive buffer; otherwise logic high. GPIO.2 RS-485 Logic low while transmitting UART data; otherwise logic high. Note: On the CP2105, RS-485 mode is available on the Enhanced Communication Interface (ECI) on GPIO.1. Because of this, the alternate function GPIO.1_ECI can either be Receive LED or RS-485 mode. The Standard Communication Interface (SCI) does not have an RS-485 mode. 5.3.5. Dynamic Suspend By default the latch values for all interface pins remains static during USB suspend. Alternatively, the dynamic suspend feature sets the interface pin latch to a predefined state when the CP210x device moves from the configured USB state to the suspend USB state (see chapter nine of USB 2.0 specification for more information on USB device states). When the device exits the suspend USB state the interface pin latch is restored to the previous value before entering the suspend state. Dynamic Suspend is configured separately for the GPIO pins and UART/Modem Control pins. 5.3.6. Latch Value (SUSPEND) When dynamic suspend is enabled, this value is written to the interface pin latch when the CP210x device moves from the configured USB state to the suspend USB state (see chapter nine of USB 2.0 specification for more information on USB device states). Not available on RXD, SUSPEND, SUSPEND, and GPIO pins set for devicecontrolled function. 5.3.7. High-Impedance Input By configuring for open-drain operation and writing logic high (1) to the latch, an interface pin assumes a high impedance state. This input pin will have electrical characteristics as listed in table 3 of the device data sheet. 5.3.8. Push-Pull Output By configuring for push-pull operation, an interface pin operates as a push-pull output. The output voltage is determined by pin’s latch value. This output pin will have electrical characteristics as listed in table 3 of the device data sheet. This type of output is most often used to connect directly to another device. 5.3.9. Open-Drain Output By configuring for open-drain operation, an interface pin operates as an open-drain output. The output voltage is determined by the pin's latch value. If the pin latch value is 1, the pin is pulled up to VDD (CP2102) or VIO (CP2103, CP2104, CP2105) through an on-chip pull-up resistor. The pin can also be safely pulled up to 5 V if an external pull-up resistor is added. This output pin will have electrical characteristics as listed in Table 3 of the device data sheet. 5.3.10. Low Power State By writing logic low to the latch, an interface pin is grounded and consumes minimal power with weak pull-ups disabled. This setting is best for unused interface pins that are not connected to external circuitry. 5.3.11. Reset Behavior All interface pins temporarily float high during a device reset. If this behavior is undesirable, a strong pull-down (10 k) can be used to ensure the pin remains low during reset. Figure 14 is a screenshot of the CP2103 and CP2104 Port Configuration Settings.Figure 15 is a screenshot of the CP2105 Port Configuration Settings and Figure 16 is a screenshot of the CP2108 Port Configuration Settings. Click on the value to modify any of the settings. In most cases a pull down menu is available. For the Suspend Value and the Reset Value Settings a pop up window allows the latch setting selections as shown in Figure 17. 20 Rev. 1.2 AN721 Figure 14. CP2103/CP2104 Port Configuration Rev. 1.2 21 AN721 Figure 15. CP2105 Port Configuration 22 Rev. 1.2 AN721 Figure 16. CP2108 Port Configuration Rev. 1.2 23 AN721 Figure 17. Latch Settings 24 Rev. 1.2 AN721 6. CP210x Host API Functions There are two DLL files CP210xManufacturing.DLL and CP210xRuntime.DLL which have several API functions that are described and listed. 6.1. CP210xManufacturing.DLL The CP210x Host API is provided as a means to facilitate production of customized CP210x devices. The API allows access to the CP210x device for retrieving and setting the VID, PID, product string, serial number, selfpower attribute, maximum power consumption, and device version. The CP210x Host API is provided in the form of a Windows Dynamic Link Library (DLL), CP210xManufacturing.DLL. The host interface DLL communicates with the bridge controller device via the provided device driver and the operating system's USB stack. The following is a list of the available host API functions: CP210x_GetNumDevices() CP210x_GetProductString() CP210x_GetPartNumber() CP210x_Open() CP210x_Close() Returns the number of CP210x devices connected. Returns a descriptor from the registry for a CP210x USB device. Returns the 1-byte Part Number of a CP210x device. Opens a CP210x device as a USB device and returns a handle. Closes a CP210x device handle. CP210x_SetVid() CP210x_SetPid() CP210x_SetProductString() CP210x_SetInterfaceString() CP210x_SetSerialNumber() CP210x_SetSelfPower() CP210x_SetMaxPower() CP210x_SetFlushBufferConfig() CP210x_SetDeviceMode() CP210x_SetDeviceVersion() CP210x_SetBaudRateConfig() CP210x_SetLockValue() CP210x_SetPortConfig() CP210x_SetDualPortConfig() CP210x_SetQuadPortConfig() Sets the 2-byte vendor ID of a CP210x device. Sets the 2-byte product ID of a CP210x device. Sets the product description string of a CP210x device. Sets the interface string of a CP2105 device. Sets the serial number string of a CP210x device. Sets the self-power attribute of a CP210x device. Sets the maximum power consumption of a CP210x device. Sets the flush buffer configuration of CP2104/5 devices. Sets the operating modes of both interfaces of a CP2105 device. Sets version number of the CP210x device. Sets the baud rate configuration data of a CP210x device. Sets the 1-byte Lock Value of a CP210x device. Sets the port configuration of a CP2101/2/3/4 device. Sets the port configuration of a CP2105 device. Sets the port configuration of a CP2108 device. CP210x_GetDeviceProductString() CP210x_GetDeviceInterfaceString() CP210x_GetDeviceSerialNumber() CP210x_GetDeviceVid() CP210x_GetDevicePid() CP210x_GetSelfPower() CP210x_GetMaxPower() CP210x_GetFlushBufferConfig() CP210x_GetDeviceMode() CP210x_GetDeviceVersion() CP210x_GetBaudRateConfig() CP210x_GetLockValue() CP210x_GetPortConfig() CP210x_GetDualPortConfig() CP210x_GetQuadPortConfig() CP210x_Reset() Gets the product description string of a CP210x device. Gets the interface string of a CP2105 device. Gets the serial number string of a CP210x device. Gets the vendor ID of a CP210x device. Gets the product ID of a CP210x device. Gets the self-power attribute of a CP210x device. Gets the maximum power consumption value of a CP210x device. Gets the flush buffer configuration of CP2104/5 devices. Gets the operating modes of interfaces of a CP2105 device. Gets the version number of a CP210x device. Gets the baud rate configuration data of a CP210x device. Gets the 1-byte Lock Value of a CP210x device. Gets the port configuration of a CP210x device. Gets the port configuration of a CP2105 device. Gets the port configuration of a CP2108 device. Resets a CP210x device. Rev. 1.2 25 AN721 In general, the user initiates communication with the target CP210x device by making a call to CP210x_GetNumDevices(). This call returns the number of CP210x target devices. This number is used as a range when calling CP210x_GetProductString() to build a list of devices connected to the host machine. A handle to the device must first be opened by a call to CP210x_Open() using an index determined from the call to CP210x_GetNumDevices(). The handle will be used for all subsequent accesses. When I/O operations are complete, the device handle is closed by a call to CP210x_Close(). When programming a CP2105 device to configure the mode, the following functions must be called in the following order: CP210x_SetDeviceMode() CP210x_SetDualPortConfig() The remaining functions are provided to allow access to customizable values contained in the CP210x programmable area. 6.1.1. CP210x_GetNumDevices Description: This function returns the number of CP210x devices connected to the host. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetNumDevices( LPDWORD NumDevices ) Parameters: 1. NumDevices—Address of a DWORD that will contain the number of devices. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_DEVICE_NOT_FOUND, CP210x_INVALID_PARAMETER 6.1.2. CP210x_GetProductString Description: This function returns a NULL-terminated serial number (S/N) string, product description string, or full path string for the device specified by an index passed in the DeviceNum parameter. The index of the first device is 0, and the index of the last device is the value (NumDevices) returned by CP210x_GetNumDevices() – 1. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetProductString( DWORD DeviceNum, LPVOID DeviceString, DWORD Options ) Parameters: 1. DeviceNum—Index of the device for which the product description string, serial number, or full path is desired. 2. DeviceString—Variable of type CP210x_DEVICE_STRING returning the NULL-terminated serial number, device description or full path string. 3. Options—Flag that determines if DeviceString contains the product description, serial number, or full-path string. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_DEVICE_NOT_FOUND, CP210x_INVALID_PARAMETER 26 Rev. 1.2 AN721 6.1.3. CP210x_GetPartNumber Description: Returns the 1-byte Part Number contained in a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS WINAPI CP210x_GetPartNumber(HANDLE cyHandle, LPBYTE lpbPartNum); Parameters: 1. Handle—Handle to the device returning a Part Number. 2. PartNum—Pointer to a 1-byte value returning the Part Number of the device. A CP210x_CP2101_DEVICE denotes a CP2101 device, and a CP210x_CP2102_DEVICE denotes a CP2102 device. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.4. CP210x_Open Description: Opens and returns a handle to a device using a device number determined by the number returned from CP210x_GetNumDevices(). Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_Open( DWORD DeviceNum, HANDLE* Handle ) Parameters: 1. DeviceNum—Device index. 0 for the first device, 1 for the second, etc. 2. Handle—Pointer to a variable where the handle to the device will be stored. This handle will be used for all subsequent accesses to the device. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_DEVICE_NOT_FOUND, CP210x_INVALID_PARAMETER 6.1.5. CP210x_Close Description: Closes an open device handle. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_Close( HANDLE Handle ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE Rev. 1.2 27 AN721 6.1.6. CP210x_SetVid Description: Sets the 2-byte Vendor ID field of the Device Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetVid( HANDLE Handle, WORD Vid ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. VID—2-byte Vendor ID value. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.7. CP210x_SetPid Description: Sets the 2-byte Product ID field of the Device Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetPid( HANDLE Handle, WORD Pid ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. PID—2-byte Product ID value. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.8. CP210x_SetProductString Description: Sets the Product Description String of the String Descriptor of a CP210x device. If the string is not already in Unicode format, the function will convert the string to Unicode before committing it to programmable memory. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN or CP2105_MAX_PRODUCT_STRLEN. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetProductString( HANDLE Handle, LPVOID Product, BYTE Length, BOOL ConvertToUnicode=TRUE ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. Product—Buffer containing the Product String value. 3. Length—Length of the string in characters (not bytes), NOT including a NULL terminator. 4. ConvertToUnicode—Boolean flag that tells the function if the string needs to be converted to Unicode. The flag is set to TRUE by default (i.e., the string is in ASCII format and needs to be converted to Unicode). 28 Rev. 1.2 AN721 Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.9. CP210x_SetInterfaceString Description: Sets the Interface String for the one of the interfaces available on the CP2105 or CP2108. If the string is not already in Unicode format, the function will convert the string to Unicode before committing it to programmable memory. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP2105_MAX_INTERFACE_STRLEN. Supported Devices: CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetInterfaceString( HANDLE Handle, BYTE InterfaceNumber, LPVOID Interface, BYTE Length, BOOL ConvertToUnicode) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. InterfaceNumber—Set to 0 for Enhanced Interface String, or 1 for Standard Interface String on the CP2105. 0-3 for the CP2108 which has 4 interfaces. 3. Interface—Buffer containing the Interface String. 4. Length—Length of the string in characters (not bytes), NOT including a NULL terminator. 5. ConvertToUnicode—Boolean flag that tells the function if the string needs to be converted to Unicode. The flag is set to TRUE by default (i.e., the string is in ASCII format and needs to be converted to Unicode). Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.10. CP210x_SetSerialNumber Description: Sets the Serial Number String of the String Descriptor of a CP210x device. If the string is not already in Unicode format, the function will convert the string to Unicode before committing it to programmable memory. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_SERIAL_STRLEN. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetSerialNumber( HANDLE Handle, LPVOID SerialNumber, BYTE Length, BOOL ConvertToUnicode=TRUE ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. SerialNumber—Buffer containing the Serial Number String value. 3. Length—Length in characters (not bytes), NOT including a NULL terminator. 4. ConvertToUnicode—Boolean flag that tells the function if the string needs to be converted to Unicode. The flag is set to TRUE by default, i.e. the string is in ASCII format and needs to be converted to Unicode. Rev. 1.2 29 AN721 Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.11. CP210x_SetSelfPower Description: Sets or clears the Self-Powered bit of the Power Attributes field of the Configuration Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetSelfPower( HANDLE Handle, BOOL SelfPower ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. SelfPower—Boolean flag where TRUE means set the Self-Powered bit, and FALSE means clear the Self-Powered bit. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.12. CP210x_SetMaxPower Description: Sets the Max Power field of the Configuration Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetMaxPower( HANDLE Handle, BYTE MaxPower ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. MaxPower—1-byte value representing the maximum power consumption of the CP210x USB device, expressed in 2 mA units. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.13. CP210x_SetFlushBufferConfig Description: Sets the Flush Buffer configuration of a CP210x device. Supported Devices: CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetMaxPower( HANDLE Handle, BYTE FlushBufferConfig ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. FlushBufferConfig—Set to determine which buffer(s) to flush (TX and/or RX) and upon which event (Open and/or Close). See the header file for the bit defintions for this byte value. 30 Rev. 1.2 AN721 Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_FUNCTION_NOT_SUPPORTED CP210x_DEVICE_NOT_FOUND 6.1.14. CP210x_SetDeviceMode Description: Sets the operating mode (GPIO or Modem) or each Interface of a CP210x device. Supported Devices: CP2105 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetMaxPower( HANDLE Handle, BYTE DeviceModeECI, BYTE DeviceModeSCI) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. DeviceModeECI—Set to 0 for modem mode for Enhanced interface. Set to 1 for GPIO mode. 3. DeviceModeSCI—Set to 0 for modem mode for Enhanced interface. Set to 1 for GPIO mode. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_NOT_FOUND CP210x_FUNCTION_NOT_SUPPORTED 6.1.15. CP210x_SetDeviceVersion Description: Sets the Device Release Version field of the Device Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetDeviceVersion( HANDLE Handle, WORD Version ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. Version—2-byte Device Release Version number in Binary-Coded Decimal (BCD) format with the upper two nibbles containing the two decimal digits of the major version and the lower two nibbles containing the two decimal digits of the minor version. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.16. CP210x_SetBaudRateConfig Description: Sets the baud rate configuration data of a CP210x device. Supported Devices: CP2102, CP2103 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS WINAPI CP210x_SetBaudRateConfig(HANDLE cyHandle, BAUD_CONFIG* baudConfigData); Parameters: 1. Handle—Handle to the device from which to get the Part Number. Rev. 1.2 31 AN721 2. BaudConfigData—Pointer to a BAUD_CONFIG structure containing the Baud Config data to be set on the device. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.17. CP210x_SetLockValue Description: Sets the 1-byte Lock Value of a CP210x device. Supported Devices: CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS WINAPI CP210x_SetLockValue(HANDLE cyHandle); Parameters: 1. Handle—Handle of the device to lock. This will permanently set the lock value to 0x01. WARNING: Setting the lock value locks ALL customizable data and cannot be reset; only use this function to keep all customizable data on the part permanently. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.18. CP210xSetPortConfig Description: Sets the current port pin configuration from the CP210x device. Supported Devices: CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210X_STATUS Parameters: 1. Handle—Handle to the device as returned by CP210x_Open() CP210x_SetPortConfig(HANDLE Handle, LPVOID PortConfig) 2. PortConfig—Pointer to a PORT_CONFIG structure Return Value: CP210X_STATUS = CP210X_SUCCESS, CP210X_INVALID_HANDLE, CP210X_DEVICE_IO_FAILED, CP210X_UNSUPPORTED_DEVICE 32 Rev. 1.2 AN721 6.1.19. CP210xSetDualPortConfig Description: Sets the current port pin configuration from the CP210x device. SetDeviceMode() must be called before calling this function. Supported Devices: CP2105 Location: CP210x Manufacturing DLL Prototype: CP210X_STATUS fig) Parameters: 1. Handle—Handle to the device as returned by CP210x_Open() CP210x_SetPortConfig(HANDLE Handle, LPVOID DualPortCon- 2. DualPortConfig—Pointer to a DUAL_PORT_CONFIG structure Return Value: CP210X_STATUS = CP210X_SUCCESS, CP210X_INVALID_HANDLE, CP210X_DEVICE_IO_FAILED, CP210X_UNSUPPORTED_DEVICE 6.1.20. CP210x_GetDeviceProductString Description: Returns the Product Description String of the String Descriptor of a CP210x device. If the ConvertToASCII parameter is set, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetDeviceProductString( HANDLE Handle, LPVOID Product, LPBYTE Length, BOOL ConvertToASCII=TRUE ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. Product—Pointer to a buffer returning the Product String value. 3. Length—Pointer to a BYTE value returning the length of the string in characters (not bytes), NOT including a NULL terminator. 4. ConvertToASCII—Boolean flag that tells the function whether the string needs to be converted to ASCII before it is returned to the caller. The flag is set to TRUE by default (i.e., the caller is expecting the string in ASCII format). Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.21. CP210xSetQuadPortConfig Description: Sets the current port pin configuration from the CP2108 device. Supported Devices: CP2108 Location: CP210x Manufacturing DLL Rev. 1.2 33 AN721 Prototype: CP210x_STATUS CP210x_SetQuadPortConfig( HANDLE Handle, LPVOID QuadPortConfig ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. QuadPortConfig—Pointer to a QUAD_PORT_CONFIG structure. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED, CP210x_UNSUPPORTED_DEVICE 6.1.22. CP210x_GetDeviceInterfaceString Description: Gets the specified interface string from a CP210x device. If the ConvertToASCII parameter is set, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_SERIAL_STRLEN. Supported Devices: CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetDeviceInterfaceString( HANDLE Handle, BYTE InterfaceNumber, LPVOID Interface, BYTE Length, BOOL ConvertToASCII) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. InterfaceNumber —Set to 0 for Enhanced Interface. Set to 1 for Standard Interface. 3. Interface—Pointer to buffer returning the selected Interface String value. 4. Length—Pointer to a BYTE value returning the length of the string in characters (not bytes), NOT including a NULL terminator. 5. ConvertToASCII—Boolean flag that tells the function whether the string needs to be converted to ASCII before it is returned to the caller. The flag is set to TRUE by default (i.e., the caller is expecting the string in ASCII format). Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.23. CP210x_GetDeviceSerialNumber Description: Gets the Serial Number String of the String Descriptor of a CP210x device. If the ConvertToASCII parameter is set, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_SERIAL_STRLEN. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetDeviceSerialNumber( HANDLE Handle, LPVOID SerialNumber, LPBYTE Length, BOOL ConvertToASCII=TRUE ) 34 Rev. 1.2 AN721 Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. SerialNumber —Pointer to a buffer returning the Serial Number String value. 3. Length—Pointer to a BYTE value returning the length of the string in characters (not bytes), NOT including a NULL terminator. 4. ConvertToASCII—Boolean flag that tells the function whether the string needs to be converted to ASCII before it is returned to the caller. The flag is set to TRUE by default (i.e., the caller is expecting the string in ASCII format). Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.24. CP210x_GetDeviceVid Description: Returns the 2-byte Vendor ID field of the Device Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetDeviceVid( HANDLE Handle, LPWORD Vid ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. VID—Pointer to a 2-byte value that returns the Vendor ID of the CP210x device. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.25. CP210x_GetDevicePid Description: Returns the 2-byte Product ID field of the Device Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetDevicePid( HANDLE Handle, LPWORD Pid ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. PID—Pointer to a 2-byte value that returns the Product ID of the CP210x device. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED Rev. 1.2 35 AN721 6.1.26. CP210x_GetSelfPower Description: Returns the state of the Self-Powered bit of the Power Attributes field of the Configuration Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetSelfPower( HANDLE Handle, LPBOOL SelfPower ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. SelfPower—Pointer to a boolean flag where TRUE means the Self-Powered bit is set, and FALSE means the Self-Powered bit is cleared. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.27. CP210x_GetMaxPower Description: Returns the 1-byte Max Power field of the Configuration Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetMaxPower( HANDLE Handle, LPBYTE MaxPower ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. MaxPower—Pointer to a 1-byte value returning the Maximum power consumption of the CP210x USB device expressed in 2 mA units. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.28. CP210x_GetMaxPower Description: Returns the 1-byte Max Power field of the Configuration Descriptor of a CP210x device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetMaxPower( HANDLE Handle, LPBYTE MaxPower ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. MaxPower—Pointer to a 1-byte value returning the Maximum power consumption of the CP210x USB device expressed in 2 mA units. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, 36 Rev. 1.2 AN721 CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.29. CP210x_GetFlushBufferConfig Description: Returns the flush buffer configuration of a CP210x device. Supported Devices: CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_GetFlushBufferConfig( HANDLE Handle, LPWORD FlushBufferConfig ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. FlushBufferConfig—Pointer to the values which indicates which buffer(s) are flushed (TX and/ or RX) and upon which event (Open and/or Close). See the header file for the bit defintions for this byte value. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_DEVICE_NOT_FOUND, CP210x_INVALID_HANDLE, CP210x_FUNCTION_NOT_SUPPORTED 6.1.30. CP210x_GetDeviceMode Description: Gets the operating mode (GPIO or Modem) or each Interface of a CP210x device. Supported Devices: CP2105 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_SetMaxPower( HANDLE Handle, BYTE DeviceModeECI, BYTE DeviceModeSCI) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). 2. DeviceModeECI—Pointer to a 1-byte value returning the 0 if interface is in Modem mode, or 1 if GPIO mode. 3. DeviceModeSCI—Pointer to a 1-byte value returning the 0 if interface is in Modem mode, or 1 if GPIO mode. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_NOT_FOUND CP210x_FUNCTION_NOT_SUPPORTED 6.1.31. CP210x_GetBaudRateConfig Description: Returns the baud rate configuration data of a CP210x device. Supported Devices: CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Rev. 1.2 37 AN721 Prototype: CP210x_STATUS WINAPI CP210x_GetBaudRateConfig(HANDLE cyHandle, BAUD_CONFIG* baudConfigData); Parameters: 1. Handle—Handle to the device on which to determine the lock value. 2. BaudConfigData—Pointer to a BAUD_CONFIG structure returning the Baud Config data of the device. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.32. CP210x_GetLockValue Description: Returns the 1-byte Lock Value of a CP210x device. Supported Devices: CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS WINAPI CP210x_GetLockValue(HANDLE cyHandle, LPBYTE lpbLockValue); Parameters: 1. Handle—Handle to the device on which to determine the lock value. 2. LockValue—Pointer to a 1-byte value returning the Lock Value of the device. A 0x01 denotes that the device is locked, and a 0x00 denotes that the device is unlocked. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_PARAMETER, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.33. CP210x_GetPortConfig Description: Gets the current port pin configuration from the CP210x device. Supported Devices: CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210X_STATUS Parameters: 1. Handle—Handle to the device as returned by CP210x_Open() CP210x_GetPortConfig(HANDLE Handle, LPVOID PortConfig) 2. Port Config—Pointer to a PORT_CONFIG structure Return Value: CP210X_STATUS = CP210X_SUCCESS, CP210X_INVALID_HANDLE, CP210X_DEVICE_IO_FAILED, CP210X_UNSUPPORTED_DEVICE 38 Rev. 1.2 AN721 6.1.34. CP210xGetDualPortConfig Description: Gets the current port pin configuration from the CP210x device. Supported Devices: CP2105 Location: CP210x Manufacturing DLL Prototype: CP210X_STATUS fig) Parameters: 1. Handle—Handle to the device as returned by CP210x_Open() CP210x_SetPortConfig(HANDLE Handle, LPVOID DualPortCon- 2. DualPortConfig—Pointer to a DUAL_PORT_CONFIG structure Return Value: CP210X_STATUS = CP210X_SUCCESS, CP210X_INVALID_HANDLE, CP210X_DEVICE_IO_FAILED, CP210X_UNSUPPORTED_DEVICE 6.1.35. CP210x_Reset Description: Initiates a reset of the USB interface. Note: There is a delay of ~1 second before the reset is initiated by the device firmware to give the application time to call CP210x_Close() to close the device handle. No further operations should be performed with the device until it resets, reenumerates in Windows, and a new handle is opened. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Manufacturing DLL Prototype: CP210x_STATUS CP210x_Reset( HANDLE Handle ) Parameters: 1. Handle—Handle to the device to close as returned by CP210x_Open(). Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.1.36. CP210xGetQuadPortConfig Description: Gets the current port pin configuration from the CP210x device. Supported Devices: CP2105 Location: CP210x Manufacturing DLL Prototype: CP210X_STATUS fig) Parameters: 1. Handle—Handle to the device as returned by CP210x_Open() CP210x_SetPortConfig(HANDLE Handle, LPVOID DualPortCon- 2. DualPortConfig—Pointer to a DUAL_PORT_CONFIG structure Return Value: CP210X_STATUS = CP210X_SUCCESS, CP210X_INVALID_HANDLE, CP210X_DEVICE_IO_FAILED, CP210X_UNSUPPORTED_DEVICE Rev. 1.2 39 AN721 6.1.37. CP210x Manufacturing.DLL Type Definitions and Constants Type Definitions from C++ Header File CP210xManufacturingDLL.h // GetProductString() function flags #define CP210x_RETURN_SERIAL_NUMBER #define CP210x_RETURN_DESCRIPTION #define CP210x_RETURN_FULL_PATH 0x00 0x01 0x02 // GetDeviceVersion() return codes #define CP210x_CP2101_VERSION #define CP210x_CP2102_VERSION #define CP210x_CP2103_VERSION #define CP210x_CP2104_VERSION #define CP210x_CP2105_VERSION #define CP210x_CP2108_VERSION 0x01 0x02 0x03 0x04 0x05 0x06 // Return codes #define CP210x_SUCCESS #define CP210x_DEVICE_NOT_FOUND #define CP210x_INVALID_HANDLE #define CP210x_INVALID_PARAMETER #define CP210x_DEVICE_IO_FAILED #define CP210x_FUNCTION_NOT_SUPPORTED #define CP210x_GLOBAL_DATA_ERROR #define CP210x_FILE_ERROR #define CP210x_COMMAND_FAILED #define CP210x_INVALID_ACCESS_TYPE 0x00 0xFF 0x01 0x02 0x03 0x04 0x05 0x06 0x08 0x09 // Type definitions typedef int CP210x_STATUS; // Buffer size limits #define CP210x_MAX_DEVICE_STRLEN #define CP210x_MAX_PRODUCT_STRLEN #define CP210x_MAX_SERIAL_STRLEN #define CP210x_MAX_MAXPOWER 256 126 63 250 // Type definitions typedef char CP210x_DEVICE_STRING[CP210x_MAX_DEVICE_STRLEN]; typedef char CP210x_PRODUCT_STRING[CP210x_MAX_PRODUCT_STRLEN]; typedef char CP210x_SERIAL_STRING[CP210x_MAX_SERIAL_STRLEN]; //Baud Rate Aliasing definitions #define NUM_BAUD_CONFIGS 40 32 Rev. 1.2 AN721 typedef struct { WORD BaudGen; WORD Timer0Reload; BYTE Prescaler; DWORD BaudRate; } BAUD_CONFIG; #define BAUD_CONFIG_SIZE10 typedef BAUD_CONFIG BAUD_CONFIG_DATA[NUM_BAUD_CONFIGS]; //Port Config definitions typedef struct { WORD Mode; // Push-Pull = 1, Open-Drain = 0 WORD Reset_Latch; // Logic High = 1, Logic Low = 0 WORD Suspend_Latch;// Logic High = 1, Logic Low = 0 unsigned char EnhancedFxn; } PORT_CONFIG; // Define bit locations for Mode/Latch for Reset and Suspend structures #define PORT_RI_ON 0x0001 #define PORT_DCD_ON 0x0002 #define PORT_DTR_ON 0x0004 #define PORT_DSR_ON 0x0008 #define PORT_TXD_ON 0x0010 #define PORT_RXD_ON 0x0020 #define PORT_RTS_ON 0x0040 #define PORT_CTS_ON 0x0080 #define #define #define #define PORT_GPIO_0_ON PORT_GPIO_1_ON PORT_GPIO_2_ON PORT_GPIO_3_ON #define PORT_SUSPEND_ON #define PORT_SUSPEND_BAR_ON 0x0100 0x0200 0x0400 0x0800 0x4000 // 0x8000 // // Define bit locations for EnhancedFxn #define EF_GPIO_0_TXLED #define EF_GPIO_1_RXLED #define EF_GPIO_2_RS485 #define EF_RESERVED_0 #define EF_WEAKPULLUP #define EF_RESERVED_1 #define EF_SERIAL_DYNAMIC_SUSPEND #define EF_GPIO_DYNAMIC_SUSPEND 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80 Rev. 1.2 Can't configure latch value Can't configure latch value // // // // // // // // Under device control Under device control Under device control Reserved, leave bit 3 cleared Weak Pull-up on Reserved, leave bit 5 cleared For 8 UART/Modem signals For 4 GPIO signals 41 AN721 6.2. CP210xRuntime.DLL The CP210x Runtime API provides access to the GPIO port latch, and is meant for distribution with the product containing a CP210x device. CP210xRT_ReadLatch()—Returns the GPIO port latch of a CP210x device. CP210xRT_WriteLatch()—Sets the GPIO port latch of a CP210x device. CP210xRT_GetPartNumber()—Returns the 1-byte Part Number of a CP210x device. CP210xRT_GetProductString ()—Returns the product string programmed to the device. CP210xRT_GetDeviceSerialNumber ()—Returns the serial number programmed to the device. CP210xRT_GetDeviceInterfaceString ()—Returns the interface string programmed to the device. Typically, the user initiates communication with the target CP210x device by opening a handle to a COM port using CreateFile() (See AN197: Serial Communication Guide for CP210x). The handle returned allows the user to call the API functions listed above. Each of these functions are described in the following sections. Type definitions and constants are defined in the file CP210xRuntimeDLL.h. Note: Functions calls into this API are blocked until completed. This can take several milliseconds depending on USB traffic. 6.2.1. CP210xRT_ReadLatch Description: Gets the current port latch value from the device. Supported Devices: CP2103, CP2104, CP2105, CP2108 Location: CP210x Runtime DLL Prototype: CP210x_STATUS Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). CP210xRT_ReadLatch(HANDLE Handle, LPBYTE Latch) 2. Latch—Pointer for 1-byte return GPIO latch value [Logic High = 1, Logic Low = 0]. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED CP210x_FUNCTION_NOT_SUPPORTED 6.2.2. CP210xRT_WriteLatch Description: Sets the current port latch value for the device. Supported Devices: CP2103, CP2104, CP2105, CP2108 Location: CP210x Runtime DLL Prototype: CP210x_STATUS CP210xRT_WriteLatch(HANDLE Handle, BYTE Mask, BYTE Latch) Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). 2. Mask—Determines which pins to change [Change = 1, Leave = 0]. 3. Latch—1-byte value to write to GPIO latch [Logic High = 1, Logic Low = 0] Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED CP210x_FUNCTION_NOT_SUPPORTED 42 Rev. 1.2 AN721 6.2.3. CP210xRT_GetPartNumber Description: Gets the part number of the current device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Runtime DLL Prototype: CP210x_STATUS CP210xRT_GetPartNumber(HANDLE Handle, LPBYTE PartNum) Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). 2. PartNum—Pointer to a byte containing the return code for the part number. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED 6.2.4. CP210xRT_GetDeviceProductString Description: Gets the product string in the current device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Runtime DLL Prototype: CP210x_STATUS CP210xRT_GetDeviceProductString(HANDLE cyHandle, LPVOID lpProduct, LPBYTE lpbLength, BOOL bConvertToASCII = TRUE) Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). 2. lpProduct—Variable of type CP210x_PRODUCT_STRING returning the NULL terminated product string. 3. lpbLength—Length in characters (not bytes) not including a NULL terminator. 4. ConvertToASCII—Boolean that determines whether the string should be left in Unicode, or converted to ASCII. This parameter is true by default, and will convert to ASCII. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED CP210x_INVALID_PARAMETER 6.2.5. CP210xRT_GetDeviceSerialNumber Description: Gets the serial number in the current device. Supported Devices: CP2101, CP2102, CP2103, CP2104, CP2105, CP2108 Location: CP210x Runtime DLL Prototype: CP210x_STATUS CP210xRT_GetDeviceSerialNumber(HANDLE cyHandle, LPVOID lpProduct, LPBYTE lpbLength, BOOL bConvertToASCII = TRUE) Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). 2. lpProduct—Variable of type CP210x_SERIAL_STRING returning the NULL terminated serial string. 3. lpbLength—Length in characters (not bytes) not including a NULL terminator. Rev. 1.2 43 AN721 4. ConvertToASCII—Boolean that determines whether the string should be left in Unicode, or converted to ASCII. This parameter is true by default, and will convert to ASCII. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED CP210x_INVALID_PARAMETER 6.2.6. CP210xRT_GetDeviceInterfaceString Description: Gets the interface string of the current device. Supported Devices: CP2105, CP2108 Location: CP210x Runtime DLL Prototype: CP210x_STATUS CP210xRT_GetDeviceInterfaceString(HANDLE cyHandle, LPVOID lpInterfaceString, LPBYTE lpbLength, BOOL bConvertToASCII = TRUE) Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). 2. lpInterfaceString—Variable of type CP210x_SERIAL_STRING returning the NULL terminated interface string. 3. lpbLength—Length in characters (not bytes) not including a NULL terminator. 4. ConvertToASCII—Boolean that determines whether the string should be left in Unicode, or converted to ASCII. This parameter is true by default, and will convert to ASCII. Return Value: CP210x_STATUS = CP210x_SUCCESS, CP210x_INVALID_HANDLE, CP210x_DEVICE_IO_FAILED CP210x_INVALID_PARAMETER 44 Rev. 1.2 AN721 CONTACT INFORMATION Silicon Laboratories Inc. 400 West Cesar Chavez Austin, TX 78701 Tel: 1+(512) 416-8500 Fax: 1+(512) 416-9669 Toll Free: 1+(877) 444-3032 Please visit the Silicon Labs Technical Support web page: https://www.silabs.com/support/pages/contacttechnicalsupport.aspx and register to submit a technical support request. Patent Notice Silicon Labs invests in research and development to help our customers differentiate in the market with innovative low-power, small size, analogintensive mixed-signal solutions. Silicon Labs' extensive patent portfolio is a testament to our unique approach and world-class engineering team. The information in this document is believed to be accurate in all respects at the time of publication but is subject to change without notice. Silicon Laboratories assumes no responsibility for errors and omissions, and disclaims responsibility for any consequences resulting from the use of information included herein. Additionally, Silicon Laboratories assumes no responsibility for the functioning of undescribed features or parameters. Silicon Laboratories reserves the right to make changes without further notice. Silicon Laboratories makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Silicon Laboratories assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Silicon Laboratories products are not designed, intended, or authorized for use in applications intended to support or sustain life, or for any other application in which the failure of the Silicon Laboratories product could create a situation where personal injury or death may occur. Should Buyer purchase or use Silicon Laboratories products for any such unintended or unauthorized application, Buyer shall indemnify and hold Silicon Laboratories harmless against all claims and damages. Silicon Laboratories and Silicon Labs are trademarks of Silicon Laboratories Inc. Other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders. Rev. 1.2 45