0

I am working with samsung t365(android 4.4.4) and it is communicate with one uart quite good. But I need to use multiple (two) uart to communicate with one android device's only one port. When I use usb hub (S-LİNK SL-U602 USB 2.0) and use uart term application from play market I can see both uart by selecting ports. Question is:

  • Is it possible to use com ports programmatically choosing and do the work,
  • What might be challange (with multiple uarts)

Thank you.

boy
  • 187
  • 1
  • 9

2 Answers2

0

Try with android-serialport-api library.
As per RS232 standard, only one device per COM port is allowed.

Community
  • 1
  • 1
Igor Gorjanc
  • 535
  • 4
  • 17
0

In FTdriver.java there is a begin method which can help to connect multi device. But, in default it is setted for first device. as you can see in comment line. It should be modified for multi connection. reference: https://github.com/ksksue/FTDriver/blob/master/FTDriver/src/jp/ksksue/driver/serial/FTDriver.java

// Open an FTDI USB Device
        public boolean begin(int baudrate) {
            for (UsbDevice device : mManager.getDeviceList().values()) {
                Log.i(TAG, "Devices : " + device.toString());

                getPermission(device);
                if (!mManager.hasPermission(device)) {
                    return false;
                }

                // TODO: support any connections(current version find a first
                // device)
                if (getUsbInterfaces(device)) {
                    break;
                }
            }

            if (mSelectedDeviceInfo == null) {
                return false;
            }

            if (mDevice == null) {
                return false;
            }

            if (mDevice.getDeviceClass() == UsbConstants.USB_CLASS_COMM) {
                isCDC = true;
            } else {
                isCDC = false;
            }

            mFTDIEndpointIN = new UsbEndpoint[mSelectedDeviceInfo.mNumOfChannels];
            mFTDIEndpointOUT = new UsbEndpoint[mSelectedDeviceInfo.mNumOfChannels];

            if (isCDC) {
                if (!getCdcEndpoint()) {
                    return false;
                }
            } else {
                if (!setFTDIEndpoints(mInterface,
                        mSelectedDeviceInfo.mNumOfChannels)) {
                    return false;
                }
            }

            if (isCDC) {
                initCdcAcm(mDeviceConnection, baudrate);
            } else {
                initFTDIChip(mDeviceConnection, baudrate);
            }

            Log.i(TAG, "Device Serial : " + mDeviceConnection.getSerial());

            return true;
    }
boy
  • 187
  • 1
  • 9