Why does External Mode not work for Arduino clones when using "Simulink Support Package for Arduino Hardware"?

14 ビュー (過去 30 日間)
Why does a shipping demo from the "Simulink Support Package for Arduino Hardware" fail to connect to my Arduino Mego target in external mode, even though the code download to the target is successful?
The error shown is as below:
Error occurred while executing External Mode MEX-file 'ext_comm':
Failed to connect to the target. A time-out occurred while waiting for the connection response from
the target. Possible reasons for the failure:
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.

採用された回答

MathWorks Support Team
MathWorks Support Team 2023 年 11 月 16 日
編集済み: MathWorks Support Team 2023 年 11 月 16 日
The issue is seen in variants of Arduino boards that are manufactured by third-party companies which may use a seria-over-USB chip of type 'CH340' instead of the traditional Atmega 16U2 chip
The CH340 chip does not support greater than 230,400 Bauds which is less than our external mode default Baud Rate of 921,600 Bauds.
It is recommended to use official Arduino boards, however, if the customer chooses to use other boards and works in external mode, the below API may be used to explicitly set the external mode default Baud Rate to 230,400:
>> mdl = 'my_model_name';
>> codertarget.arduinobase.registry.setBaudRate(mdl,230400)
It is recommended to use the same API as below to verify if the external mode default Baud Rate is now set to 230400 Bauds
>> codertarget.arduinobase.registry.setBaudRate(mdl)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSetup and Configuration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by