Silicon Labs Host Libraries
CP201x Manufacturing Library

Modules

 Deprecated Confused Version Part Numbers
 
 CP210x Status Codes - manufacturing
 API Status return codes.
 
 definitions
 
 Baud Rate Aliasing definitions
 
 Flush Buffer definitions
 
 Port Config definitions
 
 Dual Port Config definitions
 
 Quad Port Config definitions
 

Data Structures

struct  pFirmware_t
 
struct  _firmware_t
 firmware version. Alias of this struct is firmware_t More...
 

Macros

#define CP210xDLL_API
 CP210xDLL_API. More...
 
#define WINAPI
 WINAPI. More...
 
#define CP2102N_MAX_
 tbd More...
 
#define CP210x_MAX_MAXPOWER   250
 TBD Unused in Manufacturing library. More...
 

Typedefs

typedef enum _CP210X_GETPRODUCTSTRING * PCP210X_GETPRODUCTSTRING
 define CP210X_GETPRODUCTSTRING function flags More...
 
typedef char CP210x_DEVICE_STRING[256]
 CP210x Device string. More...
 
typedef char CP210x_MANUFACTURER_STRING[45]
 CP210x Manufacture string. More...
 
typedef char CP210x_PRODUCT_STRING[126]
 CP210x Product string. More...
 
typedef char CP210x_SERIAL_STRING[63]
 CP210x Serial string. More...
 
typedef char CP2105_INTERFACE_STRING[32]
 CP2105 Interface string. More...
 
typedef char CP2108_INTERFACE_STRING[126]
 CP2108 Interface string. More...
 

Enumerations

enum  CP210X_GETPRODUCTSTRING {
  CP210x_GETPRODUCTSTRING_SERIAL_NUMBER = 0x00, CP210x_GETPRODUCTSTRING_DESCRIPTION = 0x01, CP210x_GETPRODUCTSTRING_FULL_PATH = 0x02, CP210x_RETURN_SERIAL_NUMBER = CP210x_GETPRODUCTSTRING_SERIAL_NUMBER,
  CP210x_RETURN_DESCRIPTION = CP210x_GETPRODUCTSTRING_DESCRIPTION, CP210x_RETURN_FULL_PATH = CP210x_GETPRODUCTSTRING_FULL_PATH
}
 CP210x_GetProductString() function flags More...
 

Functions

CP210x_STATUS CP210x_GetNumDevices (uint32_t *lpdwNumDevices)
 Determines the number of CP210x devices connected to the system. More...
 
CP210x_STATUS CP210x_GetProductString (const uint32_t dwDeviceIndex, void *lpvProductString, const uint32_t dwFlags)
 Gets a "Product string". More...
 
CP210x_STATUS CP210x_GetProductStringSafe (const uint32_t dwDeviceIndex, const CP210X_GETPRODUCTSTRING WhichProductStringToReturn, wchar_t *pProductString, const size_t ProductStringLenInBytes)
 Gets a "Product string". More...
 
CP210x_STATUS CP210x_Open (const uint32_t DeviceIndex, PHANDLE pcyHandle)
 Opens a handle to the device. More...
 
CP210x_STATUS CP210x_Close (const HANDLE cyHandle)
 Closes an open handle to the device. More...
 
CP210x_STATUS CP210x_GetPartNumber (const HANDLE cyHandle, uint8_t *lpbPartNum)
 Reads and returns the Part Number from the device. More...
 
CP210x_STATUS CP210x_SetVid (const HANDLE cyHandle, const uint16_t Vid)
 Sets the Vendor ID field of the device's USB Device Descriptor. More...
 
CP210x_STATUS CP210x_SetPid (const HANDLE cyHandle, const uint16_t Pid)
 Sets the Product ID field of the device's USB Device Descriptor. More...
 
CP210x_STATUS CP210x_SetManufacturerString (const HANDLE cyHandle, void *lpvManufacturerString, const uint8_t bManufacturerStringLength, const BOOL bIsStringASCII=TRUE)
 Sets the Manufacturer Description String of the device's USB Device Descriptor's iManufacturer USB String Descriptor. More...
 
CP210x_STATUS CP210x_SetProductString (const HANDLE cyHandle, void *lpvProductString, const uint8_t bProductStringLength, const BOOL bIsStringASCII=TRUE)
 Sets the Product Description String of the device's USB Device Descriptor's iProduct USB String Descriptor. More...
 
CP210x_STATUS CP210x_SetInterfaceString (const HANDLE cyHandle, const uint8_t bInterfaceNumber, void *lpvInterfaceString, const uint8_t bInterfaceStringLength, const BOOL bIsStringASCII)
 Sets the Interface Description String of the device's specified interface's iInterface USB String Descriptor. More...
 
CP210x_STATUS CP210x_SetSerialNumber (const HANDLE cyHandle, void *lpvSerialNumberString, const uint8_t bSerialNumberStringLength, const BOOL bIsStringASCII=TRUE)
 Sets the Serial Number Description String of the device's USB Device Descriptor's iSerialNumber USB String Descriptor. More...
 
CP210x_STATUS CP210x_SetSelfPower (const HANDLE cyHandle, const BOOL bSelfPower)
 Sets or clears the Self-Powered bit of the Power Attributes field of the USB Configuration Descriptor on the device. More...
 
CP210x_STATUS CP210x_SetMaxPower (const HANDLE cyHandle, const uint8_t bMaxPower)
 Sets the Max Power field of the USB Configuration Descriptor of the device. More...
 
