MATLAB Answers

Error downloading Simulink Model to Arduino Mega 2560 Rev3

조회 수: 4(최근 30일)
Arne
Arne 2013년 11월 20일
답변: l z 2019년 4월 4일
Hi,
I'm using Matlab 2013a (on a Windows 8 64-bit PC) with Arduino support package 3.0. Downloading models to an Arduino UNO is wokring without problems. But I can't download any model to a new Arduino Mega 2560 Rev3. Tested with the arduinomega2560_gettingstarted model. When Simulink says "Downloading.." RX/TX LEDs are just blinking twice and I get the following error:
_The call to realtime_make_rtw_hook, during the after_make hook generated the following error: Could not download the model to the target hardware. Verify the connection between the computer and target hardware.
The build process will terminate as a result.
Caused by: Could not download the model to the target hardware. Verify the connection between the computer and target hardware._
But the target is definitely connected, and downloading programs with Ardino IDE is working fine. I've also tested this on a different PC with Windows 7 with the same result. Can anyone give me a hint please?

채택된 답변

Arne
Arne 2013년 12월 2일
Thanks to the MathWorks support team, I reported this problem and they found a working solution (at least in my case):
1. Shutdown MATLAB
2. Go to the folder inside the Arduino Mega support package (by default this should be in
c:\MATLAB\SupportPackages\R2013a\arduinomega2560\+realtime\+internal)
Note : This is the location which the user installed the support package for Arduino.
3. Make a backup of the existing file "toolsInfoDataArduinoMega2560.p"
4. Overwrite the file "toolsInfoDataArduinoMega2560.p" with the attached P-file (unzip first).
5. Restart MATLAB and execute "rehash toolboxcache"
6. Try the code generation and deployment for the boards in question and verify functionality
  댓글 수: 4

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

추가 답변(4개)

Andrea
Andrea 2014년 1월 13일
편집: Andrea 2014년 1월 13일
Hi, I am using Matlab 2013b on Mac OS 64bit, and I have the same problem of connection of the Arduino2560 R3. I couldn't find the file toolsInfoDataArduinoMega2560.p in the Matlab folder, I think because that file exists in the older versions of the Arduino support package. I have the last one, just downloaded from Mathworks Arduino Package Support. Is there another file or another way to solve my connection problem?
Thank you,
Andrea

Gergely Takács
Gergely Takács 2014년 2월 13일
Hello all;
I have used this procedure and the external mode does work with certain very simple models. For example an analog input>double conversion>Embedded function for a y = u(5/1024); voltage conversion> scope combination works flawlessly.
However, as soon as I add another analog input, I get the same error as sri. The minimum not working example is two analog inputs with two scopes. The exact procedure goes like this: the building process is successful, and it says " Model Successfully Downloaded to Arduino Mega 2560 ". But then, upon trying to connect to the board, the process hangs at " Initializing " and after a while I get " Error occurred while executing External Mode MEX-file 'ext_serial_win32_comm': Timed-out waiting for first connect response packet. " I've also tried to run a simple embedded function with an extended Kalman filter inside (no inputs or outputs on Arduino) and a scope, but the same thing happened.
Details:
  • MATLAB Version: 8.0.0.783 (R2012b)
  • Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
  • Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot™ 64-Bit Server VM mixed mode
  • Board: Arduino Mega 2560
  • Fixed Step Discrete Solver (tried 1, 0.1 sec)
  • External mode enabled.
  • Baud rates 9600
  • Overrun detection enabled, on pin 13
  • Computer Lenovo ThinkPad T410i
Any help would be much appreciated.
Gergely

Italo Rodrigues
Italo Rodrigues 2014년 7월 29일
Hi, I found the same problem to Arduino UNO. How to fix this?
  댓글 수: 4

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


l z
l z 2019년 4월 4일
Thank you very much !
I used the way to slove my program.

Community Treasure Hunt

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

Start Hunting!

Translated by