MATLAB Answers

External mode error with Arduino Mega 2560

68 views (last 30 days)
Why does shipping demo fail to connect to target in external mode, even though the code download to target is successful?
The error shown is as below:

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Nov 2017
Edited: MathWorks Support Team on 16 Nov 2017
The issue is seen in variants of Arduino boards that are manufactured by third party companies which may use a serial over USB chip of type 'CH340' instead of the traditional Atmega 16U2 chip
The CH340 chip does not support greater than 230400 Bauds which is less than our external mode default Baud Rate of 921600 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 230400
>>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)

  2 Comments

changming zhao
changming zhao on 19 Nov 2017
iam Chinese。It prompts mdl not declared。 What should I do to solve this problem? thank you。

Sign in to comment.

More Answers (2)

Venkatesh Chilapur
Venkatesh Chilapur on 20 Dec 2017
Hi,
The 'mdl' in the above command needs to be replaced by the model name.
Regards, Venkatesh C

  1 Comment

Renan Parrela
Renan Parrela on 28 Sep 2018
What is the "model name"? Can you give a example?

Sign in to comment.


Venkatesh Chilapur
Venkatesh Chilapur on 8 Oct 2018
Please open the model and run the following command at the MATLAB command prompt.
get_param(gcs, 'name');
The string that is returned here is the name of the model that is currently open.

  0 Comments

Sign in to comment.

Categories