CP210x_STATUS CP210x_SetFlushBufferConfig (const HANDLE cyHandle, const uint16_t wFlushBufferConfig)
 Sets the Flush Buffer configuration of the device. More...
 
CP210x_STATUS CP210x_SetDeviceMode (const HANDLE cyHandle, const uint8_t bDeviceModeECI, const uint8_t bDeviceModeSCI)
 Sets the operating mode (GPIO or Modem) of each Interface of the device. More...
 
CP210x_STATUS CP210x_SetDeviceVersion (const HANDLE cyHandle, const uint16_t wVersion)
 Sets the Device Release Version field of the USB Device Descriptor of the device. More...
 
CP210x_STATUS CP210x_SetBaudRateConfig (const HANDLE cyHandle, PBAUD_CONFIG pBaudConfig)
 Sets the baud rate configuration data of the device. More...
 
void _ConfigLatchRS485 (BYTE partNum, PORT_CONFIG *PortConfig, uint16_t &Temp_Reset_Latch, uint16_t &Temp_Suspend_Latch)
 overwrite latch value if in RS485 mode More...
 
CP210x_STATUS CP210x_SetPortConfig (const HANDLE cyHandle, PORT_CONFIG *pPortConfig)
 Sets the current port pin configuration from the device. More...
 
CP210x_STATUS CP210x_SetDualPortConfig (const HANDLE cyHandle, DUAL_PORT_CONFIG *pDualPortConfig)
 Sets the current port pin configuration from the device. More...
 
CP210x_STATUS CP210x_SetQuadPortConfig (const HANDLE cyHandle, QUAD_PORT_CONFIG *pQuadPortConfig)
 Sets the current port pin configuration from the device. More...
 
CP210x_STATUS CP210x_SetLockValue (const HANDLE cyHandle)
 Sets the Lock Value of a device – prevents all future customizing of the device. More...
 
CP210x_STATUS CP210x_GetDeviceVid (const HANDLE cyHandle, uint16_t *lpwVid)
 Reads and returns the 2-byte Vendor ID from the USB Device Descriptor from the device. More...
 
CP210x_STATUS CP210x_GetDevicePid (const HANDLE cyHandle, uint16_t *lpwPid)
 Reads and returns the 2-byte Product ID from the USB Device Descriptor from the device. More...
 
