UsbSerial library - Supports FTDI, Arduinos and other USB serial devices

Status
Not open for further replies.

Toley

Active Member
Licensed User
Longtime User
Hello Erel,

I don't know what did happen but it don't work anymore. I got this error message on the filtered log:
B4X:
Connected successfully!
Error: (IOException) java.io.IOException: Expected at least 2 bytes
On the unfiltered log I have this:
B4X:
open called for devices 00000002 in mode 0...
getAlsaDeviceName::devices 0x2 IsVoiceCallDevice 0 devName music
Reset buffer size to 4096 and latency to 92879
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 4096
Period size: 1024
Latency: 92879
Period Time: 23219
Periods: 4
Initialized ALSA PLAYBACK device music
Closing ALSA device!, curDev 0x2, curMode 0
open called for devices 00000002 in mode 0...
getAlsaDeviceName::devices 0x2 IsVoiceCallDevice 0 devName music
claimInterface 0 SUCCESS
Reset buffer size to 4096 and latency to 92879
Requested baudrate=115200, actual=115385
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Requested baudrate=9600, actual=9600
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 4096
Period size: 1024
Latency: 92879
Period Time: 23219
Periods: 4
Connected successfully!
Error: (IOException) java.io.IOException: Expected at least 2 bytes
close
Initialized ALSA PLAYBACK device music
Closing ALSA device!, curDev 0x2, curMode 0
Do you have an idea ? I'm not 100% sure but I believe I was not on version 2.50 when I first try the library.
Thank you.
 

marcomilazzo

Member
Licensed User
Longtime User
ft311d ftdi usb chip

Hi
i made the sw for the ft311d
it works but i needs ti be better.Maybe Erel can make a lib!
Now i'm trying to use the usbserial library and i have some question
1)i need to "Enable USB-Host Controller on any Android
i can't write the line in that directory! wich is the best apk or other way to write this line?
2) how did you connect the ft232r to a phone? i tried with an adaptor from the micro usb to the normal usb but obviously there is no vcc....
ciao
marc
 

marcomilazzo

Member
Licensed User
Longtime User
ft311d

Yes of course! it was only because i posted in the wrong post

can you please answer to my above questions?
wishing to use your lib,
how do i change the xml
and
is there a special adapter to connect the ft232 to the mini usb?

thank's a lot
marco
 

viriato

Member
Licensed User
Longtime User
Erel,
Thanks , I made a complete installation and now I am available to compile and run on my Samsumg Note 1 , but I am not able to communicate from my Note to serial device with FT231 , I just have program running on device no errors no activity , do you know if somebody made a try on S Note ?
Any suggestion will be welcome
Thank you
 

viriato

Member
Licensed User
Longtime User
Erel,
I got this on log , but i suppose this is related to PC emulator not device ?

-------------------------------------------------------------
LogCat connected to: emulator-5554
** Activity (main) Create, isFirst = true **


** Activity (main) Resume **


main_btnopen_click (java line: 283)
java.lang.NoClassDefFoundError: android.hardware.usb.UsbManager
at anywheresoftware.b4a.objects.UsbSerial.Open(UsbSerial.java:28)
at b4a.example1.main._btnopen_click(main.java:283)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:155)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:151)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:55)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Thanks you
 

marcomilazzo

Member
Licensed User
Longtime User
serial lib

Hi
I'm trying to get the serial lib to work!
I'm using an otg cable
Now i see that the ft232r is present (usb host controller) but the software still doesn't connect.
I connected for a try a memory card reader and it works!
Any way to resolve the problem?
ciao marco
 

marcomilazzo

Member
Licensed User
Longtime User
Hi Erel
i get "Error opening USB port"
the phone is a galaxy chat bt5330
the pnone work as accesory mode
It also reads multimedia with an otg cable
So it looks that usb is working
I tried the usbserial lib with a samsung note and it works just fine!
I'm getting crazy:BangHead:
marco
 

Scantech

Well-Known Member
Licensed User
Longtime User
Hello Erel,

Any chance we can get the updated version of this library. 2 days ago they added support for cp2102 device.

Thanks
 
Status
Not open for further replies.
Top