DATASHEET SEARCH SITE | WWW.ALLDATASHEET.COM

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 7

Technical content

Some CP210x devices include GPIO pins that can be co ntrolled by the PC using a Dynamic Link Library (DLL). based software access to the CP210x device’s GPIO latch using the USB connection as shown in Figure 1. Figure 1. Main Window number, product string, and serial number. the current GPIO pin state of the device.

2 Rev. 0.5 2. Creating Custom Applications using CP210xRuntime.DLL Custom applications can use the CP 210x Runtime API implemented in CP210xRuntime.DLL. To use functions implemented in CP210xRuntime.DLL, link CP210xRuntime.LIB with your Visual C++ 6.0 application. Include CP210xRuntimeDLL.h in any file that calls functions implemented in CP210xRuntime.DLL. 3. CP210x Runtime API Functions 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 stri ng 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 is 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. 3.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 CP210xRT_ReadLatch(HANDLE Handle, LPWORD Latch) Parameters: 1. Handle—Handle to the Com port returned by CreateFile(). 2. Latch—Pointer for 4-byte re turn 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

Rev. 0.5 3 3.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, WORD Mask, WORD 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—4-byte value to wr ite 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 3.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

4 Rev. 0.5 3.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_PRO DUCT_STRING returni ng the NULL terminated product string. 3. lpbLength—Length in characters (not bytes) not including a NULL terminator. 4. ConvertToASCII—Boolean that determines whet her 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 3.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_S TRING returning the NULL terminated serial string. 3. lpbLength—Length in characters (not bytes) not including a NULL terminator. 4. ConvertToASCII—Boolean that determines whet her 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

Rev. 0.5 5 3.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 whet her 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 Rev. 0.5 DOCUMENT CHANGE LIST Revision 0.1 to Revision 0.2  Reworded Open Drain Output description for clarity Revision 0.2 to Revision 0.3  Added CP210xRT_GetProductString  Added CP210xRT_GetDeviceSerialNumber  Added CP210xRT_GetDeviceProductString Revision 0.3 to Revision 0.4  Added support for CP2104 and CP2105  Added CP210xRT_GetDeviceInterfaceString  Added Table 3 and Table 4  Added Section 5.6. CP2105 GPIO Mode and Modem Mode  Removed the Appendix Revision 0.4 to Revision 0.5  Removed sections regarding port configuration.  Updated interfaces to ReadLatch and WriteLatch from BYTE/LPBYTE to WORD/LPWORD.  Added CP2108 as a supported device to all functions.

Rev. 0.5 7 CONTACT INFORMATION

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, analog- intensive mixed-signal solutions. Silicon Labs' extensive patent portfolio is a testament to our unique approach and world-class engineering team Silicon Laboratories, Silicon Labs, and USBXpress are trademarks of Silicon Laboratories Inc. Other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders. 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, rep- resentation 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 conse- quential 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 per- sonal injury or death may occur. Should Buyer purchase or use Silicon Laboratories products for any such unintended or unauthorized ap- plication, Buyer shall indemnify and hold Silicon Laboratories harmless against all claims and damages.