Error timeout communication Matlab-Arduino in Support Package for Arduino (aka ArduinoIO Package)
显示 更早的评论
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.
Note: I already read these: http://www.mathworks.co.uk/matlabcentral/fileexchange/32374 http://www.mathworks.com/matlabcentral/answers/31595-connecting-to-arduino-timeout http://www.mathworks.com/matlabcentral/answers/32015-cannot-connect-matlab-to-arduino-board-due-to-connection-timeout-error-error-using-ardui
采纳的回答
更多回答(2 个)
MathWorks Classroom Resources Team
2012-6-11
0 个投票
fabius,
try to change the arduino.m line 89 to: for i=1:11
or maybe more than 11.
Giampy
Alon
2013-7-28
0 个投票
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
For Mega 2560, see the solution here: http://www.wayneandlayne.com/blog/2011/02/16/fixing-linux-firmware-issues-on-arduino-mega-2560/
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
类别
在 帮助中心 和 File 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!