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

조회 수: 8 (최근 30일)
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.

채택된 답변

fabius
fabius 2012년 6월 16일
Fixed!!
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.

추가 답변 (2개)

MathWorks Classroom Resources Team
fabius,
try to change the arduino.m line 89 to: for i=1:11
or maybe more than 11.
Giampy
  댓글 수: 1
fabius
fabius 2012년 6월 11일
I tried values 15 and 20, on line 89:
for i=1:20,
fprintf(1,'.');
pause(1);
end
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.
Ideas:
- 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.

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


Alon
Alon 2013년 7월 28일
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: http://arduino.cc/en/Hacking/DFUProgramming8U2
Also note that: 1) You should not download the "combined" firmware file but the arduino-usbserial one: https://github.com/arduino/Arduino/blob/master/hardware/arduino/firmwares/atmegaxxu2/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex
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

카테고리

Help CenterFile Exchange에서 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