CP210x_STATUS CP210x_GetDeviceManufacturerString (const HANDLE cyHandle, void *pManufacturerString, uint8_t *lpbManufacturerStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
 Read and return the USB Device Descriptor's iManufacturer USB String Descriptor string. More...
 
CP210x_STATUS CP210x_GetDeviceProductString (const HANDLE cyHandle, void *pProductString, uint8_t *lpbProductStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
 Read and return the USB Device Descriptor's iProduct USB String Descriptor string. More...
 
CP210x_STATUS CP210x_GetDeviceInterfaceString (const HANDLE cyHandle, const uint8_t bInterfaceNumber, void *pInterfaceString, uint8_t *lpbInterfaceStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
 Read and return the Interface Description USB String Descriptor string. More...
 
CP210x_STATUS CP210x_GetDeviceSerialNumber (const HANDLE cyHandle, void *pSerialNumberString, uint8_t *lpbSerialNumberStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
 Read and return the USB Device Descriptor's iSerialNumber USB String Descriptor string. More...
 
CP210x_STATUS CP210x_GetDeviceAddress (const HANDLE cyHandle, uint8_t *lpbAddress)
 Returns the USB Address of the device. More...
 
CP210x_STATUS CP210x_GetSelfPower (const HANDLE cyHandle, LPBOOL lpbSelfPower)
 Reads and returns the Self-Powered bit of the Power Attributes field of the USB Configuration Descriptor from the device. More...
 
CP210x_STATUS CP210x_GetMaxPower (const HANDLE cyHandle, uint8_t *lpbPower)
 Reads and returns the Max Power field of the USB Configuration Descriptor from the device. More...
 
CP210x_STATUS CP210x_GetFlushBufferConfig (const HANDLE cyHandle, uint16_t *lpwFlushBufferConfig)
 Reads and returns the Flush Buffer configuration from the device. More...
 
CP210x_STATUS CP210x_GetDeviceMode (const HANDLE cyHandle, uint8_t *lpbDeviceModeECI, uint8_t *lpbDeviceModeSCI)
 Reads and returns the operating mode (GPIO or Modem) of each Interface from the device. More...
 
CP210x_STATUS CP210x_GetDeviceVersion (const HANDLE cyHandle, uint16_t *lpwVersion)
 Reads and returns the Device Release Number (bcdDevice) Version USB Standard Device Descriptor from the device. More...
 
CP210x_STATUS CP210x_GetBaudRateConfig (const HANDLE cyHandle, PBAUD_CONFIG pBaudConfig)
 Reads and returns the Baud Rate Configuration from the device. More...
 
CP210x_STATUS CP210x_GetPortConfig (const HANDLE cyHandle, PPORT_CONFIG pPortConfig)
 Gets and returns the Port Configuration from the device. More...
 
CP210x_STATUS CP210x_GetDualPortConfig (const HANDLE cyHandle, DUAL_PORT_CONFIG *pDualPortConfig)
 Gets and returns the current Dual Port Configuration from the Dual Port device. More...
 
CP210x_STATUS CP210x_GetQuadPortConfig (const HANDLE cyHandle, QUAD_PORT_CONFIG *pQuadPortConfig)
 Gets and returns the current Quad Port Configuration from the Quad Port device. More...
 
CP210x_STATUS CP210x_GetLockValue (const HANDLE cyHandle, uint8_t *lpbLockValue)
 Reads and returns the Lock Value from the device. More...
 
CP210x_STATUS CP210x_Reset (const HANDLE cyHandle)
 Initiates a reset of the USB device. More...
 
CP210x_STATUS CP210x_CreateHexFile (const HANDLE cyHandle, LPCSTR lpvFileName)
 Create a hex file dump of TBD. More...
 
CP210x_STATUS CP210x_GetFirmwareVersion (const HANDLE cyHandle, pFirmware_t lpVersion)
 Reads and returns the Firmware Version from the device. More...
 
CP210x_STATUS CP210x_GetConfig (const HANDLE cyHandle, uint8_t *lpbConfig, const uint16_t bLength)
 Retrieves the current configuration from the device as a byte array. More...
 
CP210x_STATUS CP210x_SetConfig (const HANDLE cyHandle, uint8_t *lpbConfig, const uint16_t bLength)
 Program the device's configurable area with the given byte array. More...
 
CP210x_STATUS CP210x_UpdateFirmware (const HANDLE cyHandle)
 Requests device enter Bootloader mode. More...
 
CP210x_STATUS CP210x_GetGeneric (const HANDLE cyHandle, uint8_t *lpbGeneric, const uint16_t bLength)
 Issue a generic device-to-host USB command to the device. More...
 
CP210x_STATUS CP210x_SetGeneric (const HANDLE cyHandle, uint8_t *lpbGeneric, const uint16_t bLength)
 Issue a generic host-to-device USB command to the device. More...
 

Detailed Description

The Silicon Labs CP210x USB-to-UART bridges are devices that communicate over the Universal Serial Bus (USB) to perform Universal Asynchronous Receiver / Transmitter (UART) data transfers. These devices have many programmable options that can be configured via USB. These devices also often include flexible GPIO functions that can be configured and accessed via USB during runtime. Silicon Labs provides libraries that can be used to configure these devices and access their GPIOs.

Two interface library files can be used to interface with CP210x devices, CP210xManufacturing.DLL and .LIB, which is responsible for reading and writing the device settings, and CP210xRuntime.DLL and .LIB, which is responsible for interfacing with the device's GPIOs. The APIs for CP210xManufacturing are described below.

This document supercedes, obsoletes and takes precedences over AN978.

The CP210x Manufacturing Host API is provided as a means to facilitate production of customized CP210x devices. This API allows access to the CP210x device for retrieving and setting the VID, PID, product string, serial number, self - power attribute, maximum power consumption, and device version.

The CP210x Manufacturing Host API is provided in the form of a Windows Dynamic Link Library (DLL), CP210xManufacturing.DLL and as a Windows static link library (CP210xManufacturing.static.LIB). The host interface library communicates with the bridge controller device via the provided device driver and the operating system's USB stack.

Custom applications can use the CP210x Manufacturing API implemented in CP210xManufacturing.DLL. To use functions implemented in CP210xManufacturing.DLL link CP210xManufacturing.LIB include CP210xManufacturingDLL.h into any source code files that call any functions implemented in CP210xManufacturing.DLL and include the PATH to the location of CP210xManufacturing.DLL in your custom application Visual Studio .VCXPROJ Profile File's Properties->Linker->General->Additional Library Directories property.

Typically, 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().


Data Structure Documentation

◆ firmware_t

struct firmware_t
Data Fields
uint8_t build build number
uint8_t major major version number
uint8_t minor minor version number

◆ _firmware_t

struct _firmware_t

firmware version. Alias of this struct is firmware_t

Firmware version structure see CP210x_GetFirmwareVersion() Not writeable by OEMs or end-users. Automatically populated by build infrastructure

Macro Definition Documentation

◆ CP2102N_MAX_

#define CP2102N_MAX_

tbd

◆ CP210x_MAX_MAXPOWER

#define CP210x_MAX_MAXPOWER   250

TBD Unused in Manufacturing library.

◆ CP210xDLL_API

#define CP210xDLL_API

CP210xDLL_API.

◆ WINAPI

#define WINAPI

WINAPI.

Typedef Documentation

◆ CP2105_INTERFACE_STRING

typedef char CP2105_INTERFACE_STRING[32]

CP2105 Interface string.

◆ CP2108_INTERFACE_STRING

typedef char CP2108_INTERFACE_STRING[126]

CP2108 Interface string.

◆ CP210x_DEVICE_STRING

typedef char CP210x_DEVICE_STRING[256]

CP210x Device string.

◆ CP210x_MANUFACTURER_STRING

typedef char CP210x_MANUFACTURER_STRING[45]

CP210x Manufacture string.

◆ CP210x_PRODUCT_STRING

typedef char CP210x_PRODUCT_STRING[126]

CP210x Product string.

◆ CP210x_SERIAL_STRING

typedef char CP210x_SERIAL_STRING[63]

CP210x Serial string.

◆ PCP210X_GETPRODUCTSTRING

typedef enum _CP210X_GETPRODUCTSTRING * PCP210X_GETPRODUCTSTRING

define CP210X_GETPRODUCTSTRING function flags

Enumeration Type Documentation

◆ CP210X_GETPRODUCTSTRING

CP210x_GetProductString() function flags

Enumerator
CP210x_GETPRODUCTSTRING_SERIAL_NUMBER 

Serial Number string.

CP210x_GETPRODUCTSTRING_DESCRIPTION 

Description string a la "Friendly Name".

CP210x_GETPRODUCTSTRING_FULL_PATH 

Full Path string a la "Device Path" "A NULL-terminated string that contains the device interface path. This path can be passed to Win32 functions such as CreateFile(). ".

CP210x_RETURN_SERIAL_NUMBER 
Deprecated:
use CP210x_GETPRODUCTSTRING_SERIAL_NUMBER
CP210x_RETURN_DESCRIPTION 
Deprecated:
use CP210x_GETPRODUCTSTRING_DESCRIPTION
CP210x_RETURN_FULL_PATH 
Deprecated:
use CP210x_GETPRODUCTSTRING_FULL_PATH

Function Documentation

◆ _ConfigLatchRS485()

void _ConfigLatchRS485 ( BYTE  partNum,
PORT_CONFIG PortConfig,
uint16_t &  Temp_Reset_Latch,
uint16_t &  Temp_Suspend_Latch 
)

overwrite latch value if in RS485 mode

Parameters
[in]partNumis a number as returned by CP210x_GetPartNumber()
[in]pPortConfigis a pointer to a PORT_CONFIG structure

◆ CP210x_Close()

CP210x_STATUS CP210x_Close ( const HANDLE  cyHandle)

Closes an open handle to the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid

◆ CP210x_CreateHexFile()

CP210x_STATUS CP210x_CreateHexFile ( const HANDLE  cyHandle,
LPCSTR  lpvFileName 
)

Create a hex file dump of TBD.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpvFileNameis a file name to be always-created and written to
Note
supported on the CP2102, CP2103, and CP2109 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpvFileName is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support create a hex file dump from it
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetBaudRateConfig()

CP210x_STATUS CP210x_GetBaudRateConfig ( const HANDLE  cyHandle,
PBAUD_CONFIG  pBaudConfig 
)

Reads and returns the Baud Rate Configuration from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pBaudConfigis a pointer to a BAUD_CONFIG structure into which the Baud Rate Configuration will be written
Note
supported on the CP2102, CP2103 and CP2109 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pBaudConfig is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the Baud Rate Configuration

◆ CP210x_GetConfig()

CP210x_STATUS CP210x_GetConfig ( const HANDLE  cyHandle,
uint8_t *  lpbConfig,
const uint16_t  bLength 
)

Retrieves the current configuration from the device as a byte array.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbConfigpoints to a buffer into which the current configuration will be written
[in]bLengthis the number of bytes in the lpbConfig buffer
Note
supported on the CP2102N CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLEcyHandle is invalid
CP210x_INVALID_PARAMETERlpbConfig or bLength is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support reporting its Firmware Version
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceAddress()

CP210x_STATUS CP210x_GetDeviceAddress ( const HANDLE  cyHandle,
uint8_t *  lpbAddress 
)

Returns the USB Address of the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbAddresspoints to a 1-byte buffer into which the address will be written.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbAddress is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceInterfaceString()

CP210x_STATUS CP210x_GetDeviceInterfaceString ( const HANDLE  cyHandle,
const uint8_t  bInterfaceNumber,
void *  pInterfaceString,
uint8_t *  lpbInterfaceStringLengthInBytes,
const BOOL  bConvertToASCII = FALSE 
)

Read and return the Interface Description USB String Descriptor string.

If bConvertToASCII parameter is set/true, 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.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]bInterfaceNumberis Set to 0 for Enhanced Interface String, or 1 for Standard Interface String on the CP2105, or 0 - 3 for the CP2108 which has 4 interfaces.
[out]pInterfaceStringpoints at a buffer into which the Interface string will be written
[out]lpbInterfaceStringLengthInBytespoints at a 1-byte buffer into which the total number of bytes in the returned Interface string is returned.
[in]bConvertToASCIIis a true or false value indicating whether the device's 16-bit UCS-2 Interface string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false).
Note
supported on the IsMultiInterfacePartNum() CP2105 and CP2108 multi-interface CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– bInterfaceNumber, lpInterface or lpbInterfaceStringLengthInBytes is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceManufacturerString()

CP210x_STATUS CP210x_GetDeviceManufacturerString ( const HANDLE  cyHandle,
void *  pManufacturerString,
uint8_t *  lpbManufacturerStringLengthInBytes,
const BOOL  bConvertToASCII = FALSE 
)

Read and return the USB Device Descriptor's iManufacturer USB String Descriptor string.

Returns the Manufacturer Description string of the iManufacturer USB String Descriptor from the CP210x device. If bConvertToASCII parameter is set/true, 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.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pManufacturerStringpoints at a buffer into which the Manufacturer string will be written
[out]lpbManufacturerStringLengthInBytespoints at a 1-byte buffer into which the total number of bytes in the returned Manufacturer string is returned.
[in]bConvertToASCIIis a true or false value indicating whether the device's 16-bit UCS-2 Manufacturer string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false).
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpManufacturer or lpbManufacturerStringLengthInBytes is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceMode()

CP210x_STATUS CP210x_GetDeviceMode ( const HANDLE  cyHandle,
uint8_t *  lpbDeviceModeECI,
uint8_t *  lpbDeviceModeSCI 
)

Reads and returns the operating mode (GPIO or Modem) of each Interface from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbDeviceModeECIpoints to a 1-byte location into which the ECI mode will be written (0 if interface is in Modem mode, or 1 if GPIO mode)
[out]lpbDeviceModeSCIpoints to a 1-byte location into which the SCI mode will be written (0 if interface is in Modem mode, or 1 if GPIO mode)
Note
supported on the CP2105 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbDeviceModeECI or lpbDeviceModeSCI are unexpected values
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support device mode
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDevicePid()

CP210x_STATUS CP210x_GetDevicePid ( const HANDLE  cyHandle,
uint16_t *  lpwPid 
)

Reads and returns the 2-byte Product ID from the USB Device Descriptor from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpwPidpoints at a 2-byte buffer into which the PID will be written
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpwPid is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceProductString()

CP210x_STATUS CP210x_GetDeviceProductString ( const HANDLE  cyHandle,
void *  pProductString,
uint8_t *  lpbProductStringLengthInBytes,
const BOOL  bConvertToASCII = FALSE 
)

Read and return the USB Device Descriptor's iProduct USB String Descriptor string.

Returns the Product Description string of the iProduct USB String Descriptor from the CP210x device. If bConvertToASCII parameter is set/true, 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.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pProductStringpoints at a buffer into which the Product string will be written
[out]lpbProductStringLengthInBytespoints at a 1-byte buffer into which the total number of bytes in the returned Product string is returned.
[in]bConvertToASCIIis a true or false value indicating whether the device's 16-bit UCS-2 Product string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false).
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpProduct or lpbProductStringLengthInBytes is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceSerialNumber()

CP210x_STATUS CP210x_GetDeviceSerialNumber ( const HANDLE  cyHandle,
void *  pSerialNumberString,
uint8_t *  lpbSerialNumberStringLengthInBytes,
const BOOL  bConvertToASCII = FALSE 
)

Read and return the USB Device Descriptor's iSerialNumber USB String Descriptor string.

Returns the Serial Number string of the iSerialNumber USB String Descriptor from the CP210x device. If bConvertToASCII parameter is set/true, 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.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pSerialNumberStringpoints at a buffer into which the Serial Number string will be written
[out]lpbSerialNumberStringLengthInBytespoints at a 1-byte buffer into which the total number of bytes in the returned Serial Number string is returned.
[in]bConvertToASCIIis a true or false value indicating whether the device's 16-bit UCS-2 Serial Number string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false).
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpSerialNumber or lpbSerialNumberStringLengthInBytes is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceVersion()

CP210x_STATUS CP210x_GetDeviceVersion ( const HANDLE  cyHandle,
uint16_t *  lpwVersion 
)

Reads and returns the Device Release Number (bcdDevice) Version USB Standard Device Descriptor from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpwVersionpoints to a 2-byte buffer into which the Device Release Number (bcdDevice) Version will be written

The 2-byte Device Release Number (bcdDevice) Version will be returned 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.

Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpwVersion is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDeviceVid()

CP210x_STATUS CP210x_GetDeviceVid ( const HANDLE  cyHandle,
uint16_t *  lpwVid 
)

Reads and returns the 2-byte Vendor ID from the USB Device Descriptor from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpwVidpoints at a 2-byte buffer into which the VID will be written
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpwVid is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetDualPortConfig()

CP210x_STATUS CP210x_GetDualPortConfig ( const HANDLE  cyHandle,
DUAL_PORT_CONFIG pDualPortConfig 
)

Gets and returns the current Dual Port Configuration from the Dual Port device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pDualPortConfigis a pointer to a DUAL_PORT_CONFIG structure into which the Dual Port Configuration will be written and returned
Note
Supported Device/s: CP2105
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pDualPortConfig is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Dual Port Configuration
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetFirmwareVersion()

CP210x_STATUS CP210x_GetFirmwareVersion ( const HANDLE  cyHandle,
pFirmware_t  lpVersion 
)

Reads and returns the Firmware Version from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpVersionpoints to a firmware_t structure into which the Firmware Version will be written
Note
supported on the CP2102N, CP2105, and CP2108 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpVersion is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support reporting its Firmware Version
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetFlushBufferConfig()

CP210x_STATUS CP210x_GetFlushBufferConfig ( const HANDLE  cyHandle,
uint16_t *  lpwFlushBufferConfig 
)

Reads and returns the Flush Buffer configuration from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpwFlushBufferConfigpoints to a 2-byte buffer into which a bitmask to determine which buffer/s to flush (TX and/or RX) and upon which event (Open and/or Close). will be written
Note
FlushBufferConfig is a "pass through" value directly from the device, see Flush Buffer definitions
supported on CP2104, CP2105 and CP2108 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpwFlushBufferConfig is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Flush Buffer Config

◆ CP210x_GetGeneric()

CP210x_STATUS CP210x_GetGeneric ( const HANDLE  cyHandle,
uint8_t *  lpbGeneric,
const uint16_t  bLength 
)

Issue a generic device-to-host USB command to the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbGenericpoints to a buffer containing the USB command to be sent to the device
[in]bLengthis the number of bytes in the lpbGeneric buffer
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbGeneric or bLength is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support the specified comman
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetLockValue()

CP210x_STATUS CP210x_GetLockValue ( const HANDLE  cyHandle,
uint8_t *  lpbLockValue 
)

Reads and returns the Lock Value from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbLockValuepoints to a 1-byte buffer into which the Lock Value of the device will be written

A Lock Value of 0x00 denotes that the device is UNlocked, non-0x00 values indicate it is locked and prevented from all future customizing of the device.

Note
supported on the CP2102, CP2103, CP2104, CP2105, CP2108 and CP2109 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbLockValue is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Lock Value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetMaxPower()

CP210x_STATUS CP210x_GetMaxPower ( const HANDLE  cyHandle,
uint8_t *  lpbPower 
)

Reads and returns the Max Power field of the USB Configuration Descriptor from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbPowerpoints to a 1-byte buffer into which the Maximum power, expressed in 2mA units, will be written.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbPower is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetNumDevices()

CP210x_STATUS CP210x_GetNumDevices ( uint32_t *  lpdwNumDevices)

Determines the number of CP210x devices connected to the system.

Parameters
[out]lpdwNumDevicesa pointer to a uint32_t location to hold the returned device count
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_PARAMETER– lpdwNumDevices is an unexpected value

◆ CP210x_GetPartNumber()

CP210x_STATUS CP210x_GetPartNumber ( const HANDLE  cyHandle,
uint8_t *  lpbPartNum 
)

Reads and returns the Part Number from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open() or CreateFile()
[out]lpbPartNumpoints at a 1-byte buffer into which the SILABS_PARTNUM_CPXXXX Part Number value will be written
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbPartNum is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetPortConfig()

CP210x_STATUS CP210x_GetPortConfig ( const HANDLE  cyHandle,
PPORT_CONFIG  pPortConfig 
)

Gets and returns the Port Configuration from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pPortConfigis a pointer to a PORT_CONFIG structure into which the Port Configuration will be written and returned
Note
supported on the CP2103 and CP2104 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pPortConfig is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Port Configuration
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetProductString()

CP210x_STATUS CP210x_GetProductString ( const uint32_t  dwDeviceIndex,
void *  lpvProductString,
const uint32_t  dwFlags 
)

Gets a "Product string".

This function returns a NULL-terminated serial number string, product description string, or full path string for the device specified by an index passed in the dwDeviceIndex 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.

The full path string is the "device interface path" or "Device Path". This path can be passed to Win32 functions such as CreateFile().

The Serial Number string is derived from the "full path" string.

The Description string is either the "description of a device" Plug and Play device property from the Registry, if available, else the "friendly name of a device" Plug and Play device property from the Registry, if available, else the same "device interface path" returned for the "full path" string.

Returned strings are UCS-1?/ASCII and NULL-terminated. (verified)

Note
: This function may return cached data, or data from the device driver. To access the data from the device directly, use CP210x_GetDeviceProductString().
Length of lpvDeviceString must be <= CP210x_MAX_SETUP_STRING_SIZE
BUG: This is an string-UNSAFE function, not defensive against a "too small" buffer provided as the lpvDeviceString parameter.
Deprecated:
please use CP210x_GetProductStringSafe(In Pre_defensive const uint32_t dwDeviceIndex, In Pre_defensive const CP210X_RETURN_GETPRODUCTSTRING WhichProductStringToReturn, Out_writes_z(CP210x_MAX_DEVICE_STRLEN) Pre_defensive wchar_t *pProductString, In Pre_defensive const size_t ProductStringLenInBytes);
Parameters
[in]dwDeviceIndexis the desired device's index into the device list used to determine CP210x_GetNumDevices()
[out]lpvProductStringpoints at a buffer into which the "Product string" will be copied and returned
[in]dwFlagsis the indication of which "Product string" to return, one of CP210X_GETPRODUCTSTRING
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_PARAMETERlpvProductString or dwFlags is an unexpected value
CP210x_DEVICE_NOT_FOUND– the device specified by the dwDeviceIndex was not found

◆ CP210x_GetProductStringSafe()

CP210x_STATUS CP210x_GetProductStringSafe ( const uint32_t  dwDeviceIndex,
const CP210X_GETPRODUCTSTRING  WhichProductStringToReturn,
wchar_t *  pProductString,
const size_t  ProductStringLenInBytes 
)

Gets a "Product string".

This function returns a NULL-terminated serial number string, product description string, or full path string for the device specified by an index passed in the dwDeviceIndex 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.

The full path string is the "device interface path" or "Device Path". This path can be passed to Win32 functions such as CreateFile().

The Serial Number string is derived from the "full path" string.

The Description string is either the "description of a device" Plug and Play device property from the Registry, if available, else the "friendly name of a device" Plug and Play device property from the Registry, if available, else the same "device interface path" returned for the "full path" string.

Returned strings are UCS-2 and are NULL-terminated. (verified)

Note
: This function may return cached data, or data from the device driver. To access the data from the device directly, use CP210x_GetDeviceProductString().
Length of lpvDeviceString must be <= CP210x_MAX_SETUP_STRING_SIZE
Parameters
[in]dwDeviceIndexis the desired device's index into the device list used to determine CP210x_GetNumDevices()
[in]WhichProductStringToReturnis the indication of which "Product string" to return, one of CP210X_GETPRODUCTSTRING
[out]pProductStringpoints at a buffer into which the "Product string" will be copied and returned
[in]ProductStringLenInBytesis the size, in bytes/octets, of the buffer into which the the "Product string" will be copied and returned I.e. sizeof pProductString buffer
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_PARAMETER– lpvProductString or dwFlags is an unexpected value
CP210x_DEVICE_NOT_FOUND– the device specified by the dwDeviceIndex was not found

◆ CP210x_GetQuadPortConfig()

CP210x_STATUS CP210x_GetQuadPortConfig ( const HANDLE  cyHandle,
QUAD_PORT_CONFIG pQuadPortConfig 
)

Gets and returns the current Quad Port Configuration from the Quad Port device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]pQuadPortConfigis a pointer to a QUAD_PORT_CONFIG structure into which the Quad Port Configuration will be written and returned
Note
Supported Device/s: CP2108
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pQuadPortConfig is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Quad Port Configuration
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_GetSelfPower()

CP210x_STATUS CP210x_GetSelfPower ( const HANDLE  cyHandle,
LPBOOL  lpbSelfPower 
)

Reads and returns the Self-Powered bit of the Power Attributes field of the USB Configuration Descriptor from the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[out]lpbSelfPowerpoints to a buffer into which a Boolean flag where TRUE means the Self-Powered bit is set, and FALSE means the Self-Powered bit is clear will be written
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpbSelfPower is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_Open()

CP210x_STATUS CP210x_Open ( const uint32_t  DeviceIndex,
PHANDLE  pcyHandle 
)

Opens a handle to the device.

Opens and returns a handle to a device using a device index determined by the number returned from CP210x_GetNumDevices().

Close by passing the returned handle to CP210x_Close()

Parameters
[in]DeviceIndexis the desired device's zero-based index into the device list used to determine CP210x_GetNumDevices(). 0 for the first device, 1 for the second, etc.
[out]pcyHandleis a pointer to a HANDLE/4-byte location to hold the returned open handle to the device

The returned handle is used for all/most subsequent accesses to the device (I.e. the cyHandle parameter to all/most other API functions)

Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_PARAMETER– pcyHandle is an unexpected value
CP210x_DEVICE_NOT_FOUND– the device specified by the DeviceIndex was not found

◆ CP210x_Reset()

CP210x_STATUS CP210x_Reset ( const HANDLE  cyHandle)

Initiates a reset of the USB device.

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, re-enumerates in Windows, and a new handle is opened.
Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Reset
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetBaudRateConfig()

CP210x_STATUS CP210x_SetBaudRateConfig ( const HANDLE  cyHandle,
PBAUD_CONFIG  pBaudConfig 
)

Sets the baud rate configuration data of the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]pBaudConfigis a pointer to a BAUD_CONFIG structure containing the Baud Config data to be set on the device.
Note
supported on the CP2102, CP2103 and CP2109 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pBaudConfig is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the Baud Rate Configuration

◆ CP210x_SetConfig()

CP210x_STATUS CP210x_SetConfig ( const HANDLE  cyHandle,
uint8_t *  lpbConfig,
const uint16_t  bLength 
)

Program the device's configurable area with the given byte array.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpbConfigpoints to a buffer containing the configuration to be programmed to the device
[in]bLengthis the number of bytes in the lpbConfig buffer
Note
supported on the CP2102N CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLEcyHandle is invalid
CP210x_INVALID_PARAMETERlpbConfig or bLength is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support reporting its Firmware Version
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetDeviceMode()

CP210x_STATUS CP210x_SetDeviceMode ( const HANDLE  cyHandle,
const uint8_t  bDeviceModeECI,
const uint8_t  bDeviceModeSCI 
)

Sets the operating mode (GPIO or Modem) of each Interface of the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]bDeviceModeECISet to 0 for modem mode for Enhanced interface
[in]bDeviceModeSCISet to 0 for modem mode for Standard interface
Note
supported on the CP2105 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the Device Mode

