Effacer les filtres
Effacer les filtres

Arduino Mega Communication Problem to Simulink

4 vues (au cours des 30 derniers jours)
Bruce Vernham
Bruce Vernham le 15 Oct 2013
Commenté : maybee le 27 Juin 2015
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 commentaires
Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer le 10 Nov 2013
Are you using the Mega or the Mega2560?
Bruce Vernham
Bruce Vernham le 11 Nov 2013
Mega2560 R3

Connectez-vous pour commenter.

Réponses (1)

Tobi.
Tobi. le 13 Nov 2013
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 commentaires
herve
herve le 13 Nov 2013
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 le 27 Juin 2015
Were you able to fix this issue? If so what did you do?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Run on Target Hardware dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by