Simulink External Mode Timed Out

Hi, running my Simulink model in external mode will yield the following error:
Error occurred while executing External Mode MEX-file 'ext_comm': Timed-out waiting for second connect response packet.
The model involves transmitting three different CAN messages from an Arduino board - please see the attached image for reference.
I've spent ages troubleshooting this to no avail, here's what I've tried so far.
  • Building and deploying the model is fine and does not result in the error. However I would like to monitor and tune parameters live.
  • Reducing the number of messages (i.e. sending only a single CAN-ID) will not incur the error.
  • Changing model baud rate does not solve the issue - I am running a genuine Arduino with ATmega16u2.
  • Changing the model explorer 'configuration' does not solve the issue.
I am approaching memory limits of the Arduino (circa 85% program and data) with 'Monitor and Tune' but am not exceeding this.
Any help would be greatly appreciated. The model should otherwise work, but feel free to make suggestions for improvement.

3 Comments

Perhaps the following warnings from the diagnostic viewer may be helpful. They imply potential memory limitations even though my total memory usage hasn't hit 100%.
AVR Memory Usage ---------------- Device: atmega328p Program: 26272 bytes (80.2% Full) (.text + .data + .bootloader) Data: 1729 bytes (84.4% Full) (.data + .bss + .noinit)
Component: Simulink | Category: Block warning
Parameter InitialOutput cannot be downloaded because its type (CAN_MESSAGE_BUS) has no external mode host-to-target function registered
Component: Simulink | Category: Model warning
Saving external mode simulation output as a single object is not supported because the workspace variable 'out' is not created during model code execution. To suppress the warning, set 'ReturnWorkspaceOutputs' to 'off'.
Component: Simulink | Category: Model warning
Not enough memory on the target to process the packet: EXT_SETPARAM
Component: Simulink | Category: Model warning
Not enough memory on the target to process the packet: EXT_SELECT_SIGNALS
Component: Simulink | Category: Model warning
Hi Jiachen Lu,
Which Arduino board are you using. If using Uno, consider using other boards with more memory like Arduino Mega, Due, MKR.
Have you tried "Build, Deploy & Start" ?
Thanks,
Arun
Hi Arun,
I'm using the Uno R3 and understand that it's not a lot of memory.
"Build, Deploy & Start" works, but I would like to tune parameters in real-time through the dashboard blocks.
It does seem like a memory issue, which is unfortunate because I don't think my model is too comprehensive at all.

Sign in to comment.

Answers (0)

Categories

Products

Release

R2021a

Asked:

on 24 Aug 2021

Commented:

on 26 Aug 2021

Community Treasure Hunt

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

Start Hunting!