USBXpress/Direct Access device problems in Android OS

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> MitchC on ‎12-30-2016 09:23 AM

Symptoms

I am using the USBXpress/Direct Access firmware library on my 8-bit MCU, and data transfers to/from the device works fine with Windows hosts. When using an Android host, the bulk transfer from the host to the device appears to work, but I am unable to read data from the device USB OUT FIFO (i.e. embedded calls to "Block_Read(*buffer,number of bytes)" fail).  

Diagnosis

This can be caused by differences in the host OS USB control transfers that occur when the USB device is opened by the host.  On the Windows system, following a library command "SI_Open()," the host sends two setup commands:

0x40 0x00 0xFF 0xFF 0x00 0x00 0x00 0x00

0x40 0x02 0x02 0x00 0x00 0x00 0x00 0x00

 

followed by an In command Data1 length = 0.

 

In some cases, theses setup commands and the In command Data1 length = 0 are not sent by the Android host (when using the Android USB library and the "openDevice()" method).

Solution

Try adding control transfer commands with the data mentioned above before the bulk transfer commands.  For instance:

 

 

 

connection.ControlTransfer(0x40,0x00,0xFF,0xFF,OBuf,0,0);
connection.ControlTransfer(0x40,0x02,0x02,0,OBuf,0,0);