MATLAB Answers

Arne
0

Error downloading Simulink Model to Arduino Mega 2560 Rev3

Asked by Arne
on 20 Nov 2013
Latest activity Answered by l z
on 4 Apr 2019
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?

  0 Comments

Sign in to comment.

5 Answers

回答者: 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 Comments

Show 1 older comment
please Arne i need that file >> my email : zaid.mka.90@gmail.com thanx very much :)
please Arne or zaid_mka i need that file ;MY EMAIL : risheek.rishi@gmail.com ,It would be of great help
Arne
2014 年 1 月 2 日
Ok, here is the file again.

Sign in to comment.


回答者: 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

  0 Comments

Sign in to comment.


回答者: 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

  0 Comments

Sign in to comment.


回答者: Italo Rodrigues 2014 年 7 月 29 日

Hi, I found the same problem to Arduino UNO. How to fix this?

回答者: l z
2019 年 4 月 4 日

Thank you very much !
I used the way to slove my program.

  0 Comments

Sign in to comment.