Arduino Due Native USB communication with Matlab

조회 수: 5 (최근 30일)
Aviel Moos
Aviel Moos 2019년 7월 22일
편집: Walter Roberson 2020년 2월 6일
Hello,
I am currently sending data from the Arduino native USB port and I want to plot it on matlab.
Now I am tring to use high-speed comunication and as far as I understand this port does not transfer data in a specific Baud-Rate.
I need to send from the arduino about 25kB of data each second (about 12,500 samples of 2 Bytes).
In order to send the information am using at the arduino end this function: SerialUSB.write();
Now I need to recive this data to matlab.
My questions:
  1. How can I recive this data at this rate?
  2. This data are audio samples - how can I plot it?
Another importent thing is that all of that NEEDS TO BE REAL-TIME.

답변 (2개)

Prasad Parameswaran
Prasad Parameswaran 2019년 10월 21일
SerialUSB approach is recommended when using Arduino Due USB port. The BaudRate vale is not revelent while using SerialUSB.
The performance can be improved by writing data asynchronously and trying to read only if bytes are available.
The following link might help in use of Arduino Due for high speed Communication.
  댓글 수: 2
Aviel Moos
Aviel Moos 2019년 10월 27일
Thank you for your response.
About the Arduino I know how to use usb communication. The problem was the matlab part.
Do you know if serial object uses Asynchronous or Synchronous communication?
asma sarouji
asma sarouji 2020년 2월 6일
I have some questions about the Arduino and the USB port

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2020년 2월 6일
편집: Walter Roberson 2020년 2월 6일
I need to send from the arduino about 25kB of data each second (about 12,500 samples of 2 Bytes).
If that is buffered into full packets of 1020 data bytes each then I think you can get that rate. However if those are individual packets then I don't think you can get anywhere even remotely close.
There are two major designs for USB in Arduino. The one that is in most Arduino uses the UART to transfer bytes to a USB controller, and the USB controller has an 8ms or 16ms buffer timeout because it suspects that you want to transfer more bytes. 16ms is only 62.something packets per second. But with you wanting to send much higher rate than that the data would indeed get automatically buffered until the 1020 data bytes mark was hit and that would get sent as a whole. This strategy is not suitable for REAL TIME work.
The arduino that use that FTDI usb chip do not have any hardware connection to the pins on the chip that would permit flushing packets early.
The other major usb design for arduino has a USB chip more directly connected that permits lower latency and does offer ways to request that packets be flushed.
However, USB itself is based on a master/slave relationship that polls only 1000 times per second.
USB 2.x does not permit devices to send interrupts to request service outside of the normal 1000 polling cycle. USB 3.something did add provisions for that.
USB can be an acceptable bulk data transport protocol, but it is not suitable for Real-time small packet work.

카테고리

Help CenterFile Exchange에서 Troubleshooting in MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by