Arduino/ Simulink Project: ' Error occurred while executing External Mode'. Where is the Problem?

35 ビュー (過去 30 日間)
Hello everyone,
with my Arduino Uno I got this error in Simulink2017b: 'Error occurred while executing External Mode MEX-file 'ext_comm': Timed-out waiting for second connect response packet. Unable to connect to the 'Arduino Uno' target for 'Project_Name' For a few days now I tried to solve the problem but still have no solution. In this Arduino-Project I want to read out the measurement of 2 IR-Sharp sensors to locate a Object between these two sensors. I attach 2 graphics which show my Simulink model and the full 'Diagnostic Viewer' Report after I tried to build and run the project in External Mode.
I would be so thankful if anyone can help me out!

回答 (3 件)

Erneto Rosas
Erneto Rosas 2019 年 3 月 12 日
issue Fixed change the BaudRate to a diferent one
  2 件のコメント
Prashant
Prashant 2023 年 7 月 2 日
can you be more specific ? Baudrate changed to what ? I've tried both 9600 and 115200 but neither is working for me.
JORGE LARA
JORGE LARA 2023 年 8 月 25 日
It worked. Thanks !!

サインインしてコメントする。


Darshan Ramakant Bhat
Darshan Ramakant Bhat 2018 年 1 月 16 日
This error is due to MATLAB is not able to connect with the Hardware. It might be the case that the drivers are not installed properly for the Arduino Uno. Please try to re-install the driver from the Arduino official website.
Additionally, there is an cause related to the background daemon that MATLAB uses to establish connection with the Arduino.
The daemon could be timing out before external mode is able to start successfully. The expected time needed to establish connection varies from computer to computer, and as a result, you may need to modify the timeout value to use external mode. Some users have only noticed this error when I2C sensors are connected to the Arduino.
Please follow these instructions to modify the timeout value: 1. Delete the file, which will be located in the following directory within the Support Package Root Directory: RootDirectory\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+registry\startDaemon.p
To determine the support package root on your local machine, please execute the following command:
>> SupportPackageRoot = matlabshared.supportpkg.getSupportPackageRoot
For example, if the above command returns "C:\ProgramData\MATLAB\SupportPackages\R2017a\", then the file will be located at: C:\ProgramData\MATLAB\SupportPackages\R2017a\\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+registry\startDaemon.p
For more information on this command, please refer to the documentation: http://www.mathworks.com/help/matlab/ref/matlabshared.supportpkg.getsupportpackageroot.html
2. Copy the file startDaemon.m (attached file) to SupportPackageRoot\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+registry\
3. Adjust the timeout value for your system by modifying the "ethernetTimeout" variable at line 80 of startDaemon.m and save the file.
4. Run the following commands at MATLAB command prompt: >> clear classes; >> clear pcode; >> rehash toolboxcache After making these changes, you should be able to run the external mode connection as before. Repeat steps 3 and 4 to tune the timeout value as needed for your system

toussi ayadi
toussi ayadi 2018 年 9 月 7 日
i have the same problem. i noticed when i see directly outputs of MPU 6050.code works and when i add the complmantary filter bloc, i get the same error of yours.

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by