Incapable of getting datas from Arduino Mega 2560
23 views (last 30 days)
Show older comments
Hey guys,
I'm working on a project on which I have to connect a ICM20948 IMU sensor on an Arduino and gather datas from it with Simulink. I use the ICM20948 Simulink block and I connect it to a scope. In my model parameters, I did setup my hardware device to Arduino Mega 2560 (the one I'm using). However, when I try to run my simulation, I get these messages (see below, in bold). My questions are:
1)how can I fix that ?
2)Do I have to make my own Arduino code on Arduino IDE ?
Top model targets built:
Model Action Rebuild Reason
====================================================================
test1 Code generated and compiled. Incremental checksum changed.
1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 53.45s
External Mode Open Protocol Connect command failed
Caused by:
Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command
Component:Simulink | Category:Model error
Unable to connect to the 'Arduino Mega 2560' target for 'test1'.
0 Comments
Answers (1)
Shivam Lahoti
on 4 Jul 2024
Hi Pierre-Olivier,
I can understand that you are getting the following error:
External Mode Open Protocol Connect command failed.
Caused by:
Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command.
This error might come if the current model has a sample rate that is too high.
The External Mode runs in background. With a high sample rate in the model, most of the CPU time is occupied by the core task and the background task does not get enough time to run the model in external mode to send the data between the host machine and the target. This is what leads to the timeout error.
You can find more information on MATLAB’s External Mode Simulation in the link included below.
To run the model in external mode with your current setup you can try to run it with a reduced sample rate. I hope this helps.
Regards,
Shivam.
0 Comments
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!