Read "Arduino Due" data sent via SerialUSB.print() with external program

Hi everyone! I am using an Arduino Due board as an interface between a position analyzer and my computer. So far, I have been able to exploit the serial communication to read data from the board and save them in a text file.

Process:

  • once in the setup() function, Serial.begin(115200) is called
  • at some point during the loop(), the board sends data through Serial.print();
  • An external program is used to read the virtual serial port (at the moment, I am using these Matlab functions, but any language is fine);
  • Data are stored in a text file;

Since the Arduino Due has a native USB port (which should be way way faster than virtual serial communication) is there a way to directly read the data sent via SerialUSB.print() in a similar fashion? That is, is there any code to read the data sent from the Arduino Due to the computer via native USB using the whole USB 2.0 bandwidth? If possible, I would like to see a coding example in C, C++, C#, VBScript or Matlab (last one would be the favourite option) - or a good link where to retrieve information about it.

I need to read as high as ~150 Kbyte and at the moment this needs ~10 seconds to be accomplished with the standard serial communication.

Any clue would be appreciated, Thanks in advance.

~Andrea Jens

Additional information (if needed): * programming software: Arduino IDE 1.6.3 * software I am using to read serial port: Matlab 2015a I have googled it for three days without any good results, so this is why I am asking here ;)

The correct subforum for this is Interfacing with Software on the Computer (A mod may move the thread.)

There must be a dozen examples there.

If you already have it working through the programming port, then it should work on the native port with no modification on the PC side except selecting the correct virtual COM port. Have you tried it?

One little trick for the Arduinos with native USB (Due, Micro, Leonardo, Teensy) is to put while(!SerialUSB); after Serial.begin();. This will cause it to wait until the receiving application is connected to the virtual COM port.

The correct subforum for this is Interfacing with Software on the Computer (A mod may move the thread.)

There must be a dozen examples there.

If you already have it working through the programming port, then it should work on the native port with no modification on the PC side except selecting the correct virtual COM port. Have you tried it?

One little trick for the Arduinos with native USB (Due, Micro, Leonardo, Teensy) is to put while(!SerialUSB); after Serial.begin();. This will cause it to wait until the receiving application is connected to the virtual COM port.

Actually, my post was already in that section and a mod moved it here o.O Anyway, I know what you told, but I found no example on how to interface/write a program to read the USB output of the Arduino Due: the only examples I have found were meant to read from the virtual serial port (a.k.a. Programming Port) - which I don't need, since I already know how to do that.

My only concern is... can I read the native USB like a serial port but at full speed (i.e. ignoring baud rate)? If so, this solves my problems!

Thank you very much,

~Andrea Jens

Did you try it? The software on the computer doesn't know there's a difference between the native and programming ports.

It quite obviously works at full speed with the Arduino serial monitor. Matlab will work too.

I cannot try before Monday, since the board is already connected to the instrumentation ;) I will try out and let you know! Thanks a lot!

~Andrea Jens

Hey, AndreaJens! Can I see your code? I mean how do you implement communication between arduino and matlab and save data to file. If it is open source, of course)!