Part Number Hot Search : 
A700A M5700021 SM26F 09032 AM5480N DTC643TK MM1205XD 09032
Product Description
Full Text Search
 

To Download CP2110 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rev. 0.5 10/12 copyright ? 2012 by silicon laboratories an433 an433 CP2110/4 hid- to -uart api s pecification 1. introduction the silicon labs hid-to-uart interfac e library provides a simple api to configure and operate CP2110 and cp2114 devices. the library provides interface abstraction so that users can develop their application without writing any usb hid code. c libraries implementing the CP2110 and cp2114 interface specification are provided for windows 2000 and later, mac os x 10.5 and later, and linux. similarly, various include files are provided to import library functions into c#.net and visual basic.net. re fer to table 1 for complete details. figure 1. system architecture diagram pc user application hid to uart library hid driver (provided by os) usb root hub usb CP2110 hid- uart bridge cp2114 usb audio-i2s digital audio bridge external rs-232 transceiver or uart circuitry/dac/codec hardware external rs-232 transceiver or uart circuitry
an433 2 rev. 0.5 table 1. hid-to-uart include files operating system library include files version windows 2000 and later slabhidtouart.dll 1 slabhidtouart.h (c/c++) slabhidtouart.cs (c#.net) slabhidtouart.vb (vb.net) slabCP2110.h (c/c++) slabCP2110.cs (c#.net) slabCP2110.vb (vb.net) slabcp2114.h (c/c++) cp2114_common.h (c/c++) 2.0 mac os x 10.5 and later libslabhidtouar t.dylib slabhidtouart.h (c, c++, obj-c) slabCP2110.h (c, c++, obj-c) slabcp2114.h (c, c++, obj-c) cp2114_common.h (c, c++, obj-c) types.h (c, c++, obj-c) 2.0 linux libslabhidtouart.so 2 slabhidtouart.h (c/c++) slabCP2110.h (c/c++) slabcp2114.h (c/c++) cp2114_common.h (c/c++) types.h (c/c++) 2.0 notes: 1. requires slabhiddevice.dll version 1.5 during runtime. 2. requires libusb-1.0 during runtime.
an433 rev. 0.5 3 2. api functions the following api functions apply to the CP2110 and cp2114. definition description page # hiduart_getnumdevices( ) returns the number of devices connected 4 hiduart_getstring() returns a string for a device by index 5 hiduart_getopenedstring() returns a string for a device by device object pointer 6 hiduart_getindexedstring() returns an in dexed usb string descriptor by index (windows/linux only) 7 hiduart_getopenedindexedstring() returns an indexed usb string descriptor by device object pointer (windows/linux only) 7 hiduart_getattributes() returns the vid, pi d, and release number for a device by index. 8 hiduart_getopenedattributes() returns the vid, pid, and release number for a device by device object pointer. 8 hiduart_open() opens a device and returns a device object pointer 9 hiduart_close() cancels pending io and closes a device 9 hiduart_isopened() returns t he device opened status 9 hiduart_setuartenable() enables/disables the uart 10 hiduart_getuartenable() gets uart status 10 hiduart_read() reads a block of data from a device 11 hiduart_write() writes a block of data to a device 12 hiduart_flushbuffers() flushes the tx and rx buffers for a device 13 hiduart_cancelio() cancels pending hi d reads and writes (windows only) 13 hiduart_settimeouts() sets read and write block timeouts for a device 13 hiduart_gettimeouts() gets read and write block timeouts for a device 14 hiduart_getuartstatus() returns the number of bytes in the device transmit and receive fifos and parity/overrun errors 14 hiduart_setuartconfig() sets baud rate, parity , flow control, data bits, and stop bits 15 hiduart_getuartconfig() gets baud rate, parity, flow control, data bits, and stop bits 16 hiduart_startbreak() starts transmission of the line break for the specified duration 17 hiduart_stopbreak() stops transmission of the line break 17 hiduart_reset() resets the device with re-enumeration 17 hiduart_readlatch() gets the port latch value from a device 18
an433 4 rev. 0.5 2.1. hiduart_getnumdevices description : this function returns the number of devices connected to the host with matching vendor and product id (vid, pid). prototype : hid_uart_status hiduart_getnumdevices (dword* numdevices, word vid, word pid) parameters :1. numdevices ?returns the number of dev ices connected on return. 2. vid ?filter device results by vendor id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 3. pid ?filter device results by product id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter hiduart_writelatch() sets the port latch value on a device 18 hiduart_getpartnumber() gets the device part number and version 19 hiduart_getlibraryversion() gets the dll library version 20 hiduart_gethidlibraryversion() gets the hid device interface library version 20 hiduart_gethidguid() gets the hid guid (windows only) 20 definition description page #
an433 rev. 0.5 5 2.2. hiduart_getstring description : this function returns a null-terminated vendor id stri ng, product id string, se rial string, device path string, manufacturer string, or product string fo r the device specified by an index passed in devicenum . the index for the first device is 0 and the last device is the value returned by hiduart_getnumdevices() ? 1. prototype : hid_uart_status hiduart_getstring (dword devicenum, word vid, word pid, char* devicestring, dword options) parameters :1. devicenum ?index of the device for wh ich the string is desired. 2. vid ?filter device results by vendor id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 3. pid ?filter device results by product id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 4. devicestring ?variable of type hid_uart_device_string which will contain a null terminated ascii device string on return. the string is 260 bytes on windows and 512 bytes on mac os x and linux. 5. options ?determines if devicestring contains a vendor id string, product id string, serial string, device path string, manufac turer string, or product string. return value : hid_uart_status = hid_uart_success hid_uart_device_not_found hid_uart_invalid_parameter hid_uart_device_access_error definition value length description hid_uart_get_vid_str 0x01 5 vendor id hid_uart_get_pid_str 0x02 5 product id hid_uart_get_path_str 0x03 260/512 device path hid_uart_get_serial_str 0x04 256 serial string hid_uart_get_manufacturer_str 0x05 256 manufacturer string hid_uart_get_product_st r 0x06 256 product string
an433 6 rev. 0.5 2.3. hiduart_getopenedstring description : this function returns a null-terminated vendor id stri ng, product id string, se rial string, device path string, manufacturer string, or produc t string for the device specified by device . prototype : hid_uart_status hiduart_getopenedstring (hid_uart_device device, char* devicestring, dword options) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. devicestring ?variable of type hid_uart_device_string which will contain a null terminated ascii device string on return. the string is 260 bytes on windows and 512 bytes on mac os x and linux. 3. options ?determines if devicestring contains a vendor id string, product id string, serial string, device path string, manufac turer string, or product string. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_access_error definition value length description hid_uart_ get_vid_str 0x01 5 vendor id hid_uart_ get_pid_str 0x02 5 product id hid_uart_ get_path_str 0x03 260/512 device path hid_uart_ get_serial_str 0x04 256 serial string hid_uart_get_manufacturer_st r 0x05 256 manufacturer string hid_uart_get_product_str 0x06 256 product string
an433 rev. 0.5 7 2.4. hiduart_getindexedstring description : this function returns a null-terminated usb string descriptor for the device specified by an index passed in devicenum . (windows/linux only) prototype : hid_uart_status hiduart_getindexedstring (dword devicenum, word vid, word pid, dword stringindex, char* devicestring) parameters :1. devicenum ?index of the device for wh ich the string is desired. 2. vid ?filter device results by vendor id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 3. pid ?filter device results by product id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 4. stringindex ? specifies the device-specific index of the usb string descriptor to return. 5. devicestring ?variable of type hid_uart_device_string which will contain a null terminated device descriptor string on return. the string is 260 bytes on windows and 512 bytes on linux. return value : hid_uart_status= hid_uart_success hid_uart_device_not_found hid_uart_invalid_parameter hid_uart_device_access_error 2.5. hiduart_getopenedindexedstring description : this function returns a null-terminated usb string descriptor for the device specified by device . (windows/linux only) prototype : hid_uart_status hiduart_getopenedindexedstring (hid_uart_device device, dword stringindex, char* devicestring) parameters :1. devicenum ?device object pointer as returned by hiduart_open(). 2. stringindex ?specifies the device-specific index of the usb string descriptor to return. 3. devicestring ?variable of type hid_uart_device_string which will contain a null terminated device descriptor string on return. the string is 260 bytes on windows and 512 bytes on linux. return value : hid_uart_status= hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_access_error
an433 8 rev. 0.5 2.6. hiduart_getattributes description : this function returns the device vendor id, produc t id, and release number for the device specified by an index passed in devicenum . prototype : hid_uart_status hiduart_getattributes (dword devicenum, word vid, word pid, word* devicevid, word* devicepid, word* devicereleasenumber) parameters :1. devicenum ?index of the device for wh ich the string is desired. 2. vid ?filter device results by vendor id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 3. pid ?filter device results by product id. if both vi d and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 4. devicevid ?returns the device vendor id. 5. devicepid ?returns the device product id. 6. devicereleasenumber ?returns the usb device release number in binary-coded decimal. return value : hid_uart_status= hid_uart_success hid_uart_device_not_found hid_uart_invalid_parameter hid_uart_device_access_error 2.7. hiduart_ge topenedattributes description : this function returns the device vendor id, produc t id, and release number for the device specified by device . prototype : hid_uart_status hiduart_getopenedattributes (hid_uart_device device, word* devicevid, word* devicepid, word* devicereleasenumber) parameters :1. device ?device object pointer as returned by hiduart_open(). 2. devicevid ?returns the device vendor id. 3. devicepid ? returns the device product id. 4. devicereleasenumber ?returns the usb device release number in binary-coded decimal. return value : hid_uart_status= hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_access_error
an433 rev. 0.5 9 2.8. hiduart_open description : opens a device using a device number between 0 and hiduart_getnumdevices()?1 , enables the uart, and returns a device object pointer which will be used for s ubsequent accesses. prototype : hid_uart_status hiduart_open (hid_uart_device* device, dword devicenum, word vid, word pid) parameters :1. device ?returns a pointer to a hid-to-uart device object. this pointer will be used by all subsequent accesses to the device. 2. devicenum ?zero-based device index, between 0 and (hiduart_getnumdevices() ? 1). 3. vid ?filter device results by vendor id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. 4. pid ?filter device results by product id. if both vid and pid are set to 0x0000, then hid devices will not be filtered by vid/pid. return value : hid_uart_status= hid_uart_success hid_uart_invalid_device_object hid_uart_device_not_found hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_access_error hid_uart_device_not_supported remarks : be careful when opening a device. any hid device may be opened by this lib rary. however, if the device is not actually a cp211x, use of this library will cause unde sirable results. the best course of action would be to designate a unique vid/pi d for cp211x devices only. the application should then filter devices using this vid/pid. 2.9. hiduart_close description : closes an opened device using the device object pointer provided by hiduart_open() . prototype : hid_uart_status hiduart_close (hid_uart_device device) parameters : device ?device object pointer as returned by hiduart_open() . return value : hid_uart_status= hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_handle hid_uart_device_access_error remarks : device is invalid after calling hiduart_close() . set device to null.
an433 10 rev. 0.5 2.10. hiduart_isopened description : returns the device opened status. prototype : hid_uart_status hiduart_isopened (hid_uart_device device, bool* opened) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. opened ?returns true if the device object pointer is valid and the device has been opened using hiduart_open(). return value : hid_uart_status= hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter 2.11. hiduart_setuartenable description : enables or disables the uart. prototype : hid_uart_status hiduart_setuartenable (hid_uart_device, bool enable) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. enable ?set to true to enable the uart. set to false to disable the uart. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed remarks : enabling or disabling the uart will flush the uart fifos if the flushbuffers parameter is enabled by calling hiduart_setusbconfig() . 2.12. hiduart_getuartenable description : returns the uart enable status. prototype : hid_uart_status hiduart_getuartenable (hid_uart_device, bool* enable) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. enable ?returns true if the uart is enabled. returns false if the uart is disabled. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed hid_uart_invalid_parameter
an433 rev. 0.5 11 2.13. hiduart_read description : reads the available number of bytes into the supp lied buffer and returns the number of bytes read which can be less than the number of bytes requ ested. this function returns synchronously after reading the requested number of bytes or after the timeout duration has elapsed. read and write timeouts can be set using hiduart_settimeouts() described in "2.17. hiduart_settimeouts" on page 13 . prototype : hid_uart_status hiduart_read (hid_uart_device device, byte* buffer, dword numbytestoread, dword* numbytesread) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. buffer ?address of a buffer to be filled with read data. 3. numbytestoread ?number of bytes to read from the device into the buffer (1?32768). this value must be less than or equal to the size of buffer. 4. numbytesread ?returns the number of bytes actually read into the buffer on completion. return value : hid_uart_status = hid_uart_success hid_uart_read_error hid_uart_invalid_parameter hid_uart_invalid_device_object hid_uart_read_timed_out hid_uart_invalid_request_length remarks : hiduart_read() returns hid_uart_read_timed _out if the number of bytes read is less than the number of bytes req uested. this will only occur after th e read timeout has elapsed. if the number of bytes read matches the number of bytes requested, th is function will return hid_uart_success.
an433 12 rev. 0.5 2.14. hiduart_write description : write the specified number of bytes from the supp lied buffer to the device. this function returns synchronously after writing the requested number of bytes or after the timeout duration has elapsed. read and write timeouts can be set using hiduart_settimeouts() described in "2.17. hiduart_settimeouts" on page 13. prototype : hid_uart_status hiduart_write (hid_uart_device device, byte* buffer, dword numbytestowrite, dword* numbyteswritten) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. buffer ?address of a buffer to be sent to the device. 3. numbytestowrite ?number of bytes to write to the device (1?4096 bytes). this value must be less than or equal to the size of buffer. 4. numbyteswritten ?returns the number of bytes ac tually written to the device. return value : hid_uart_status = hid_uart_success hid_uart_write_error hid_uart_invalid_parameter hid_uart_invalid_device_object hid_uart_write_timed_out hid_uart_invalid_request_length remarks : hiduart_write() returns hid_uart_write_timed_out if the number of bytes written is less than the number of bytes requested. data is broken down into hid interrupt reports between 1 ? 63 bytes in size and transmit ted. each report will be given a specific amount of time to complete. this report ti meout is determined by writetimeout in hiduart_settimeouts() . each interrupt report is given the max timeout to comple te because a timeout at the interrupt report level is considered an unrecoverable error (the io is canceled in an unknown state). if the hid set interrupt report times out, hiduart_write() returns hid_uart_write_error. the hiduart_write() timeout may take up to twice as long as the timeout specified to allow each interrupt report to complete.
an433 rev. 0.5 13 2.15. hiduart_flushbuffers description : this function flushes the receive buffer in the device and the hid driver and/or the transmit buffer in the device. prototype : hid_uart_status hiduart_flushbuffers (hid_uart_device device, bool flushtransmit, bool flushreceive) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. flushtransmit ?set to true to flush the device transmit buffer. 3. flushreceive ?set to true to flush the device receive buffer and hid receive buffer. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed 2.16. hiduart_cancello description : this function cancels any pending hid reads and writes. (windows only) prototype : hid_uart_status hiduart_cancelio (hid_uart_device device) parameters : device ?device object pointer as returned by hiduart_open() . return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed 2.17. hiduart_settimeouts description : sets the read and write timeouts. timeouts are used for hiduart_read() and hiduart_write() . the default value for timeouts is 1000 ms, but timeouts can be se t to wait for any number of milliseconds betwee n 0 and 0xffffffff. prototype : hid_uart_status hiduart_settimeouts (hid_uart_device device, dword readtimeout, dword writetimeout) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. readtimeout ? hiduart_read() operation timeout in milliseconds. 3. writetimeout ? hiduart_write() operation timeout in milliseconds. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object remarks: if read timeouts are set to a large value and no dat a is received, then the application may appear unresponsive. it is recommended to set tim eouts appropriately before using the device.
an433 14 rev. 0.5 2.18. hiduart_gettimeouts description : returns the current r ead and write timeouts sp ecified in milliseconds. prototype : hid_uart_status hiduart_gettimeouts (hid_uart_device device, dword* readtimeout, dword* writetimeout) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. readtimeout ? hiduart_read() operation timeout in milliseconds. 3. writetimeout ? hiduart_write() operation timeout in milliseconds. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter hid_uart_invalid_device_object remarks : read and write timeouts are maintained for each device but are not persistent across hiduart_open() / hiduart_close() . 2.19. hiduart_getuartstatus description : returns the number of bytes held in the device receive and transmit fifo. returns the parity/error status and line break status. prototype : hid_uart_status hiduart_getuartstatus (hid_uart_device device, word* transmitfifosize, word* receivefifosize, byte* errorstatus, byte* linebreakstatus) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. transmitfifosize ?returns the number of bytes currently held in the devic e transmit fifo. 3. receivefifosize ?returns the number of bytes currentl y held in the device receive fifo. 4. errorstatus ?returns an error status bitmap describing parity and overrun errors. calling this function clears the errors. 5. linebreakstatus ?returns 0x01 if line break is curr ently active and 0x00 otherwise. definition value description hid_uart_mask_parity_error 0x01 parity error hid_uart_mask_overrun_e rror 0x02 overrun error definition value description hid_uart_line_break_inactive 0x00 line break inactive hid_uart_line_break_active 0x01 line break active
an433 rev. 0.5 15 return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter hid_uart_invalid_device_object hid_uart_device_io_failed remarks :the transmitfifosize and receivefifosize only apply to data held in th e device fifos; they do not include data queued in the hid driver or interface library. 2.20. hiduart_setuartconfig description : sets the baud rate, data bits, parit y, stop bits, and flow control. refer to the device data sheet for a list of supported configuration settings. prototype : hid_uart_status hiduart_setuartconfig (hid_uart_device device, dword baudrate, byte databits, byte parity, byte stopbits, byte flowcontrol) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. baudrate ?the baud rate for uart communication. default: 115200 3. databits ?the number of data bits for uart communication. default: 8 4. parity ?the parity for uart communi cation. default: no parity definition value description hid_uart_five_data_bits 0x00 5 data bits hid_uart_six_data_bits 0x01 6 data bits hid_uart_seven_data_bits 0x02 7 data bits hid_uart_eight_data_bits 0x03 8 data bits definition value description hid_uart_no_parity 0x00 no parity hid_uart_odd_parity 0x01 odd parity (sum of data bits is odd) hid_uart_even_parity 0x02 even pari ty (sum of data bits is even) hid_uart_mark_parity 0x03 mark parity (always 1) hid_uart_space_parity 0x04 space parity (always 0)
an433 16 rev. 0.5 5. stopbits ?the number of stop bits for uart communication. default: 1 6. flowcontrol ?the type of flow control for uart co mmunication. default: no flow control return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter hid_uart_invalid_device_object hid_uart_device_io_failed 2.21. hiduart_getuartconfig description : gets the baud rate, data bits, parity, stop bits, an d flow control. refer to the device data sheet for a list of supported baud rates. see "2. 20. hiduart_setuartconfig" on page 15 . prototype : hid_uart_status hiduart_getuartconfig (hid_uart_device device, dword* baudrate, byte* databits, byte* parity, byte* stopbits, byte* flowcontrol) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. baudrate ?returns the baud rate for uart communication. 3. databits ?returns the number of data bits for uart communication. 4. parity ?returns the parity for uart communication. 5. stopbits ?returns the number of stop bits for uart communication. 6. flowcontrol ?returns the type of flow control for uart communication. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter hid_uart_invalid_device_object hid_uart_device_io_failed definition value description hid_uart_short_stop_bit 0x00 1 stop bit hid_uart_long_stop_bit 0x01 5 data bits: 1.5 stop bits 6-8 data bits: 2 stop bits definition value description hid_uart_no_flow_control 0x00 no flow control hid_uart_rts_cts_flow_control 0x01 rts/cts hardware flow control
an433 rev. 0.5 17 2.22. hiduart_startbreak description : causes the device to transmit a line break, holdi ng the tx pin low, for the specified duration in milliseconds. prototype : hid_uart_status hiduart_startbreak (hid_uart_device device, byte duration) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. duration ?the length of time in m illiseconds to transmit the li ne break (1?125 ms). a value of 0x00 indicates that the line break will be transmitted indefinitely until hiduart_stopbreak() is called. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter hid_uart_invalid_device_object hid_uart_device_io_failed hid_uart_device_not_supported 2.23. hiduart_stopbreak description : stops the device from transmitting a line break. prototype : hid_uart_status hiduart_stopbreak (hid_uart_device device) parameters : device ?device object pointer as returned by hiduart_open() . return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed hid_uart_device_not_supported remarks : this function is ignored if the device is not transmitting a line break. 2.24. hiduart_reset description : initiates a full device reset. transmit and receive fifos will be cleared, uart settings will be reset to default values, and the device will re-enumerate. prototype : hid_uart_status hiduart_reset (hid_uart_device device) parameters : device ?device object pointer as returned by hiduart_open() . return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed remarks : resetting the device will make th e device?s handle stale. users must close the device using the old handle before proceeding to reconnect to the device. see more information on surprise removal. default uart settings are as follows: 115200 8n1, no flow control.
an433 18 rev. 0.5 2.25. hiduart_readlatch description : gets the current port latch value from the device. prototype : hid_uart_status hiduart_readlatch (hid_uart_device device, word* latchvalue) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. latchvalue ?returns the port latch value (logic high = 1, logic low = 0). if a pin is configured as a gpio input or flow control pin that is an input, then the corresponding bit represents the input value. if a pin is configured as a gpio outp ut pin or a flow control pin that is an output, then the corresponding bit represents the logic level driven on the pin. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported remarks : see "6. port latch pin definition" on page 46 for more information on configuring gpio and flow control pins. bits 9 and 15 of latchvalue are ignored. 2.26. hiduart_writelatch description : sets the current port latch value to the device. prototype : hid_uart_status hiduart_writelatch (hid_uart_device device, word latchvalue, word latchmask) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. latchvalue ?value to write to the port latch (logic high = 1, logic low = 0). this function is used to set the values for gpio pins or flow control pins that are configured as outputs. this function will not affect any pins th at are not config ured as outputs. 3. latchmask ?determines which pins to change (change = 1, leave = 0). return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed hid_uart_device_not_supported remarks : see "6. port latch pin definition" on page 46 for more information on configuring gpio and flow control pins. bits 9 and 15 or latchvalue and latchmask are ignored. pins tx , rx, suspend, and / suspend cannot be written to using this function.
an433 rev. 0.5 19 2.27. hiduart_getpartnumber description : retrieves the part number and version of the cp211x device. prototype : hid_uart_status hiduart_getpartnumber (hid_uart_device device, byte* partnumber, byte* version) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. partnumber ?returns the device part number. 3. version ?returns the version. this value is not user-programmable. return value : hid_uart_status=hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed definition value description hid_uart_part_CP2110 0x0a CP2110 hid_uart_part_cp2114 0x0e cp2114
an433 20 rev. 0.5 2.28. hiduart_getlibraryversion description : returns the hid-to-uart interface library version. prototype : hid_uart_status hiduart_getlibraryversion (byte* major, byte* minor, bool* release) parameters :1. major ?returns the major library version number. this value ranges from 0 to 255. 2. minor ?returns the minor library version number. this value ranges from 0 to 255. 3. release ?returns true if the library is a release build, ot herwise the library is a debug build. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter 2.29. hiduart_gethidlibraryversion description : returns the version of the hid device interface library that is currently in use. prototype : hid_uart_status hiduart_gethidlibraryversion (byte* major, byte* minor, bool* release) parameters :1. major ?returns the major library version number. this value ranges from 0 to 255. 2. minor ?returns the minor library version number. this value ranges from 0 to 255. 3. release ?returns true if the library is a release build, ot herwise the library is a debug build. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter 2.30. hiduart_gethidguid description : obtains the hid guid. this can be used to register for surprise removal notifications. (windows only) prototype : hid_uart_status hiduart_gethidguid (void* guid) parameters :1. guid ?returns the hid guid. return value : hid_uart_status = hid_uart_success hid_uart_invalid_parameter
an433 rev. 0.5 21 3. user customization api functions the following parameters are programmable on the device. different functions are provided to program these parameters. each of these functions can only be ca lled once for each device and apply to the CP2110 and cp2114. the following api functions are provided to allo w user customization / one-time programming: name size (bytes) short description vid 2 usb vendor id pid 2 usb product id power 1 power request in ma/2 power mode 1 bus powered self powered release version 2 major and minor release version flush buffers 1 purge fifos on enable/disable manufacturer string 126 product manufacturer (english unicode) product description string 126 product description (english unicode) serial string 62 serialization string (english unicode) definition description page # hiduart_setlock() prevents further otp programming/customization 22 hiduart_getlock() gets the otp lock status 23 hiduart_setusbconfig() sets vid, pid, power , power mode, release version, and flush buffers settings 24 hiduart_getusbconfig() gets vid, pid, powe r, power mode, release version, and flush buffers settings 26 hiduart_setmanufacturingstring() sets the usb manufacturing string 27 hiduart_getmanufacturingstring() get s the usb manufacturing string 27 hiduart_setproductstring() sets the usb product string 28 hiduart_getproductstring() gets the usb product string 28 hiduart_setserialstring() sets the usb serial string 29 hiduart_getserialstring() gets the usb serial string 29 note: "4. CP2110 user-customizable api functions" on page 30 and "5. cp2114 user-customizable api functions" on page 35 contain additional user customization/one-time pr ogrammable functions specific to the CP2110 and cp2114.
an433 22 rev. 0.5 3.1. hiduart_setlock description : permanently locks/disables device customization. prototype : hid_uart_status hiduart_setlock (hid_uart_device device, word lock) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. lock ?bitmask specifying which fiel ds can be customized/programmed and which fields are already customized. bit definition mask description 0 hid_uart_lock_product_st r_1 0x0001 product string 1 hid_uart_lock_product_st r_2 0x0002 product string 2 hid_uart_lock_serial_str 0x0004 serial string 3 hid_uart_lock_pin_config 0x0008 pin config 4n/a 5n/a 6n/a 7n/a 8 hid_uart_lock_vid 0x0100 vid 9 hid_uart_lock_pid 0x0200 pid 10 hid_uart_lock_power 0x0400 power 11 hid_uart_lock_power_mode 0x0800 power mode 12 hid_uart_lock_release_version 0x1000 release version 13 hid_uart_lock_flush_buff ers 0x2000 flush buffers 14 hid_uart_lock_mfg_str_1 0x4000 manufacturing string 15 hid_uart_lock_mfg_str_2 0x8000 manufacturing string definition bit value description hid_uart_lock_unlocked 1 field can be customized hid_uart_lock_locked 0 field has already been customized or has been locked
an433 rev. 0.5 23 return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_device_io_failed remarks : when this function is successfully called, the spec ified fields are fully locked and cannot be further customized. the user customization f unctions can be called and may return hid_uart_success even though the device was not programmed. call the function?s corresponding get function to veri fy that customization was success ful. each field is stored in one time programmable memory (otp) and can only be customized once. after a field is customized, the corresponding lock bits are set to 0. 3.2. hiduart_getlock description : returns the device customization lock status. prototype : hid_uart_status hiduart_getlock (hid_uart_device device, word* lock) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. lock ?returns a bitmask specifying which fields are locked. bit definition mask description 0 hid_uart_lock_product_st r_1 0x0001 product string 1 hid_uart_lock_product_st r_2 0x0002 product string 2 hid_uart_lock_serial_str 0x0004 serial string 3 hid_uart_lock_pin_config 0x0008 pin config 4n / a 5n / a 6n / a 7n / a 8 hid_uart_lock_vid 0x0100 vid 9 hid_uart_lock_pid 0x0200 pid 10 hid_uart_lock_power 0x0400 power 11 hid_uart_lock_power_mode 0x0800 power mode 12 hid_uart_lock_release_version 0x1000 release version 13 hid_uart_lock_flush_buff ers 0x2000 flush buffers 14 hid_uart_lock_mfg_str_1 0x4000 manufacturing string 15 hid_uart_lock_mfg_str_2 0x8000 manufacturing string
an433 24 rev. 0.5 return value :hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed 3.3. hiduart_setusbconfig description : allows one-time customization of the usb confi guration, which includes vendor id, product id, power, power mode, release version, and flush bu ffers setting. each field can be independently programmed one time each via the mask field. prototype : hid_uart_status hiduart_setusbconfig (hid_uart_device device, word vid, word pid, byte power, byte powermode, word releaseversion, byte flushbuffers, byte mask) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. vid ?vendor id. 3. pid ?product id. 4. power ?specifies the curren t requested by the device in milliamps/2. the maximum power setting is 500 ma or 250 (0xfa). this value only applies when the device is configured to be bus powered. 5. powermode ?configures the device as bus powered or self powered. 6. releaseversion ?the release version. the msb is the major revision and the lsb is the minor revision. both revisions can be programmed to any value from 0 to 255. 7. flushbuffers ?bitmask specifying whether the rx and/ or tx fifos are purged upon a device open and/or close. definition bit value description hid_uart_lock_unlocked 1 field can be customized hid_uart_lock_locked 0 field has already been customized or has been locked definition value description hid_uart_bus_power 0x00 device is bus powered hid_uart_self_power_vr eg_dis 0x01 device is self-powered and voltage regulator is disabled hid_uart_self_power_vreg_en 0 x02 device is self-powered and voltage regulator is enabled
an433 rev. 0.5 25 8. mask ?bitmask specifying which fields to customize. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed bit definition mask description 0 hid_uart_flush_tx_open 0x01 flush tx on open 1 hid_uart_flush_tx_close 0x02 flush tx on close 2 hid_uart_flush_rx_open 0x04 flush rx on open 3 hid_uart_flush_rx_close 0x08 flush rx on close bit definition mask description 0 hid_uart_set_vid 0x01 vid 1 hid_uart_set_pid 0x02 pid 2 hid_uart_set_power 0x04 power 3 hid_uart_set_power_mode 0x08 power mode 4 hid_uart_set_release_vers ion 0x10 release version 5 hid_uart_set_flush_buffers 0x20 flush buffers 6n / a 7n / a definition bit value description hid_uart_set_ignore 0 field will be unchanged hid_uart_set_program 1 field will be programmed
an433 26 rev. 0.5 3.4. hiduart_getusbconfig description : retrieves usb configuration, which includes vendor id, product id, power, power mode, release version, and flush buffers setting. prototype : hid_uart_status hiduart_getusbconfig (hid_uart_device device, word* vid, word* pid, byte* power, byte* powermode, word* releaseversion, byte* flushbuffers) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. vid ?returns the vendor id. 3. pid ?returns the product id. 4. power ?returns the current requested by the device in milliamps/2. th is value only applies when the device is bus powered. 5. powermode ?returns the device power mode. 6. releaseversion ?returns the release version. the msb is the major revision and the lsb is the minor revision. both revisions can be programmed to any value from 0 to 255. 7. flushbuffers ?returns a bitmask specifyi ng whether the rx and/or tx fifos are purged upon a device open and/or close. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed definition value description hid_uart_bus_power 0x00 device is bus-powered hid_uart_self_power_vreg_dis 0x01 de vice is self-powered and voltage regulator is disabled hid_uart_self_power_vreg_en 0x02 dev ice is self-powered and voltage regulator is enabled bit definition mask description 0 hid_uart_flush_tx_open 0x01 flush tx on open 1 hid_uart_flush_tx_close 0x02 flush tx on close 2 hid_uart_flush_rx_open 0x04 flush rx on open 3 hid_uart_flush_rx_close 0x08 flush rx on close
an433 rev. 0.5 27 3.5. hiduart_setmanufacturingstring description : allows one-time customization of the usb manufacturing string. prototype : hid_uart_status hiduart_setmanufacturingstring (hid_uart_device device, char* manufacturingstring, byte strlen) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. manufacturingstring ?variable of type hid_uart_CP2110/4_mfg_str , a 62-byte character buffer containing the ascii manufacturing string. 3. strlen ?the length of manufacturingstring in bytes. the maximum st ring length is 62 bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed 3.6. hiduart_getmanufacturingstring description : retrieves the usb manufacturing string. prototype : hid_uart_status hiduart_getmanufacturingstring (hid_uart_device device, char* manufacturingstring, byte* strlen) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. manufacturingstring ?variable of type hid_uart_c p2110/4_mfg_str, a 62-byte character buffer that will contain the ascii manufacturing string. 3. strlen ?returns the length of the string in bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed
an433 28 rev. 0.5 3.7. hiduart_setproductstring description : allows one-time customization of the usb product string. prototype : hid_uart_status hiduart_setproductstring (hid_uart_device device, char* productstring, byte strlen) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. productstring ?variable of type hid_uart_CP2110/4_product_str , a 62-byte character buffer containing the ascii product string. 3. strlen ?the length of productstring in bytes. the maximum st ring length is 62 bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed 3.8. hiduart_getproductstring description : retrieves the usb product string. prototype : hid_uart_status hiduart_getproductstring (hid_uart_device device, char* productstring, byte* strlen) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. productstring ?variable of type hid_uart_CP2110/4_ product_str, a 62-byte character buffer that will contain the ascii product string. 3. strlen ?returns the length of the string in bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed
an433 rev. 0.5 29 3.9. hiduart_setserialstring description : allows one-time customization of the usb serial string. prototype : hid_uart_status hiduart_setserialstring (hid_uart_device device, char* serialstring, byte strlen) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. serialstring ?variable of type hid_uart_CP2110/4_serial_str, a 30-byte character buffer containing the ascii serial string. 3. strlen ?the length of serialstring in bytes. the maximum string length is 30 bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed 3.10. hiduart_getserialstring description : retrieves the usb product string. prototype : hid_uart_status hiduart_getserialstring (hid_uart_device device, char* serialstring, byte* strlen) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. serialstring ?variable of type hid_uart_CP2110/4_serial_str, a 30-byte character buffer that will contain the unicode product string. 3. strlen ?returns the length of the string in bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed
an433 30 rev. 0.5 4. CP2110 user-customizable api functions the following parameters are programmable on the CP2110. different functions are provided to program these parameters. each of these functions can only be called once for each device. the following api functions are provided to allo w user customization / one-time programming: 4.1. hiduart_setpinconfig description : allows one-time configuration of the gpio mode for each pin. prototype : hid_uart_status hiduart_setpinconfig(hid_uart_device device, byte* pinconfig, bool usesuspendvalues, word suspendvalue, word suspendmode, byte rs485level, byte clkdiv); parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pinconfig ?a pointer to a 13-byte array that configures the gpio mode for each of the 13 pins. the rx pin is not configurable. name size short description pin configuration 18 all pins configuration definition description page # hiduart_setpinconfig() configures the pin behavior 30 hiduart_getpinconfig() gets pin configuration 34 byte name value mode 0 gpio.0/clk 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull clk output?push pull 1 gpio.1/rts 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull rts output?push pull 2 gpio.2/cts 0x00 0x01 0x02 0x03 gpio input gpio output? open drain gpio output? push pull cts input 3 gpio.3/rs485 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull rs485 output?push pull
an433 rev. 0.5 31 3. usesuspendvalues ?specifies if the device is to use suspendvalue and suspendmode when device is in usb suspend. if set to 1, the de vice will use these values. if cleared to 0, the device's gpio pins will remain in the stat e they were in before entering usb suspend. 4. suspendvalue ?this is the latch value that will be driven on each gpio pin when the device is in a suspend state. 4 gpio.4/tx toggle 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull tx toggle output?push pull 5 gpio.5/rx toggle 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull rx toggle output?push pull 6 gpio.6 0x00 0x01 0x02 gpio input gpio output?open drain gpio output?push pull 7 gpio.7 0x00 0x01 0x02 gpio input gpio output?open drain gpio output?push pull 8 gpio.8 0x00 0x01 0x02 gpio input gpio output?open drain gpio output?push pull 9 gpio.9 0x00 0x01 0x02 gpio input gpio output?open drain gpio output?push pull 10 tx 0x01 0x02 tx?open drain tx?push pull 11 suspend 0x01 0x02 suspend?open drain suspend?push pull 12 /suspend 0x01 0x02 /suspend?open drain /suspend?push pull definition value description hid_uart_gpio_mode_input 0x00 gpio input hid_uart_gpio_mode_od 0x0 1 gpio output?open drain hid_uart_gpio_mode_pp 0x0 2 gpio output?push pull hid_uart_gpio_mode_function1 0x03 p in specific function and mode byte name value mode
an433 32 rev. 0.5 5. suspendmode ?specifies the mode for each gpio pin when the device is in a suspend state. bit definition bit mask description 0 CP2110_mask_gpio_0_c lk 0x0001 gpio.0/clk 1 CP2110_ mask_gpio_1_rts 0x0002 gpio.1/rts 2 CP2110_ mask_gpio_2_cts 0x0004 gpio.2/cts 3 CP2110_ mask_gpio_3_rs485 0x0008 gpio.3/rs485 4 CP2110_ mask_tx 0x0010 tx 5 CP2110_ mask_rx 0x0020 rx 6 CP2110_ mask_gpio_4_tx_toggle 0x0040 tx toggle 7 CP2110_ mask_gpio_5_rx_toggle 0x0080 rx toggle 8 CP2110_mask_suspend_bar 0x0100 suspend 9n / a 10 CP2110_ mask_gpio_6 0x0400 gpio.6 11 CP2110_ mask_gpio_7 0x0800 gpio.7 12 CP2110_ mask_gpio_8 0x1000 gpio.8 13 CP2110_ mask_gpio_9 0x2000 gpio.9 14 CP2110_mask_suspend 0x4000 suspend 15 n/a definition bit value description hid_uart_value_suspend_lo 0 latch = 0 in suspend hid_uart_value_suspend_hi 1 latch = 1 in suspend
an433 rev. 0.5 33 6. rs485level ?specifies the rs-485 pin level of gpio .2 when configured in rs-485 mode. bit definition bit mask description 0 CP2110_mask_gpio_0_c lk 0x0001 gpio.0/sysclk 1 CP2110_ mask_gpio_1_rts 0x0002 gpio.1/rts 2 CP2110_ mask_gpio_2_cts 0x0004 gpio.2/cts 3 CP2110_ mask_gpio_3_rs485 0x0008 gpio.3/rs485 4 CP2110_ mask_tx 0x0010 tx 5 CP2110_ mask_rx 0x0020 rx 6 CP2110_ mask_gpio_4_tx_toggle 0x0040 tx toggle 7 CP2110_ mask_gpio_5_rx_toggle 0x0080 rx toggle 8 CP2110_mask_suspend_bar 0x0100 suspend 9n / a 10 CP2110_ mask_gpio_6 0x0400 gpio.6 11 CP2110_ mask_gpio_7 0x0800 gpio.7 12 CP2110_ mask_gpio_8 0x1000 gpio.8 13 CP2110_ mask_gpio_9 0x2000 gpio.9 14 CP2110_mask_suspend 0x4000 suspend 15 n/a definition bit value description hid_uart_mode_suspend_od 0 o pen drain in suspend hid_uart_mode_suspend_pp 1 push pull in suspend definition value description hid_uart_mode_rs485_active_lo 0x00 gpio.2/rs485 pin is active low hid_uart_mode_rs485_active_hi 0x01 gpio.2/rs485 pin is active high
an433 34 rev. 0.5 7. clkdiv ?divider applied to gpio0_clk clock output . when 0, the output frequency is 24 mhz. for 1?255, the output frequency is 24 mhz/(2 x clkdiv ). return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 4.2. hiduart_getpinconfig description : retrieves the gpio mode configuration for each pin. prototype : hid_uart_status hiduart_getpinconfig(hid_uart_device device, byte* pinconfig, bool* usesuspendvalues, word* suspendvalue, word* suspendmode, byte* rs485level, byte* clkdiv); parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pinconfig ?a pointer to a 13-byte arra y that will contain the gpio mode configuration for each of the 13 pins. 3. usesuspendvalues ?returns the configuration for using the values in suspendvalue and suspendmode when in suspend mode. this bit is the same as bit 15 of suspendmode. 4. suspendvalue ?returns the latch value that will be driven on each gpio pin when the device is in a suspend state. 5. suspendmode ?returns the mode for each gpio pin wh en the device is in a suspend state. 6. rs485level ?returns the rs-485 pin level of gpio .2 when configured in rs?485 mode. 7. clkdiv ?divider applied to gpio0_clk clock output . when 0, the output frequency is 24 mhz. for 1?255, the output frequency is 24 mhz/(2 x clkdiv ). return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 rev. 0.5 35 5. cp2114 user-customizable api functions the following api functions access custom izable features of cp2114 devices. definition description page cp2114_getversions() gets the api and firmware versions 36 cp2114_setpinconfig() confi gures the pin behavior 36 cp2114_getpinconfig() gets pin configuration 39 cp2114_getdevicestatus() gets the cp2114 device status 40 cp2114_getdevicecaps() gets the cp2114 device capabilities 41 cp2114_setramconfig() sets the cp2114 configuration in ram 42 cp2114_getramconfig() gets the cp2114 device configura- tion from ram 42 cp2114_setdacregisters() sets the dac configuration registers 43 cp2114_getdacregisters() gets the dac configuration registers 43 cp2114_getotpconfig() gets the otp configuration based on the current index 44 cp2114_createotpconfig() creates a new configuration block for the cp2114 44 cp2114_setbootconfig() sets the cp2114 boot configuration index 45 cp2114_readotp() reads otp customization block 45 cp2114_writeotp() writes otp customization block 45
an433 36 rev. 0.5 5.1. cp2114_getversions description : returns the cp2114 api and firmware versions. prototype : hid_uart_status cp2114_getversions(hid_uart_device device, byte* api_version, byte* fw_version); parameters :1. device ?device object pointer as returned by hiduart_open() . 2. api_version ?returns the api version of the device. 3. fw_version ?returns the firmware version of the device. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 5.2. cp2114_setpinconfig description : allows one-time configuration of the gpio mode for each pin. prototype : hid_uart_status cp2114_setpinconfig(hid_uart_device device, byte* pinconfig, bool usesuspendvalues, word suspendvalue, word suspendmode, byte clkdiv) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pinconfig ?a pointer to a 14-byte array that configures the gpio mode or dedicated function for each of the 14 pins. byte name value mode 0 gpio.0_rmute 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull record mute input* 1 gpio.1_pmute 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull play back mute input* 2 gpio.2_vol? 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull volume down input* 3 gpio.3_vol+ 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull volume up input*
an433 rev. 0.5 37 4 gpio.4_rmuteled 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull led1 rmute output* 5 gpio.5_txt_dacsel0 0x00 0x01 0x02 0x03 0x04 gpio input gpio output?open drain gpio output?push pull tx toggle output?push pull dac select 0 input* 6 gpio.6_rxt_dacsel1 0x00 0x01 0x02 0x03 0x04 gpio input gpio output?open drain gpio output?push pull rx toggle output?push pull dac select 1 input* 7 gpio.7_rts_dacsel2 0x00 0x01 0x02 0x03 0x04 gpio input gpio output?open drain gpio output?push pull rts output?push pull dac select 2 input* 8 gpio.8_cts_dacsel3 0x00 0x01 0x02 0x03 0x04 gpio input gpio output?open drain gpio output?push pull cts input dac select 3 input* 9 gpio.9_clkout 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output?push pull clk output?push pull* 10 gpio.10_tx 0x00 0x01 0x02 0x03 0x04 gpio input gpio output?open drain gpio output? open drain tx output?open drain tx output?push pull* 11 gpio.11_rx 0x00 0x01 0x02 0x03 gpio input gpio output?open drain gpio output? open drain rx input* 12 suspend 0x01 0x02 suspend?open drain suspend?push pull* 13 /suspend 0x01 0x02 /suspend?open drain /suspend?push pull* *note: default setting.
an433 38 rev. 0.5 usesuspendvalues ?specifies if the device is to use suspendvalue and suspendmode when device is in usb suspend. if set to 1, the de vice will use these values. if cleared to 0, the device's gpio pins will remain in the stat e they were in before entering usb suspend. suspendvalue ?this is the latch value that will be driven on each gpio pin except suspend and / suspend when the device is in a suspend state. suspendmode ?specifies the mode for each gpio pin when the device is in a suspend state. clkdiv ?divider applied to gpio9./cl k clock output when the pin is configured to clk output- push pull. when 0, the output frequency is sysclk/(2x256). for 1-255, the output frequency is sysclk/(2 x clkdiv). sysclk can be eith er 48mhz or 49.152mh z depending on the configuration. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported bit definition bit mask description 0 cp2114_mask_gpio_0 0 x0001 gpio.0_rmute 1 cp2114_mask_gpio_1 0x0002 gpio.1_pmute 2 cp2114_mask_gpio_ 2 0x0004 gpio.2_vol- 3 cp2114_mask_gpio_3 0x0008 gpio.3_vol+ 4 cp2114_mask_gpio_4 0 x0010 gpio.4_rmuteled 5 cp2114_mask_gpio_5 0x 0020 gpio.5_txt_dacsel0 6 cp2114_mask_gpio_6 0x0040 gpio.6_rxt_dacsel1 7 cp2114_mask_gpio_7 0x 0080 gpio.7_rts_dacsel2 8 cp2114_mask_gpio_8 0x 0100 gpio.8_cts_dacsel3 9 cp2114_mask_gpio_9 0 x0200 gpio.9_clkout 10 cp2114_mask_tx 0x0400 gpio.10_tx 11 cp2114_mask_rx 0x0800 gpio.11_rx 12 cp2114_mask_su spend 0x1000 suspend 13 cp2114_mask_suspend_ bar 0x2000 /suspend
an433 rev. 0.5 39 5.3. cp2114_getpinconfig description : retrieves the gpio mode configuration for each pin. prototype : hid_uart_status cp2114_getpinconfig(hid_uart_device device, byte* pinconfig, bool* usesuspendvalues, word* suspendvalue, word* suspendmode, byte* clkdiv) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pinconfig ?a pointer to a 14-byte array to store gpio mode configuration or dedicated function for each of the 14 pins. 3. usesuspendvalues ?returns the configuration for using the values in suspendvalue and suspendmode when in suspend mode. this bit is the same as bit 15 of suspendmode. 4. suspendvalue ?returns the latch value that will be driven on each gpio pin when the device is in a suspend state. 5. suspendmode ?returns the mode for each gpio pin wh en the device is in a suspend state. 6. clkdiv ?divider applied to gpio.9_clkout clock output. when 0, the output frequency is sysclk/(2 x 256). for 1?255, the outp ut frequency is sysclk/( 2 x clkdiv). sysclk can be either 48 mhz or 49.152 mhz d epending on the configuration. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 40 rev. 0.5 5.4. cp2114_getdevicestatus description : returns the status of the device (the device status is cleared on a read). prototype : hid_uart_status cp2114_getdevicestatus(hid_uart_device device, byte *pcp2114status) parameters :1. device ?device object pointer as returned by hiduart_open(). 2. pcp2114status ?pointer to store status byte. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported definition value description hid_uart_success 0x00 last co mmand produced no error hid_uart_invalid_config_number 0x20 requ ested configuration number exceeded max configurations of 32 hid_uart_boot_indexes_depleted 0x2 1 all boot indices have been used hid_uart_requested_config_not_present 0x22 p ointer to requeste d configuration is 0xffff hid_uart_config_invalid 0x23 specified configuration consists of invalid parameters hid_uart_config_pointers_dep leted 0x24 all configuration pointer slots have been used hid_uart_config_space_depl eted 0x25 not enough space to save the new config hid_uart_boot_index_unchanged 0x26 the us er-specified boot index is already the current boot index stored in otp hid_uart_config_unchanged 0x27 current configuration is already the same as the user requested hid_uart_invalid_numer_of_cached_params 0x 40 specified tsetparamsfornextget.params exceeds max_cached_params of 4 hid_uart_unexpected_cache_data 0x41 une xpected data in tsetparamsfornext- get
an433 rev. 0.5 41 5.5. cp2114_getdevicecaps description : returns the cp2114 device capabilities. prototype : hid_uart_status cp2114_getdevicecaps(hid_uart_device device, pcp2114_caps_struct pcp2114capsstruct) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pcp2114capsstruct ?pointer to stor e cp2114_caps_struct. typedef struct { u8 availablebootindices; u8 availableotpconfigs; u8 currentbootconfig; u8 availableotpconfigspace_lsb; u8 availableotpconfigspace_msb; }tdevicecaps; 3. availablebootindices ?indicates how many cp2114 otp boot indices are left for programming. 4. availableotpconfigs ?indicates how many entries are left for programming in the cp2114 configuration table. three otp configuratio ns are pre-programmed at factory default. 5. currentbootconfig ?indicates the current active boot config. this active boot config may be dictated by dac select pins, thus this might no t be the boot index in otp. if currentbootconfig is 0xff, the device will boot up with no dac. 6. availableotpconfigspace_lsb ?low byte of otp space left to support new configurations. 7. availableotpconfigspace_msb ?high byte of otp space left to support new configurations. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 42 rev. 0.5 5.6. cp2114_setramconfig description : configures the cp2114 ram configuration parame ters with the given values. these settings are written to the internal structures of the cp2114, they're not retained on power cycle. these values might not take immediate effect, device re-enumeration may be required. dynamic switch on different clock sources is no t supported using cp2114_setramconfig. if clock settings differ from those at boot up, the ne w configuration should be written to otp and configured as the new boot index. then power cyc le the device to verify the new settings. the cp2114 datasheet has more information on the audio configuration string format (cp2114_ram_config_struct). prototype : hid_uart_status cp2114_setramconfig(hid_uart_device device, pcp2114_ram_config_struct pcp2114ramconfigstruct) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pcp2114ramconfigstruct ?pointer to cp2114_ram_config_struct. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 5.7. cp2114_getramconfig description : gets the current cp2114 ram configuration parameters. prototype : hid_uart_status cp2114_getramconfig(hid_uart_device device, pcp2114_ram_config_struct pcp2114ramconfigstruct) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pcp2114ramconfigstruct ?pointer to store the 32-byte ram config. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 rev. 0.5 43 5.8. cp2114_setdacregisters description : configures the device or attached dac using multiples of 2-byte or 3-byte sequences. the first byte is dac register address or special in-band command. the following byte(s) is the data to write in the specified dac regist er if preceded by dac register address, or parameter(s) of the in-band command if preceded by reserved in-band command ids. some dacs have 8-bit registers, some have 16-bit registers. for 8-bit registers, 2-byte pairs shall be used. for 16-bit registers, 3-byte triplets shall be used. see user's guide for details on in-band commands. prototype : hid_uart_status cp2114_setdacregisters(hid_uart_device device, byte* pdacconfigbuffer, byte dacconfigbufferlength) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. pdacconfigbuffer ?pointer to the sequence buffer. 3. dacconfigbufferlength ?length in bytes of the sequences. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 5.9. cp2114_getdacregisters description : reads from the specified dac registers via the i 2 c interface. unlike cp2114_setdacregisters, this api retrieves dac register settings only without intercepting any in-band commands. the host should ensure valid dac register addresses are used. prototype : hid_uart_status cp2114_getdacregisters(hid_uart_device device, byte dacstartaddress, byte dacregisterstoread, byte* pdacconfigbuffer) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. dacstartaddress ?register address from which to start. 3. dacregisterstoread ?number of registers to read. 4. pdacconfigbuffer ?pointer to a buffer to store the data returned from the device. sufficient space must be allocated to store the data. the size of the dacconfigbuffer is: 2 (or 3) * dacregisterstoread. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 44 rev. 0.5 5.10. cp2114_getotpconfig description : retrieves a cp2114 configurationfrom otp. prototype : hid_uart_status cp2114_getotpconfig(hid_uart_device device, byte cp2114confignumber, pcp2114_config_struct pcp2114configstruct) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. cp2114confignumber ?configuration number to retrieve cp2114 otp. 3. pcp2114configstruct ?pointer to store configuration data returned from the device. typedef struct_config_struct { cp2114_ram_config_struct ramconfig; byte dacconfiguration[max_dac_config_size]; }cp2114_config_struct, *pcp2114_config_struct; return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 5.11. cp2114_createotpconfig description : creates a new cp2114 configurat ion in the available otp space. prototype : hid_uart_status cp2114_createotpconfig(hid_uart_device device, word configbufferlength, byte* pconfigbuffer) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. configbufferlength ?length in bytes of the configuration to be written to otp. 3. pconfigbuffer ?pointer to the buffer containing configuration structured per cp2114_config_struct exclud ing the "u16 length" in cp2114_ram_config_struct. the dll will aut omatically insert the length field. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 rev. 0.5 45 5.12. cp2114_setbootconfig description : specifies the cp2114 configurati on to be loaded from otp on boot. prototype : hid_uart_status cp2114_setbootconfig(hid_uart_device device, byte cp2114confignumber) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. cp2114confignumber ?configuration index that will be se t as the boot co nfiguration upon reset. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 5.13. cp2114_readotp description : returns partial or full otp customization block. the otp space must be within the range of 6 kilobytes from address 0x6800. prototype : hid_uart_statuscp2114_readotp(hid_uart_device device, uint cp2114address ,byte* preadbuffer, uint readlength) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. cp2114address ?the otp address to read from. this address must be in between 0x6800 and 0x7ffff (inclusive). 3. preadbuffer ?pointer to a byte array buffer to store data read from otp space. 4. readlength ?length of otp data to read in bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported 5.14. cp2114_writeotp description : writes partial or full otp cust omization block. the otp space must be within the range of 6 kilobytes from address 0x6800. prototype : hid_uart_statuscp2114_writeotp(hid_uart_device device, uint cp2114address ,byte* pwritebuffer, uint writelength) parameters :1. device ?device object pointer as returned by hiduart_open() . 2. cp2114address ?the otp address to start writing to. this address must be in between 0x6800 and 0x7ffff (inclusive). 3. pwritebuffer ?pointer to a byte array bu ffer that will contain values to write to the otp space. 4. writelength ?the length of write buffer in bytes. the maximum length is 6k bytes. return value : hid_uart_status = hid_uart_success hid_uart_invalid_device_object hid_uart_invalid_parameter hid_uart_device_io_failed hid_uart_device_not_supported
an433 46 rev. 0.5 6. port latch pin definition table 2 and table 3 describe the gpio bit definitions for latchvalue in hiduart_readlatch() and hiduart_writelatch() . the library will remap the bit definitions us ed by the device to match this structure. table 2. CP2110 port latch pin definition bit pin name pin number 0g p i o . 0 / c l k 1 1g p i o . 1 / r t s 2 4 2g p i o . 2 / c t s 2 3 3 gpio.3/rs485 22 4t x 2 1 5r x 2 0 6 gpio.4/tx toggle 19 7 gpio.5/rx toggle 18 8 suspend 17 9n/a 10 gpio.6 15 11 gpio.7 14 12 gpio.8 13 13 gpio.9 12 14 suspend 11 15 n/a table 3. cp2114 port latch pin definition bit cp2114 pin name cp2114 pin number 0 gpio.0_rmute 30 1 gpio.1_pmute 29 2 gpio.2_vol- 14 3 gpio.3_vol+ 13 4 gpio.4_rmuteled 12 5 gpio.5_txt_dacsel0 28 6 gpio.6_rxt_dacsel1 11
an433 rev. 0.5 47 7 gpio.7_rts_dacsel2 19 8 gpio.8_cts_dacsel3 20 9 gpio.9_clkout 22 10 gpio.10_tx 16 11 gpio.11_rx 15 12 suspend 18 13 suspend 17 14 not used not used 15 not used not used table 3. cp2114 port latch pin definition
an433 48 rev. 0.5 7. hid_uart_status return codes each library function returns an hid_uart_status return code to indicate that the function returned successfully or to describe an error. the table below describes each error code. definition value description hid_uart_success 0x00 function returned successfully.* hid_uart_device_not_found 0x01 indicates th at no devices are connected or that the specified device does not exist. hid_uart_invalid_handle 0x02 indicates that the handle value is null or invalid_handle_value or that the device with the specified handle does not exist. hid_uart_invalid_device_object 0 x03 indicates that the device object pointer does not match the address of a valid hid-to-uart device. hid_uart_invalid_parameter 0x04 indicates th at a pointer value is null or that an invalid setting was specified. hid_uart_invalid_request_lengt h 0x05 indicates that the spec ified number of bytes to read or write is invalid. check the read and write length limits. hid_uart_read_error 0x10 indicates that the read was not successful and did not time out. this means that the host could not get an input interrupt report. hid_uart_write_error 0x11 indicates that the write was not successful. this means that the output interrupt report failed or timed out. hid_uart_read_timed_out 0x12 indicates that a read failed to return the number of bytes requested before the read timeout elapsed. try increasing the read timeout. hid_uart_write_timed_out 0x13 indicates th at a write failed to complete sending the number of bytes requested before the write timeout elapsed. try increasing the write timeout (should be greater than 0 ms). hid_uart_device_io_failed 0x14 indicates that host was unable to get or set a feature report. the device could have been dis- connected. hid_uart_device_access_error 0x1 5 indicates that the device or device property could not be accessed. either the device is not opened, already opened when trying to open, or an error occurred when trying to get hid information. hid_uart_device_not_supported 0x16 indicates that the current device does not support the corresponding action. functions listed in this document are for the CP2110/4 only. hid_uart_unknown_error 0xff this is the default return code value. this value should never be returned. *note: set functions may return success, in dicating that the device received the request; however, there is no indication that the device actually performed the requ est (i.e., the setting was invalid). the user must call the corresponding get function to verify that the settings were properly configured.
an433 rev. 0.5 49 8. thread safety the hid-to-uart libra ry and associated functi ons are not thread-safe. this me ans that calling library functions simultaneously from multiple threads may have undesirable effects. to use the library functions in more than one thread, the user should do the following: 1. call library functions fr om within a critical section such that only a single function is being called at any given time. if a function is being called in one thread, then the user must prevent another thread from calling any function until the first function returns. 2. hiduart_read() issues a pending read request that cannot be canceled from another thread. if the user calls hiduart_close() in a different thread than the thread in which the read request was created, then the device will not be accessible after calling hiduart_close() . the thread that issued the pending read request must return/terminate successfully before the device can be accessed again. see section "9. thread read access models (for windows)" on page 50 for more information.
an433 50 rev. 0.5 9. thread read acces s models (for windows) there are several common read access models when using the hid-to-uart library. there are some restrictions on the valid use of a device handle based on these models. cancelio() can only cancel pending i/o (reads/writes) issued in the same thread in which cancelio() is called. due to this limitation, the user is responsible for cancelling pending i/o before closing the device. failure to do so will result in an inaccessible hid-to-uart device until the thread releases access to the device handle. the following tables describe five common ac cess models and the expected behavior: note: hiduart_close() calls cancelio() prior to calling closehandle() . note: hiduart_read() issues a pending read request. the request completes if at least one input report is read. the request is still pending if the operation times out. note: hiduart_cancelio() forces any pending requests issued by the same thread to complete (cancelled). * indicates that a read is still pending and was issued in th e specified thread. ? indicates that a read is still pending and was issued in one of the threads (indeterminate). table 4. single thread access model (safe) thread a thread b result hiduart_open() ?? hiduart_read()* ?? hiduart_close() ?o k table 5. split thread access model (unsafe) thread a thread b result hiduart_open() ?? ? hiduart_read() *? hiduart_close() ? error: device inaccessible ? terminate thread ok: thread relinquishes device access table 6. split thread access mode (safe) thread a thread b result hiduart_open() ? ? ? hiduart_read()* ? ? hiduart_cancelio() ? hiduart_close() ? ok
an433 rev. 0.5 51 table 7. multi-thread access model (unsafe) thread a thread b result hiduart_open() ?? hiduart_read()? hiduart_read() ?? hiduart_close() ? read() * thread a: ok read() * thread b: error: device inaccessible ? terminate thread ok: thread relinquishes device access table 8. multi-thread access model (safe) thread a thread b result hiduart_open() ?? hiduart_read()? hiduart_read()? ? ? hiduart_cancelio() ? hiduart_close() ?o k
an433 52 rev. 0.5 10. surprise removal (for windows) hiduart_gethidguid() returns the hid guid so that windows applic ations or services can register for the wm_devicechange windows message. once registered, the application will receiv e device arrival and removal notices for hid devices. the app lication must retrieve the device path to filter devices based on vid/pd. similarly, if a dbt_deviceremovecomplete message is received, then the application must check to see if the device path matches the device path of any connec ted devices. if this is the case, then the device was removed and the application must close the device. also if a dbt_devicearrival message is received, then the application might add the new device to a device list so that users can select any hid device matching the required vid/pid. see accompanying example code for information on how to implement surprise removal and device arrival. search for knowledge base article #222649, 311158, and 311153 for programming examples for c++, visual basic.net, and visual c#. the usb bridge knowledge base can be found at the following url: http://www.silabs.com/support/knowledgebase/pages/usb-bridge-knowledge-base.aspx
an433 rev. 0.5 53 d ocument c hange l ist revision 0.4 to revision 0.5 ? added support for the cp2114.
an433 54 rev. 0.5 c ontact i nformation 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 cust omers differentiate in the market with innovative low-power, s mall size, analog- intensive mixed-signal soluti ons. silicon labs' extensive patent portfolio is a testament to our unique approach and world-clas s engineering team. 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. the information in this document is believed to be accurate in all respects at the time of publ ication but is subject to change without notice. silicon laboratories assumes no responsibili ty for errors and omissions, and disclaim s responsibility for any consequences resu lting from the use of information included herein. additionally, silicon laboratories assumes no responsibility for the functioning of und escribed fea- tures or parameters. silicon laboratories reserves the right to make changes without further notice. silicon laboratories makes no warran- ty, representation or guarantee regarding t he suitability of its products for any par ticular purpose, nor does silicon laborato ries assume any liability arising out of the application or use of any product or circuit, and specif ically disclaims any and all liability, in cluding without limitation consequential or incidental damages . silicon laboratories products are not designed, intended, or authorized for use in applica tions intend- ed to support or sustain life, or for any other application in which the failure of the silicon laboratories product could crea te a situation where personal injury or death may occur. should buyer purchase or us e silicon laboratories products for any such unintended or unaut horized application, buyer shall indemnify and hold silicon laboratories harmle ss against all claims and damages.


▲Up To Search▲   

 
Price & Availability of CP2110

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X