I'm using DIGITUS DA-70160 (see https://www.reichelt.de/USB-Konvert...dex.html?ACTION=3&GROUPID=6105&ARTICLE=136302) (FT312 inside) cable to communicate via USB with Android while loading my android device.
I have tried to do all like thread https://www.b4x.com/android/forum/threads/another-usbserial-baudrate-question.29984/#post-426919
Tests with UsbSerial or felUsbSerial have been not successful. In one case baudrate is not adjustable or in other case device not found.
I got it running partial with UsbAccessory. One problem is that when I read I get error messages. Second is that it seems there is no chance to change baudrate until unplug/plug usb cable and then start software again. (It seems that FTDI app "FTDI AOA HyperTerm v1.0" has same problem with change config after first start)
The read error (1) is: java.io.IOException: ioctl failed: EINVAL (Invalid argument) at line 53.
Problem (2) is how to check if FTDIDevice (UsbAccessory) is valid?
You can see attached the values of my watches just before error (execute of FT31xIn.BytesAvailable)
I have tried to do all like thread https://www.b4x.com/android/forum/threads/another-usbserial-baudrate-question.29984/#post-426919
Tests with UsbSerial or felUsbSerial have been not successful. In one case baudrate is not adjustable or in other case device not found.
I got it running partial with UsbAccessory. One problem is that when I read I get error messages. Second is that it seems there is no chance to change baudrate until unplug/plug usb cable and then start software again. (It seems that FTDI app "FTDI AOA HyperTerm v1.0" has same problem with change config after first start)
The read error (1) is: java.io.IOException: ioctl failed: EINVAL (Invalid argument) at line 53.
Problem (2) is how to check if FTDIDevice (UsbAccessory) is valid?
B4X:
Sub Activity_Pause (UserClosed As Boolean)
If FT31xIn.IsInitialized And UserClosed Then
FT31xIn.Close
FT31xOut.Close
FTDIDevice.Close ' (2) How to test if FTDIDevice is assigned or isInitialised ??
Log("FTDI closed")
End If
End Sub
Sub ButtonSend_Click
If FT31xOut.IsInitialized Then
Dim buffer(2) As Byte
buffer(0) = 0
buffer(1) = Asc("U")
FT31xOut.WriteBytes(buffer, 0, buffer.Length)
End If
If FT31xIn.IsInitialized Then
Dim i As Int = FT31xIn.BytesAvailable ' (1) Error: java.io.IOException: ioctl failed: EINVAL (Invalid argument)
If i > 0 Then
Dim inBuff(i) As Byte
Log("FTDIread " & FT31xIn.ReadBytes(inBuff,0,i))
End If
End If
End Sub
You can see attached the values of my watches just before error (execute of FT31xIn.BytesAvailable)
Attachments
Last edited: