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

14 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 16 Nov 2023
Modifié(e) : MathWorks Support Team le 16 Nov 2023
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)

Plus de réponses (0)

Catégories

En savoir plus sur Setup and Configuration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by