Clear Filters
Clear Filters

Error timeout communication Matlab-Arduino in Support Package for Arduino (aka ArduinoIO Package)

5 views (last 30 days)
Hi I think i've read all suggestion posted about, but I've no suggestion to resolve this problem.
I tried to connect matlab to my arduino duemilanove, with ArduinoIO Package. My operating sistem is XP, and i did what in readme: - uploaded "adiosrv.pde" on arduino (without problems) - closed Arduino IDE. - installed from matlab the "install_arduino.m" - started a simple command of communication: " a = arduino('COM6)"
but I have the error: ??? Error using ==> arduino>arduino.arduino at 102 Connection unsuccessful, please make sure that the Arduino is powered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection.
I'm sure that: - com port is right - cable is ok, (arduino IDE can communicate to arduino). - every old communication is closed (I tried also to open port after reboot).
Please, every suggestion is very important.

Accepted Answer

fabius on 16 Jun 2012
There's is a little modification to do on ARDUINO CODE (ADIORSV.PDE):
on line 40: for (i=0;i<12;i++) {
instead of: for (i=0;i<20;i++) {
NOTE: I'm using ARDUINO DUEMILANOVE (ATMEGA 168) (witch have 13 PINS ONLY).
I hope this issue could be fixed or reported on file excange page.

More Answers (2)

MathWorks Classroom Resources Team
try to change the arduino.m line 89 to: for i=1:11
or maybe more than 11.
  1 Comment
fabius on 11 Jun 2012
I tried values 15 and 20, on line 89:
for i=1:20,
but remain same message.
(NOTE: I try only single string a=arduino('COM6') for connectrion, but it fails)
there some other way to test connection to arduino?
I'm going mad for this issue..
(Note: arduino works, I tried to upload stretch to test cable and communication and it's right)
for informations:
arduino model: duemilanove atmega 168
matlab version: 7.10.0 (R2010a)
operating system XP.
- I didn't understand arduino_install (may be I did something wrong doing that?)
- it's important to define a specific folder for arduino IDE location on computer)
- I uploaded server adiosrv.pde more that one time during tries, it's causes problems?
- I finded on internet that comunication baudrate for duemilanove could be 19200, I tried both values (given from arduino.m 115200 and 19200, but not working at all)
tank you.

Sign in to comment.

Alon on 28 Jul 2013
It seems that the Mega boards (and maybe some others) have problems with the firmware that controls the USB communication. One can easily test if this is the problem by pressing the reset button on the Arduino board, just after the "fopen" command is issued (for the ArduinoIO this is when the "...." appears). For some reason the Arduino is stalled after establishing communication, and holding the reset for few seconds and releasing it will allow it to go back to life and to communicate with matlab.
The more permanent solution is to install new version of the firmware, see here:
Also note that: 1) You should not download the "combined" firmware file but the arduino-usbserial one:
2) For download as HEX file, you must right-click where it says "RAW" and choose save-as.
3) If you are using Windows, after resetting your Arduino Mega 2560 into DFU programming mode (with the shortcut, as described above), you will need to install the driver for the FLIP software. Tell Windows to install it from: ..\filp 3.2.2\usb directory


Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!