1
votes

I'm having trouble understanding how to communicate my android app to communicate with a custom board via serial connection. The android software supports USB host mode.

My android 3.1+ tablet as USB host <-----packet of bytes-----> custom board at 9600 baud rate

Here's what I understand about setting up my app:

  1. Using USB manager I find my USB device (custom board)
  2. After finding my USB device I set up a USBInterface to communicate.
  3. Using the USBInterface I need to find the USBEndpoint(can someone tell me what that is?)
  4. I can now use USBDeviceConnection to send and recieve information.

Any help to understand the process helps. Thanks

1

1 Answers

0
votes

Think of endpoints as virtual conduits with defined behaviors, similar to sockets.

Endpoints for USB CDC devices consist of a control endpoint, a bulk IN, a bulk OUT, and an "interrupt" endpoint. The control endpoint is bi-directional and is used for configuring the connection. Once the connection is configured, the BULK IN is where the tablet will receive data (think RX) and BULK OUT will be where the tablet sends data (think TX). The interrupt endpoint is IN-ONLY and will notify the tablet of any state changes from the device.

The endpoint locations and functionality are specified by the device in its USB Interface Descriptor. The Host protocol stack will retrieve that descriptor and have it available for the application layer to use.

You will use the control endpoint to configure items such as baud rate, parity, stop bits, etc.