Error occurred while executing External Mode MEX-file 'ext_comm'

28 visualizaciones (últimos 30 días)
ben
ben el 21 de Mzo. de 2024
Respondida: Raj el 22 de Abr. de 2024
Hello,
i get this error every time I run the Model. I am basically trying to control a servo motor using a potentiometer and the shaft of the servo is connected to another potentiometer. so, in short i am trying to get the values on the display. Here's the error:
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 time-out: 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.
By using Build,Deploy and Start option I can control my servo but am unable to get the values onto the display. where as when I use Monitor and Tune I get the Above mentioned Error.
Thanks in Advance for your Assistance.

Respuestas (1)

Raj
Raj el 22 de Abr. de 2024
Hi @ben
This problem occurs with certain Arduino board variants produced by third-party manufacturers that opt for a 'CH340' serial-over-USB chip, rather than the standard Atmega 16U2 chip. 'CH340' cannot handle baudrate greater than 230400. This is the reason that External mode fails.
You can check the default External mode baudrate by executing the following command-
>>codertarget.arduinobase.registry.setBaudRate(gcs)
If you want to change the baudrate to a lower value say 230400 then use the following-
>>codertarget.arduinobase.registry.setBaudRate(gcs,230400)
If External mode still doesn't work after setting the baud rate to 230,400, keep lowering the baud rate until it works.
You can also refer to the following resources regarding a similar user case-
I hope this resolves your query.

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by