CP2130 WriteRead Command using LibUSB for Linux

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero Employee</font></font> </a> Jiehui on ‎08-22-2017 11:47 PM

The CP2130 USB Endpoint 1 uses a double-buffered FIFO, whereas Endpoint 2 uses a single-buffered FIFO. To improve SPI data transfer performance, Endpoint 1 can be used to double-buffer read data or write data transfer packets.

 

Table below shows the CP2130 USB Bulk endpoint usage for different device configuration.

Device Configuration

Bulk OUT 

(Write)

Bulk IN 

(Read)

High-Priority Write Mode EP1 EP2
High-Priority Read Mode EP2 EP1

 

By default, the CP2130 is configured in high-priority write mode.

 

AN792 describes CP2130 Interface Specification, and AN792SW contains an example for CP2130 Write and Read commands using libusb for Linux. Just a reminder that there is a known bug on the cp2130_libusb_read_example(), the endpoint for the 2nd libusb_bulk_transfer() call should be 0x82 indicating using Bulk IN endpoint 2.

 

Below is an example for the CP2130 WriteRead command.

CP2130_WriteRead_libusb.png