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

Status
Not open for further replies.

wexican

Member
Licensed User
Longtime User
Since the library is made to communicate with FTDI/Arduino (which are always 8N1) I don't see the use of changing those settings.

Hi Toley,

I agree the Arduino is fixed at 8N1 but the FTDI devices are not necessarily fixed & are usually settable, e.g. if you plug a FTDI USB to Serial adapter into your desktop pc & open the relevant comport using something like hyperterminal you are given the choice to select these parameters.
Yes most new devices are fixed to 8N1 but there definately are legacy devices out there which are not 8N1. Being able to set data bits to 7 atleast will cover older devices. Also don't forget parity, hardware handshaking etc!

Thanks, Tom:)
 

wexican

Member
Licensed User
Longtime User
@wexican, I will add it if / when they update the native library.

Thanks Erel, I had a feeling you were going to say that!
But in it's current state it is very useable & I like it very much, time to break out the XBee modules & Microchip PICs again, I feel a whole new raft of gadgets being designed!
:sign0060:
 

sebasianek

New Member
Licensed User
Longtime User
Hi all.
astreams.Write ("abcde". GetBytes ("UTF8")) sends the data to the terminal.
How to receive data from the terminal?:sign0085:
 

Thuong

Member
Licensed User
Longtime User
Last edited:

sebasianek

New Member
Licensed User
Longtime User
Thank you. Now everything works as it should. I receive and send data.

Is it possible to check when the serial interface is connected / installed? Like Usb.IsEnable ?
 

microbox

Active Member
Licensed User
Longtime User
Trouble running example program

Hi, I'm still new to B4A, I'm now trying to connect my Samsung Tab 7.7 to PC...but I was not able to make it work.
What I did ...
1. Download usb-serial-for-android-v010.jar and the USBSerial to library folder
2. Install the program example to phone.
But no dialog displayed asking whether I want to start your program.
What do you think I'm missing? I hope you anyone can help on this one.


Regards,
microbox
 

microbox

Active Member
Licensed User
Longtime User
Thanks Erel for the reply, I do have version 3.2 on my device.

Did you try to connect the Samsung device to a USB-serial converter?
I think this part is my trouble...not really clear to me how to :sign0013:
When you say USB-Serial Converter is that the USB to TTL serial converter module? I have 2 of them but only USBpl2303 chip...and there driver is USBpl2303_1.0. But not really sure how to connect them. My observation when I tried to connect the USB serial converter module to my Tablet the module does not power up(no led indicator) unlike when it's connected to the PC.
What I'm really like to see if it's possible on my setup to...
1. Connect my tablet to PC.
2. Connect tablet to serial device LCD.
Hope you can help me.

Thanks in advance,
microbox
 

scrat

Active Member
Licensed User
Longtime User
Hi

i try to use Serial USB example and i have a problem

with a FTDI converter everything works perfectly.
the system prompt to open Serial USB Example, connection and transfer are OK.

With a Leaflabs maple clone from Olimex i always get "Error opening USB port".

I have modified the xml filter with vendor ID and device ID read via lsusb
vendor id is "1eaf" .
and in unfiltered log i have this:
Unable to load component info ResolveInfo{a08f6b88 b4a.example1.main p=0 o=0 m=0x108000}
error java.lang.NumberFormatException: Invalid int: "1eaf"

Vendor Id is in hexadecimal and seems misinterpreted.

Any idea ?

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
@microbox, this library doesn't support PL2303 adapters. Try this library instead: PL2303 USB to RS232 adaptor driver

@Thuong, have you added the intent filter? Did you see the permission dialog, asking you to allow the app to access this port?

@scrat, seems like this adapter is not supported by this library.
You can see the supported adapters in the library wiki (there is a link to it in previous pages).
 

scrat

Active Member
Licensed User
Longtime User
hi

I modified th source code for my VENDOR ID and USB ID on the source code from git and now the library works.

i added in CdcAcmSerialDriver.java
supportedDevices.put(Integer.valueOf(UsbId.VENDOR_LEAFLABS),
new int[] {
UsbId.LEAFLABS_MAPLE,
});

in UsbId.java
public static final int VENDOR_LEAFLABS = 0x1eaf;
public static final int LEAFLABS_MAPLE = 0x0004;

device_filter.xml become
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 0x0403 / 0x6001: FTDI FT232R UART -->
<usb-device vendor-id="1027" product-id="24577" />

<!-- 0x2341 / Arduino -->
<usb-device vendor-id="9025" />

<!-- 0x16C0 / 0x0483: Teensyduino -->
<usb-device vendor-id="5824" product-id="1155" />

<!-- 0x1eaf / 0x0004: Maple & Olimex Maple -->
<usb-device vendor-id="7855" product-id="0004" />

</resources>

if your board is not supported you can try this method
 

viriato

Member
Licensed User
Longtime User
Trying your example "USB Serial"

Sorry if this is not the right place to ask ,
I downloaded your example and I followed up your installation procedures and everything looks ok , but I miss probably something , because I got this message ,
can you help ?

-------------------------------------------
Parsing code. Error
Error parsing program.
Error description: Unknown type: usbserial
Are you missing a library reference?
Occurred on line: 15
Dim usb As UsbSerial
------------------------------------
Thanks
 

mikisquiti

Member
Licensed User
Longtime User
USB to serial

I have downloaded USBSERIALEXAMPLE.ZIP; I have correctly compiled and installed on my Tablet but don't work never; I think my Table don't recognize my Prolific usb to serial convert; otherwaise I don't undestund why don't work never;
pls help me;
Miki
 
Status
Not open for further replies.
Top