◆ CP210x_SetDeviceVersion()

CP210x_STATUS CP210x_SetDeviceVersion ( const HANDLE  cyHandle,
const uint16_t  wVersion 
)

Sets the Device Release Version field of the USB Device Descriptor of the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]wVersionis the 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.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetDualPortConfig()

CP210x_STATUS CP210x_SetDualPortConfig ( const HANDLE  cyHandle,
DUAL_PORT_CONFIG pDualPortConfig 
)

Sets the current port pin configuration from the device.

Note
CP210x_SetDeviceMode() must be called before calling this function.
supported on the CP2105 dual-interface CP210x devices.
Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]pDualPortConfigis a pointer to a DUAL_PORT_CONFIG structure
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pDualPortConfig is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the port pin configuration

◆ CP210x_SetFlushBufferConfig()

CP210x_STATUS CP210x_SetFlushBufferConfig ( const HANDLE  cyHandle,
const uint16_t  wFlushBufferConfig 
)

Sets the Flush Buffer configuration of the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]wFlushBufferConfigis a 2-byte bitmask Set to determine which buffer/s to flush (TX and/or RX) and upon which event (Open and/or Close).
Note
wFlushBufferConfig is a "pass through" value directly to the device, see Flush Buffer definitions
supported on CP2104, CP2105 and CP2108 CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Flush Buffer Config

