Error downloading Simulink Model to Arduino Mega 2560

1 view (last 30 days)
I am using Matlab 2015b with Arduino Support Package. I am not able to run the Simulink Model in Eternal Mode with Arduino Mega 2560. Error occurred while executing External Mode MEX-file 'ext_serial_win32_comm_rtt': Failed to connect to the target. A time-out occurred while waiting for the connection response from the target. Possible reasons for the time-out: a) The target is not switched on. b) The target is not connected to your host machine. c) The application for the model is not running on the target. You might have clicked the Stop button. If the Run button is not dimmed, click it. Otherwise, click the Build button, which downloads and runs your application on the target. Although I am able to download the code using Arduino Hardware and flash on the same board with Arduino IDE.
I have confirmed the port number in Matlab and device manager is same.
Although I am able to run some simple models on External Mode on the Arduino board.

Answers (1)

Eeshan Mitra
Eeshan Mitra on 29 Sep 2017
This appears to be an issue in MATLAB R2015b and the Arduino Support Package. You may try and install the latest support package that possibly fixes it.
There is a workaround that will resolve the issue. Please follow these steps to complete the workaround:
1. Exit MATLAB R2015b.
2. In Windows, navigate to the following directory: "Support package Installation path"\arduino\toolbox\target\supportpackages\arduinotarget\src\rtiostream_serial.cpp
The Support package Installation path is usually: C:\MATLAB\SupportPackages\R2015b
3. Find the file "rtiostream_serial.cpp" in this directory and save a copy of it as a backup.
4. Replace the file with the file "rtiostream_serial.cpp" within the attached zip folder.
5. Restart MATLAB R2015b and attempt to run the model.
  1 Comment
SUKESH MENON
SUKESH MENON on 3 Oct 2017
Thanks for the reply.
I have followed the steps mentioned as a workaround but the Issue still persists.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!