CP2501EK Silicon Laboratories Inc, CP2501EK Datasheet
CP2501EK
Specifications of CP2501EK
Related parts for CP2501EK
CP2501EK Summary of contents
Page 1
CP2501 Programmer’s Guide and API Specification 1. Introduction The CP2501 devices are programmable, 8051-based devices that add a Windows-compatible, HID USB touch- screen interface to multi-touch devices, including touch-screens and pen inputs. The CP2501 devices include pre- programmed System Firmware ...
Page 2
AN464 3.1.1. Device Tab Figure 1. CP2501 Configuration Wizard Device Tab The Device tab includes the configuration options for the CP2501 oscillator, regulator and USB descriptors. See the CP2501 data sheet for more details. The Default Input Mode selection chooses ...
Page 3
Communication Tab Figure 2. CP2501 Configuration Wizard Device Tab This tab configures the communication interface to use between the CP2501 device and the touch screen module. Only one communication interface can be active at any time as the memory ...
Page 4
AN464 3.1.3. Screen Tab Figure 3. CP2501 Configuration Wizard Screen Tab The Screen Width and Screen Height refer to the target display of the USB host, and not the touch screen itself. Windows requires these dimensions as part of the ...
Page 5
Touch Tab Figure 4. CP2501 Configuration Wizard Touch Tab This tab configures the maximum number of touch points supported by the touch screen module. If the touch screen has the capability to report extra usage information, such as Confidence ...
Page 6
AN464 3.1.5. Pen Tab Figure 5. CP2501 Configuration Wizard Pen Tab This tab enables a pen input for the touch screen module. If the touch screen has the capability to report extra usage information, such as Tilt or Pressure, those ...
Page 7
Mouse Tab Figure 6. CP2501 Configuration Wizard Mouse Tab This tab configures the USB descriptor to include mouse support and select the number of buttons supported by the mouse. Even if the final product does not support mouse functionality, ...
Page 8
AN464 3.1.7. GPIO Tab Figure 7. CP2501 Configuration Wizard GPIO Tab The GPIO tab configures the mode of each GPIO pin. For pins that are selected as outputs, the initial latch value is also configurable. Set unused GPIO pins to ...
Page 9
Project Generation Figure 8. CP2501 Configuration Wizard Project Generation Once all of the options are configured, the project is ready to be generated. First, select the desired Toolchain from the drop-down menu. The choices are Keil, Raisonance, and SDCC. ...
Page 10
AN464 3.2. Project Directory Structure The output of the Configuration Wizard includes the files listed in Table 1. Table 1. Configuration Wizard Output Files File Name compiler_defs.h Includes basic type and prototype definitions that enable compiler inde- pendent code. CP250x_API.h ...
Page 11
Code Flow Diagrams The primary requirements of the user firmware are to retrieve data from the touch screen module, calculate the touch/mouse coordinates and any corresponding usage information such as IN_RANGE and TIP_SWITCH, and copy the data to the ...
Page 12
AN464 3.4. Using the CP2501 Examples The CP2501 installation package includes an \Examples\ directory which includes basic firmware projects that show how to use the three different interface options (UART, SPI, and SMBus). A fourth example, CP2501_NoScreen, is also included. ...
Page 13
CP2501 API Reference 4.1. Index of API functions Table 2 includes all of the functions provided by System Firmware. CP250x_System_Init() CP250x_USB_Init() CP250x_GPIO_Init() CP250x_USB_Suspend CP250x_USB_Suspend_For_Remote_Wakeup() CP250x_Remote_Wakeup() CP250x_UART_Init() CP250x_UART_Write() CP250x_UART_Dequeue() CP250x_UART_Poll() CP250x_SPI_Master_Init() CP250x_SPI_Master_Transfer() CP250x_SPI_Poll() CP250x_SMBus_Master_Init() CP250x_SMBus_Master_Transfer() CP250x_SMBus_Poll() CP250x_Start_Counter() CP250x_Stop_Counter() Table 2. ...
Page 14
AN464 4.2. Memory Buffers and System Variables The following memory buffers and variables are shared between the user firmware and System Firmware. These variables are absolutely located and the user firmware should not use these memory locations. 4.2.1. Memory Buffers ...
Page 15
Shared Variables Table list of all variables shared between the System Firmware and user firmware. User firmware should only write to the bytes/bits that are marked as Write. Name CP250x_System_Flags CP250x_USB_Touch_Send_Pending CP250x_USB_Mouse_Send_Pending CP250x_USB_Pen_Send_Pending CP250x_UART_RX_Data_Ready CP250x_USB_Enter_Suspend CP250x_System_Modes ...
Page 16
AN464 4.2.2.1. CP250x_System_Flags The CP250x_System_Flags are used to indicate when certain types of data are ready for processing by the user firmware or by the System Firmware. CP250x_USB_Touch_Send_Pending: User firmware should set this bit once new touch data has been ...
Page 17
CP250x_Control_Flags CP250x_USB_Control_Write: When set, indicates to user firmware that the USB host has sent data to the device. The received data is stored in USB_Control_Buffer. User firmware should clear this bit once the data is read from the USB_Control_Buffer. ...
Page 18
AN464 4.3. System Configuration Functions The function prototypes defined in the following sections are macro calls which are defined in CP250x_API.h. The macro calls copy the function parameters to specific XRAM variables CP250x_Param1 through CP250x_Param7 as required. The return value ...
Page 19
CP250x_GPIO_Init Description: Initializes the GPIO pin modes and their initial values. Prototype: void CP250x_GPIO_Init (U8 gpio70_mode, U8 gpio158_mode,U8 gpio70_latch, U8 gpio158_latch); Example Call: CP250x_GPIO_Init (0xFF, 0xFF, 0x00, 0x00); Parameters: 1. gpio70_mode—Configures the mode for GPIO pins 7:0. Set corresponding ...
Page 20
AN464 4.4. USB Suspend Functions 4.4.1. CP250x_USB_Suspend Description: When the USB host signals the CP2501 device to enter USB suspend mode, the System Firm- ware sets the CP250x_USB_Enter_Suspend bit which should be polled as part of the main() loop. Once ...
Page 21
CP250x_USB_Remote_Wakeup Description: User firmware calls this function to wake up the USB host using remote wakeup signalling. This function should only be called when the device Suspend state entered by calling CP250x_USB_Suspend_Remote_Wakeup(). Once the USB host ...
Page 22
AN464 4.5. Interface Functions 4.5.1. CP250x_UART_Init Description: Initializes the UART peripheral and resets the transmit and receive buffers. Prototype: void CP250x_UART_Init stop_bits); Example Call: CP250x_UART_Init (115200, EIGHT_DATA_BITS, NO_PARITY, ONE_STOP_BIT); Parameters: 1. baud_rate—The speed in bits per second at which the ...
Page 23
CP250x_UART_Dequeue Description: Returns one byte from the Comm_Rx_Buffer, which is a circular FIFO. The System Firmware will set the CP250x_UART_RX_Data_Ready CP250x_UART_RX_Data_Ready bit will stay set to 1b until no new data remains in the Comm_Rx_Buffer. If this function is ...
Page 24
AN464 4.5.5. CP250x_SPI_Master_Init Description: Initializes the SPI peripheral and resets the transmit and receive buffers. Prototype: void CP250x_SPI_Master_Init (U32 clock_rate, U8 polarity_phase); Example Call: CP250x_SPI_Master_Init (1000000, PH1_POLL0); Parameters: 1. clock_rate—The speed in bits per second at which the SPI transmits ...
Page 25
SPI slave into the Comm_Rx_Buffer. The DummyByte is ignored in this configuration. 2. length—The number of bytes to transfer to/from the SPI slave device. 3. dummy_byte—This byte is used only during a SPI_READ ...
Page 26
AN464 4.5.9. CP250x_SMBus_Master_Transfer Description: Transmits and receives data using the SMBus interface. The function can Write data or Read data. Data is transmitted from the Comm_Tx_Buffer. Data must be copied to the Comm_Tx_Buffer before calling the function. When data is ...
Page 27
Counter Functions 4.6.1. CP250x_Start_Counter Description: Restarts the counter stopped and sets the RUN bit in CP250x_Counter_Status. Also resets the internal timer so that the next increment of the CP250x_Counter variable will occur 500 µs after this ...
Page 28
AN464 4.7. CP250x_Status Return Values Each System Firmware API function returns a value in CP250x_Status after the function to indicate that the function returned successfully or to describe an error. describes each error code. Note: All functions share the same ...
Page 29
CP2501 Bootloader The CP2501 devices’ user firmware is updatable in-system through the debug pins or through the System Firmware’s USB bootloader. The CP2501 Bootloader application is a Windows program that accepts a standard Intel hex file as the input. ...
Page 30
... Should Buyer purchase or use Silicon Laboratories products for any such unintended or unauthorized ap- plication, Buyer shall indemnify and hold Silicon Laboratories harmless against all claims and damages. 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. ...