Arduino Mega Communication Problem to Simulink
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
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
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 !
参考
カテゴリ
Help Center および 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!