필터 지우기
필터 지우기

Arduino Mega Communication Problem to Simulink

조회 수: 4 (최근 30일)
Bruce Vernham
Bruce Vernham 2013년 10월 15일
댓글: maybee 2015년 6월 27일
I keep getting 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.
I have set the port manually and and it does show up in "Devices and Printers".
I have no problem communicating with the IDE. The Mega is running the "fade" demo. The IDE is closed and I have rebotted my computer but still no communications to Simulink.
MATLAB SUPPORT PACKAGE FOR ARDUINO works flawlessly. a = andruino('COM7') works as expected with the adiosrv.pde uploaded to the board.
Any ideas?
Thanks
Bruce
  댓글 수: 2
Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer 2013년 11월 10일
Are you using the Mega or the Mega2560?
Bruce Vernham
Bruce Vernham 2013년 11월 11일
Mega2560 R3

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

답변 (1개)

Tobi.
Tobi. 2013년 11월 13일
Hi Bruce,
I had the very same problem and found a crude workaround: Somewhere deep inside TMW's support package, avrdude is being called to load the .hex file onto the Arduino. This call fails, but instead of passing the error message through to the user, we see a generic error message that doesn't say anything.
I wrote a patch that enabled me to overcome this problem. I hope it helps.
Tobi
function toolsInfo = toolsInfoDataArduinoMega2560 (in)
%toolsInfoDataArduinoMega2560 Overwrite settings in TMW's own function with
%individual settings
% There's a bug in TMW's implementation of the deploy to Arduino Mega2560
% functionality which throws the following error message:
%
% 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.
%
% The reason for this message is not immediately clear, but can be traced
% back to a faulty call to avrdude, which is supposed to load the
% compiled data into the Arduino but fails to do so. It seems like there
% are additional flags set, making avrdude throw an error message which
% Simulink cannot handle, thus leading to the above mentioned unspecific
% error message.
%
% This function implements a simple workaround: It calls TMW's own
% function and replaces the field which contains all flags used during
% the call to avrdude by individual flags. It should not be considered a
% solution, it's merely a workaround until TMW solves the bug for good.
%
% To use, copy this file into the hardware support package's
% installation folder, typically
% C:\MATLAB\SupportPackages\R2013b\arduinomega2560\+realtime\+internal.
% Then rename the original file toolsInfoArduinoMega2560.p to
% toolsInfoArduinoMega2560_TMW.p.
%
% Patch written by Tobias Meyer, University of Paderborn,
% firstname.lastname@uni-paderborn.de, November 2013
toolsInfo = realtime.internal.toolsInfoDataArduinoMega2560_TMW();
% toolsInfo.DownloadUtilityFlags = ' -CC:\MATLAB\SupportPackages\R2013a\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -patmega2560 -cwiring -P//./$(COMPort) -b115200 -D -Uflash:w:';
toolsInfo.DownloadUtilityFlags = ' -C$(InstallDir)\hardware/tools/avr/etc/avrdude.conf -patmega2560 -cwiring -P//./$(COMPort) -b115200 -D -Uflash:w:';
  댓글 수: 2
herve
herve 2013년 11월 13일
Thank you for your answer. I've got the same problem and I tried your solution but I didn't manage to create the file. I'm a beginner with matlab ; help !
maybee
maybee 2015년 6월 27일
Were you able to fix this issue? If so what did you do?

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

카테고리

Help CenterFile Exchange에서 Run on Target Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by