Seeeduino XIAO SAMD21 Realdash-CAN not working on Android

Hi dear @realdashdev,

I am facing a peculiar issue.

I’m digitizing the analog signals from the old dashboard wires into a Seeeduino XIAO chip (Arduino), and utilizing the Realdash-CAN example to send CAN messages.

When I launch the Realdash on Android, it fails to connect.

Few Datapoints:

  1. Code works well on the Windows version. As soon as I launch the app, the Serial connection is established, and data flows perfectly.
  2. The baud rates etc are all double-checked.
  3. To isolate the issue, I’ve even flashed your original code without any alterations (from GitHub), and faced the same results.
  4. Interestingly, When I launch 3rd party USB Serial Monitor on an Android device, data start flowing to that app ok.
  5. Same code works fine with Android on different Arduino chip (ESP32), however, ESP32 is an overkill for this.

Note: I have sent the serial log through the app already. The time is roughly 6:02 PM GMT+5, Feb 23, 2023.
I’m also attaching a link to a video that showcases the issue.

Many Thanks.

From the uploaded log:

23.2.2023, 18:00:39.195: SERIAL: Exception in findSerialDevice: java.lang.SecurityException:
User has not given 10399/com.napko.RealDash permission to access device /dev/bus/usb/002/002

I was suspecting that. Now, how would I give that permission?

If for the first time you do not give the permission, this setting is very well hidden into Android settings, and unfortunately almost every Android version has it somewhere different.

Hi @realdashdev,

Thanks for this, i will look into this, but from my experience, could it might be a new security restriction in a newer version of android? Sometimes for android permission to work on newer versions, the user needs to give explicit permission. For instance, the other Terminal App asks the permission each time.

Update: I’ve just installed the app on a new device and connected the XIAO SAMD21, and it did not ask any permission at all even on the first connection. @realdashdev, do you want me to send some sample chips your way?

When you plug-in your USB cable, there should be a OS popup asking of which app you want to use with this USB connection.

Nope, it does not. I’ve tested this on multiple Samsung Phones, as well as Raspberry Pi running LineageOS.

As I mentioned earlier:

  • same code with ESP32, works just fine without any permission popups.
  • Different app works with XIAO chip, but ask for permissions before connecting.

What are the VID and PID of that USB device?

In windows, it says VID 2886 and PID 202F.
Not sure if these IDs are common across platforms

I will add this to next release assuming it is a CDCACM chip.

It does work as CDC by default, if that’s what you mean.

Also, not sure if this will help, but it does work fine on Windows version of Realdash. the issue is with Android version.

As always, thanks a ton!

On Android, apps must use a manifest file to declare all VID/PID devices that it is capable of using. That is the reason problem is only on Android.

Quick Update. I’ve managed to set up an accelerometer, but will continue in this thread since the root cause is still serial with this chip. It seems that its not willing to Initiate the Serial Communication on Windows nor Android. In windows, once the Serial is initiated via Serial Monitor of Arduino, it works. But it does not initiate on its own.

Arduinos boot in bootloader mode. You have to add up to 5 seconds of delay for the connection start. This is available in Connection settings ‘Advanced’ button.

1 Like

HI, Tried 6200 msec delay, still no luck. Not initiating the communication.

Then I close the Realdash app. Launch Arduino Serial Monitor to initiate the connection.
After that, I close the serial monitor, and re-launch RealDash, and it works.

Update: Seems like the issue was with my code. I’ve added while (!Serial); in my arduino setup() code, and it seems to have solved the issue. at least on Windows version. Will test on Linux tomorrow

1 Like

Update: All works well on Linux. Will post an update as a showcase of my set up soon

1 Like