◆ CP210x_SetGeneric()

CP210x_STATUS CP210x_SetGeneric ( const HANDLE  cyHandle,
uint8_t *  lpbGeneric,
const uint16_t  bLength 
)

Issue a generic host-to-device USB command to the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpbGenericpoints to a buffer containing the USB command to be sent to the device
[in]bLengthis the number of bytes in the lpbGeneric buffer
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_SUCCESS– success
CP210x_INVALID_PARAMETER– lpbGeneric or bLength is an unexpected value
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support the specified comman
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetInterfaceString()

CP210x_STATUS CP210x_SetInterfaceString ( const HANDLE  cyHandle,
const uint8_t  bInterfaceNumber,
void *  lpvInterfaceString,
const uint8_t  bInterfaceStringLength,
const BOOL  bIsStringASCII 
)

Sets the Interface Description String of the device's specified interface's iInterface USB String Descriptor.

If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP2105_MAX_INTERFACE_STRLEN or CP2108_MAX_INTERFACE_STRLEN for the CP2105 and CP2108 devices respectively.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]bInterfaceNumberis 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.
[in]lpvInterfaceStringis a pointer to a buffer containing the Interface String value
[in]bInterfaceStringLengthis the length of the string in characters NOT including a NULL terminator.
[in]bIsStringASCIIis a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE.
Note
supported on the IsMultiInterfacePartNum() CP2105 and CP2108 multi-interface CP210x devices.
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them I.e. CP2105.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– bInterfaceNumber, lpvInterfaceString or bInterfaceStringLength is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– Only the CP2105 and CP2108 have (multiple) interfaces and thus interface strings

