mik3y / usb-serial-for-android

Android USB host serial driver library for CDC, FTDI, Arduino and other devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Packet loss over usb connection as a com port on an Android tablet

RogueUrsa opened this issue · comments

Hi,
I was wondering if anyone else had experienced packet loss over USB on android and if there were common 'known' solutions. I have been using windoze for a while with an application that trasmits 40byte packets at 4kHz. there is no loss under windows using a matlab interface. However switching to an android tablet using a java based interface i have started to experience sporadic data drops.

it was queried if it was a blocking issue by my software team and i got this feedback from the engineer:
In the firmware the device uses TI's USB CDC driver and calls cdcSendDataInBackground(). This function is not a non-blocking function but rather will only block if any data previously send to the USB CDC has not been cleared by the host.

what i did note in a quick test i ran was that switching the tablet to airplane mode significantly reduced the packet loss (knowing the wifi on the tablet to be unstable at times and to randomly poll for connection). I am not sure if this is the whole issue,but am wondering if this is about priorities of processes maybe?

Any experiences with where to look for a solution would be deeply appreciated

using separate Threads like SerialInputOutputManager.java, increasing thread priority, merging unprocessed data into chunks might help