Android Question Error in usb communication.

k.a.m.

Member
Licensed User
Longtime User
hello. I was trying to connect my android device to the b4a. I installed the usbserial example and also copied the libraries. But i am getting an error: Error opening USB port. what could be the reason and the possible solution? thank you.
 

k.a.m.

Member
Licensed User
Longtime User
Ok this is exactly what i want to do. I want get data from my micro controller in the form of a text. then I will be sending the data to my smartphone and converting that text in speech format.

I am new to B4A. for now, what i want to do is that i have to send certain word using usb communication to the android phone and then that is converted into speech output. I did the text2speech thing. But i was trying to do the usb communication and it failed giving me an error "Error opening USB port." I used the code and the method given on http://www.b4x.com/android/forum/th...-arduinos-and-other-usb-serial-devices.24835/

what i did was

1. load the example.
2. include libraries, and xml in the manifest.
3. i compiled the code and using the b4a bridge, i installed the program in my smartphone.
4. i clicked on open-> start on my phone and it gave that error in the log in b4a.

what could be the problem? all i want is the communication to be established between my phone and b4a, and so that I can send some data to my phone and convert it in speech. speech part is done. the communication remains. plz help
 
Upvote 0

k.a.m.

Member
Licensed User
Longtime User
ehh... I am a newbie to all of this.. so could you maybe put it in some layman terms?
 
Upvote 0

alexhi

Member
Licensed User
Longtime User
Sorry my bad English
mast
1.ROOT device (make ROOT)
2. add in device (Root Explorer)
<permissions>
<feature name="android.hardware.usb.host">
</ feature> </ permissions>
into the folder / system / etc / permissions
3.reboot device
4.connect microcontroller device ( USB chips CP2102, FT232 ,PL2301 )
5. Test my terminal
https://play.google.com/store/apps/details?id=ru.shipov.termusb&hl=ru
6. Write your application
I think Erel or walterf25 better explain in English. Sorry
 
Upvote 0

k.a.m.

Member
Licensed User
Longtime User
yeah..no problem alexhi..thank u so much for trying ..
@erel and walterf25, i am getting the error of unable to run the usb communication. As written in comment #7, I did as said but i get error of unable to open usb port. what is the issue?? please help
 
Upvote 0

Tom Christman

Active Member
Licensed User
Longtime User
The issue is:
a) The Usb library requires that you use a usb device containing a USB chip CP2102, FT232 , or PL2301.(Google these) I suggest "FT232-FTDI" cables 3.3volts or 5volts. http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm

b) Connect this Usb cable to your microcontroller device serial port (Tx, Rx)
Note: The above connection is for TTL signal levels. If the signals are +/- use a different FTDI cable device.

c) You must root your device (meaning your device will allow you read /write access to files on your device) (Google "Root your phone/tablet".)

Note: Rooting your device is not necessarily easy, nor is it usually recommended, but it does allow you to change your device to add features and give you more control of your device. In this case your device, in its original configuration, is not set up to allow the use of the Usb. Therefore you must edit the "permissions" file of your android device and add a line that allows hardware Usb. In order to edit some files on your device, the device must be rooted.

d) The file you must modify is located in a folder (on your android device) called (/ system / etc / permissions) and is (read-only) so you must change it to (read-write) using an editor.

e) Add the text <feature name="android.hardware.usb.host"> in the above identified file.

f) The reference to "Test my terminal" refers to testing if Usb is now functioning. Use UsbSerial2.3 by agraham demo program to test your Usb.

g) Hope this helps
 
Upvote 0

k.a.m.

Member
Licensed User
Longtime User
I have got a board having the FT232RL chip.. but i am not understanding where to start ... as in, do i use the same code given in the sample again?
or are there any changes that i need to make?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…