◆ CP210x_SetLockValue()

CP210x_STATUS CP210x_SetLockValue ( const HANDLE  cyHandle)

Sets the Lock Value of a device – prevents all future customizing of the device.

Note
: 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.
supported on the CP2102, CP2103, CP2104, CP2105, CP2108 and CP2109 CP210x devices.
Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the Lock Value

◆ CP210x_SetManufacturerString()

CP210x_STATUS CP210x_SetManufacturerString ( const HANDLE  cyHandle,
void *  lpvManufacturerString,
const uint8_t  bManufacturerStringLength,
const BOOL  bIsStringASCII = TRUE 
)

Sets the Manufacturer Description String of the device's USB Device Descriptor's iManufacturer USB String Descriptor.

If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_MANUFACTURER_STRLEN for the device type.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpvManufacturerStringis a pointer to a buffer containing the Manufacturer String value
[in]bManufacturerStringLengthis the length of the string in characters NOT including a NULL terminator.
[in]bIsStringASCIIis a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpvManufacturer or bManufacturerStringLength is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetMaxPower()

CP210x_STATUS CP210x_SetMaxPower ( const HANDLE  cyHandle,
const uint8_t  bMaxPower 
)

Sets the Max Power field of the USB Configuration Descriptor of the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]bMaxPoweris a 1-byte value representing the maximum power consumption of the CP210x USB device, expressed in 2 mA units.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetPid()

