Simulink and Arduino Nano Sense problem - external mode "hangs"
Mostrar comentarios más antiguos
Hi,
I am seeing a strange behaviour with Simulink+Arduino-Nano-Sense. In a nutshell: I can't run the Arduino Nano BLE Sense in Simulink's external mode. The symptoms and observed behaviour can be described as:
- The setup of Simulink Arduino hardware package runs nicely and all checks are green (under Windows10 and Matlab 2021a)
- If I set: Hardware Implementation → Target hardware resources → Host-board-connection → Set host COM port → Automatically, then I get: The following error occurred during deployment to your hardware board: Failed to detect host COM port of Nano 33 BLE board....
- If I then set Hardware Implementation → Target hardware resources → Host-board-connection → Set host COM port → Manually and enter the COM-Port-numbers that I get from the Windows device manager, then I can at least press "Build, deplay & Start" (but I must double press the Arduino's reset button first). The model then transfers to the Arduino and it runs.
- If I try to run "Monitor & Tune", then then I get an error: The following error occurred during deployment to your hardware board: Unrecognized function or variable 'portInfo'.
- I can also try to just hit "Connect". Then I get an error: 'External Mode Open Protocol Connect command failed' It provides the following diagnose: Caused by: DWARF Parser internal error: Parser::describeSymbol xcpDummyDoubleVariable is not a global variable
I have difficultied interpreting this. Does someone have an idea?
Best
Max
Respuestas (1)
Arun Kumar
el 27 de Ag. de 2021
1 voto
Hi Max Abildgaard,
The error you are seeing is due to missing drivers of Arduino board. Try to reinstall the drivers and the issue should be fixed.
If you are not able to install the drivers, please use the attached patch files for using the manual com port workflow.
Here are the steps to apply patch:
1. Download the attached files and put them in the same folder.
2. Navigate to the folder created in step 1 above in MATLAB.
3. Run the 'applyPatch.m' file from MATLAB command prompt.
4. Restart MATLAB.
Once this patch is applied, try to set the com port manually and run hit "Mohitor and Tune" button.
Hope this helps!
Please let me know if this solved your problem.
Thanks,
Arun
7 comentarios
Max Abildgaard
el 5 de Sept. de 2021
Zhaoxiang Fan
el 2 de Nov. de 2021
Hi Arun,
I fixed this issue by run MATLAB 21a with administrator.
Scott Heimendinger
el 25 de Nov. de 2021
Hi Arun,
I'm haivng the same issue as the original poster. Unfortunately, applying the patches and running as administrator haven't helped in my case. I'm able to succesfully deploy and run on an Arduino MKR Wifi 1010, but not on the Nano BLE Sense.
When I specify the COM port automatically, I immediately get the error:
The following error was encountered during evaluation of the external mode callback 'getExtModeData': codertarget.arduinobase.internal.getExternalModeMexArgs('Serial')
Failed to detect host COM port of Nano 33 BLE board.
When I specify the COM port manually, the deployment process hangs and the status in the bottom-left of the Simulink window reads:
Code Generation : Generating Code Templates : Completed
But it never progresses from there. If I hit the reset button on my Arduino at this time, it causes the build to abort. (FYI, I'm setting both the COM port and the Bootloader COM port to the same port).
When I set the port manually and try just hitting "Connect", I get 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
All of this is true even when the Run on Hardware wizard is able to complete its build and test succesfully.
Any other tips or troubleshooting advice? Thanks so much!
MaxMatlab
el 28 de Dic. de 2021
Hi Arun,
I recently picked up work on this project again and started having problems: I cannot get the connection from simulink to the BLE SENSE to work. The supplied fix does not seem to work (anymore) - or at least I am not able to reproduce the conditions, where it worked earlier this year. This neither on 2021a nor on a freshly installed 2021b.
General info: Bootload COM is 5, normal COM is 6. This has been entered as manual input into the "host-board connection" panel. What I see is:
- a) Running with initial double press (with bootloader) results in

- b) Running without double press (without bootloader) lets the process hang. The status shown in the bottom lower left corner of simulink reads "Code Generation : Generating Code Templates : Completed". If pressing the reset button, the process faults with same message as in a) above.
- Just running "Build, Deploy & Start" will also lead to the system just hanging.
Various workarounds tried:
- Manually swapping numbers for COM ports in "host-board connection" doesn't help.
- Working from USB2 and/or USB3 ports as discussed on various arduino-forums - yet not related to Matlab.
- Trying to "Connect" (the button below Monitor & Tune) causes the following error:

I hope that you can help. Please don't hesitate if I can assist with any additional info.
Best
Max
Arun Kumar
el 29 de Dic. de 2021
Hi Max,
I would suggest to start with some simple model like arduino_gettingstated and see if it works.
For further assistance, please contact MathWorks Technical support.
Thanks,
Arun
Luyang Ding
el 7 de Jun. de 2023
Hi Arun,
I am facing a familiar problem, the system tell me "DWARF Parser internal error: Parser::describeSymbol xcpDummyDoubleVariable is not a global variable "
I am using c2000, the driver is installed automatically, and I cannot reinstall it. Can you help?
thanks, best
Luyang Ding
el 7 de Jun. de 2023
@Arun KumarIt seems that R2023a cannot select 28335, anouncing it a invalid data. I am using 2022b.
Categorías
Más información sobre MATLAB Support Package for Arduino Hardware en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!