I´m having problems communicating via OTG to a Arduino UNO.
That can I see is that the port can't initialize.
I´m using the extencion SerialOtg Extension Version: 1 Date Built: 2022-04-13.
Hi @rkl099 I modified the blocks, thanks a lot.
Now I can see that the problem is When I call the function Serial OTG1 Open, it returns "false". Can't open the serial port.
Do you use an original UNO?
Can you access the Arduino with a serial terminal?
Do you get a message to allow the app to use USB Serial the first time you press Open?
I don't think it makes a difference to have the cable connected or not when calling Initialize. The program only initialize internal variables depending on if it's for Serial OTG, BT or WIFI connection. The program does not look for any device or connection before Open.
But you may have to disconnect and reconnect the cable, to make Android to detect the OTG device after an error.
You may also have to restart the AI Companion.
It works with most Arduino boards, but the built in AI Serial only works with original Arduino UNO and boards with the same USB-serial converter. My advice is to test with a serial terminal APP so you can verify that your USB OTG cable works, before you start to test your AI APP.
Make a simple program in the Aurdino that in a loop read a character and write it back on the serial line.
The you can verify step for step:
first Initialize (I normally put this in screen initialize)
.Then Open. First time, do you get a pop-up that asks for permission to use USB device?
Net time you press open, do you get IsOpen=True?
If this is ok, but communication does not work, check baudrate stopbits parity etc.
It seems to be the same converter chip on the boards, 16u2 programmed as an USB.serial converter. If you can program the first board, then you shall be able to use it with SerialOTG. You can test it with a computer an see what it reports. It should be VID=0x2341 (PID=0x0043) and cdc_acm protocol to be recognized as an UNO. I use linux and dmesg to list this or use device manager in Windows.
Arduino forum also mentions VID=0x2a03 as an UNO. Can anyone verify this?
This can be included in SerialOTG.
Hello Mr. @rkl099 , I used the extencion SerialOtg to work with Android 11; recently updated to Android 12 and the extension is broken. Get an Runtime error message indicating that the app must specify FLAG_IMMUTABLE when creating a PendingIntent. Hopefully you can update it?. It has been a very useful extension. Thanks very much.
got the same issue, it wont open serial port, i used this solution but it didnt work..
got Android10,
using serialOTG.apk in the solution
but when i using the "serial usb terminal" application, i get a popup "do you want serial usb terminal have access to serialdevice?"... then i click yes and i can data coming to phone...
The same issue as ...?
Can you describe what happens when you try to open the serial port?
What serial device are you using?
USB serial converter, Arduino original or Arduino clone or somthing else?
Can you get VID and PID for the device using windows device manager or Linux dmesg?
it wont open the port... i use serialotg.aix version 2022-11-05, importing(upgrading) into serialotg.aia project, build and installing .apk
the device i use is a serial device, seeedstudios XIAO
i guess this is VID/PID
i connect otg-cable with the XIAO
i start the serialotg application
then i try pressing "open", response is "not open" and no led indication it did work on the XIAO
i tried also this, according to .pdf
It has been reported that there is a difference in the behavior of SerialOTG and Serial USB
Terminal. This is because SerialOTG has DTR, RTS =0 as default (as AI built in component),
SerialTerminal has DTR, RTS =1. This may be set as a property or in the blocks before open.
This VID/PID is not included in the library, but can be added.
Serial over USB uses USB CDC (reference Seeed Studio XIAO SAMD21 by Nanase - Seeed Wiki) but i don't know if this is included in the bootloader. Other references talk about FDDI, but this needs a separate chip or USB converter, so i guess that this is for the chips UART pins.
Can you see in the serial terminal if it uses CDC protocol?
I succeeded to communicate using "serial USB terminal" application with 9600baud/8bit/None/1stop bits with CDC protocol. I can then see tx-led flashing on the XIAO and read the values in the terminal.