CP210x_STATUS CP210x_SetPid ( const HANDLE  cyHandle,
const uint16_t  Pid 
)

Sets the Product ID field of the device's USB Device Descriptor.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]Pidis the 2-byte Product ID value.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetPortConfig()

CP210x_STATUS CP210x_SetPortConfig ( const HANDLE  cyHandle,
PORT_CONFIG pPortConfig 
)

Sets the current port pin configuration from the device.

Note
supported on the CP2103 and CP2104 CP210x devices.
Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]pPortConfigis a pointer to a PORT_CONFIG structure
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pPortConfig is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the port pin configuration

◆ CP210x_SetProductString()

CP210x_STATUS CP210x_SetProductString ( const HANDLE  cyHandle,
void *  lpvProductString,
const uint8_t  bProductStringLength,
const BOOL  bIsStringASCII = TRUE 
)

Sets the Product Description String of the device's USB Device Descriptor's iProduct USB String Descriptor.

If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN or CP2105_MAX_PRODUCT_STRLEN.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpvProductStringis a pointer to a buffer containing the Product String value
[in]bProductStringLengthis the length of the string in characters NOT including a NULL terminator.
[in]bIsStringASCIIis a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpvProductString or bProductStringLength is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetQuadPortConfig()

CP210x_STATUS CP210x_SetQuadPortConfig ( const HANDLE  cyHandle,
QUAD_PORT_CONFIG pQuadPortConfig 
)

