Using serial with FTDI

Thanks,

This is what I think I am doing. This is the Arduino code:

#include <DigiCDC.h>
void setup() {                
  // initialize the digital pin as an output.
  SerialUSB.begin(); 
  pinMode(1,OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  
  if (SerialUSB.available()) {
    char input = SerialUSB.read();
    if(input == '0')
      digitalWrite(1,LOW);
    else if(input == '1')
      digitalWrite(1,HIGH);
      
  }
  
   SerialUSB.delay(100);               // keep usb alive // can alos use SerialUSB.refresh();
}

And the ATTINY85 can be detected in Windows, also in Android, but using the serial USB terminal app from Google Play.

Using the SerialOTG in my app I can detect other device connected to the same Android ( com.physicaloid_ai.lib.usb.driver.uart.UartWinCH34x), but not my ATTINY85, even if it is the only connected device.

Thanks

Interesting application with USB support on this small board. I have added support for ATTINY85 VID 0x16D0 9 in com.SerialOTG. I also updated my test program SerialOTG.apk. You can download them at https://github.com/rkl099/Appinventor_Debug. I have tested the led application on a ATTINY85 that I had and it seems to work. it has a different PID, but it's not used in the library. Please test and tell me if it works OK.

Yes, now it works as expected, thanks a lot.

Trying now to workaround the issue of having more than one USB device attached to Android.

Thanks again.

@rkl099 Does this extension work on Arduino Nano 33 Ble Sense?

I have not tested this Arduino board. SerialOTG only supports Bluetooth classic (ver 3.0) and the Arduino seems to only support Ble. I don’t know if there is an Arduino library for Bt classic.

Serial over USB OTG (VID 2341) should work, but not tested.

1 Like

I have made an update of the extension SerialOTG to work with Android12. I don't have a device with Android12, so I have to ask someone else to test it. It's available at GitHub - rkl099/Appinventor_Debug: Debug versions: SerialOTG Add support for Android12. com.SerialOTG.aix
Please test it and report to me.

Hi, i have Android 12S (Galaxy21FE5G). The extension gives still an error: "Runtime Error Attempt to invoke virtual method 'boolean com.physicaloid_ai.lib.framework.SerialCommunicator.open()' on a null object reference"
Maybe this helps Johannes

What device are you trying to connect to?

It works! My device is an Arduino micro (ATmega32U4). But works only with connected device and at 2nd try. Without the device i got the error like my first answer. In older versions i got no error message without device.

my serial routine

With second try, do you mean that at first try you have to give permission to use the device and on second try you actually open the device?

I have made some changes to be able to include new vid/pid for new devices. I will look into the open without device error.

without device:
touch USB --> error message: "Runtime Error Attempt to invoke virtual method 'boolean com.physicaloid_ai.lib.framework.SerialCommunicator.open()' on a null object reference";
key serialUSB: disconnect, key driver: none

connect device --> message wich app should access to the device ? (have some serial terminal apps); key serialUSB: disconnect, key driver: none

ignore! but touch USB --> message goes away, but USB Button still black;
key serialUSB: disconnect, key driver: none

touch USB again --> message access to Arduino micro?; USB Button yellow;
key serialUSB: try again, key driver: none

quit message with OK --> nothing happens;
key serialUSB: try again, key driver: none

touch USB --> USB Button goes black;
key serialUSB: disconnect, key driver: none

touch USB --> USB Button goes yellow;
key serialUSB: connect, key driver: com.physical....CdcAcm

THEN ITS WORKING :slight_smile:

Here I can't imp
PrzechwytywanieSerialOtg_20221013_forAndroid12
ort this extension (both production and test):

I have no problem to import in AI2 nb190a September 29, 2022. Don't know what the problem can be in the bugfixes version.

Also tested to import in the -bugfixes version without any problems.

Thanks Rolf @rkl099 .
You made me pull file again - different size, loads fine.
p.s. : one should pull file (git or download as zip) NOT try dowloading single file

Thanks again @rkl099 for fixing intent. Now I have same problem as @Johannes_Fritzsche described (here Samsung S21).
When Open method is invoked on unconnected usb cable it throws error (can't catch by Screen.ErrorOccured). Previously Open just returned 0.
I can't find a check method to invoke before Open so to avoid this problem but IMHO I liked better just returning 0 by Open.
Once I know this I will check if it survives disconnecting usb/serial cable...
Best regards and thanks for a great component Rolf and sorry for bothering you!
Kuba

The original Physicaloid library checked the VID/PID in two programs. I made a change to have a single table define VID/PID and driver. This was an undetected side effect and will be corrected in the future.
It will be easier to include new PID/VID:s and if possible, include a function for user defined VID/PID/driver definition.

Thanks dear Rolf @rkl099 for the info but I'm afraid I's appreciate simpler version of answer:

  1. When to expect fix?
  2. Is there any workaround I can code?
    Regards kuba

No workaround but I have updated the extension to report "not open" if no USB device connected. The selection of driver is now in a single table, depending on VID or VID/PID. Tested with the USB devices I have. Please try it and report to me.