Simulink cannot connect to Arduino Mega 2560 in External Mode (XCP timeout error)

I am using Simulink with Arduino Mega 2560 to control a simple LED using a manual switch.
The model is very basic:
Constant (0/1) -> Manual Switch -> Digital Output (Pin 13)
The build process completes successfully, but when running in External Mode, I get the following error:
"External Mode Open Protocol Connect command failed.
XCP internal error: timeout expired, in response to XCP CONNECT command.
Unable to connect to the Arduino Mega 2560 target."
I have tried:
- Checking COM port
- Making sure no other application is using the port
- Using a working USB cable
The issue only happens when using External Mode (Monitor & Tune).
Questions:
1. Why does Simulink fail to connect in External Mode?
2. Is this a limitation with Arduino Mega 2560?
3. Should I use only "Build, Deploy & Start" instead?
Bonus:
-This simulink worked on Arduino Uno R3 but New Arduino Mega isn't
Thank for your watching
Any help would be appreciated.

1 Comment

Can you try reducing the baudrate for External mode to 115200.
You might be using a clone Arduino Mega Hardware with CH340 Serial chip which doesn't support higher baudarte.
The default baudrate is set to 921600.
Follow the section External Mode over Serial communication in page Host-board connection - MATLAB & Simulink

Sign in to comment.

Answers (0)

Asked:

on 25 Mar 2026 at 9:34

Commented:

on 31 Mar 2026 at 8:39

Community Treasure Hunt

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

Start Hunting!