Sets the current port pin configuration from the device.

Note
supported on the CP2108 quad-interface CP210x devices.
Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]pQuadPortConfigis a pointer to a QUAD_PORT_CONFIG structure
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– pQuadPortConfig is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the port pin configuration

◆ CP210x_SetSelfPower()

CP210x_STATUS CP210x_SetSelfPower ( const HANDLE  cyHandle,
const BOOL  bSelfPower 
)

Sets or clears the Self-Powered bit of the Power Attributes field of the USB Configuration Descriptor on the device.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]bSelfPoweris a Boolean flag where TRUE means set the Self-Powered bit, and FALSE means clear the Self-Powered bit.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_SetSerialNumber()

CP210x_STATUS CP210x_SetSerialNumber ( const HANDLE  cyHandle,
void *  lpvSerialNumberString,
const uint8_t  bSerialNumberStringLength,
const BOOL  bIsStringASCII = TRUE 
)

Sets the Serial Number Description String of the device's USB Device Descriptor's iSerialNumber USB String Descriptor.

If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit(in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_SERIAL_STRLEN for the particular device type.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]lpvSerialNumberStringis a pointer to a buffer containing the Serial Number String value
[in]bSerialNumberStringLengthis the length of the string in characters NOT including a NULL terminator.
[in]bIsStringASCIIis a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_INVALID_PARAMETER– lpvSerialNumberString or bSerialNumberStringLength is an unexpected value
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support setting of the Serial Number string

◆ CP210x_SetVid()

CP210x_STATUS CP210x_SetVid ( const HANDLE  cyHandle,
const uint16_t  Vid 
)

Sets the Vendor ID field of the device's USB Device Descriptor.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
[in]Vidis the 2-byte Vendor ID value.
Note
IsOTP() OTP parts can not often/indefinitely have configuration data (re-)written (I.e. Set) to them
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner

◆ CP210x_UpdateFirmware()

CP210x_STATUS CP210x_UpdateFirmware ( const HANDLE  cyHandle)

Requests device enter Bootloader mode.

Parameters
[in]cyHandleis an open handle to the device as returned by CP210x_Open()
Note
supported on the CP2102N CP210x devices.
Returns
Returns CP210x_SUCCESS on success, or another CP210x Status Codes - manufacturing Return value if there is an error.
Return values
CP210x_SUCCESS– success
CP210x_INVALID_HANDLE– cyHandle is invalid
CP210x_FUNCTION_NOT_SUPPORTED– the device does not support Update Firmware
CP210x_DEVICE_IO_FAILED– the device failed to respond to I/O in any expected manner