Arduino Simulink deployment failure

26 visualizaciones (últimos 30 días)
Jakub Pojsl
Jakub Pojsl el 20 de Feb. de 2023
Editada: Siraj el 8 de Dic. de 2023
I have arduino Nano IOT and I am trying to Build and deploy simulink model to it. I am facing issues with that. I have succesfully connected arduino to matlab and used it in scripts. I have succesfully run code from Arduino IDE. But when I have simple program and want to build and deploy, the process stops at this:
  • diagnostics_01.txt
After 30 minutes, my computer goes to sleep and it fails:
Top model targets built:
Model Action Rebuild Reason
arduino_imu_pitch_roll_calculation Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 33m 2.476s
The following error occurred during deployment to your hardware board:
Could not automatically set the bootloader COM port for your Arduino Nano 33 IoT board. This may be due to a disconnected or unrecognized board.
If the board is not connected to your host computer, connect it and let Windows install the board driver.
If the board is connected, update the board driver. Open Windows Device Manager and locate the board either in Other Devices or in COM Ports. Right-click on the board and select 'Update Driver Software...' Next, select 'Browse my computer for driver software'. Specify the search location as C:\ProgramData\MATLAB\SupportPackages\R2022a\aIDE\drivers and click 'Next'.
Retry to download the model on the board by clicking 'Deploy to Hardware' option.
I have checked the driver, but I guess it disconnects after PC goes to sleep.
Main problem is the long build and deploy process.
Also the Setup Hardware Simulink wizard, in the test arduino connection part takes long time Downloading and never completes.
I have the Ostermiller Circular Buffer v 1.08.02 and ESP32 Core v 1.0.6 installed.
Does anyone know, where the issue could be?

Respuestas (1)

Siraj el 8 de Dic. de 2023
Editada: Siraj el 8 de Dic. de 2023
It is my understanding that you can connect to Arduino using MATLAB and also through the Arduino IDE. However, when you try to build and deploy a simple Simulink model to Arduino, the process takes a long time and eventually stops, showing the following error:
“Could not automatically set the bootloader COM port for your Arduino Nano 33 IoT board.”
I'm not entirely certain about the exact reason for the error you are encountering, but I came across similar issues and workarounds that might be helpful.
Sometimes this issue arises when MATLAB tries to connect to the Arduino via more than one connection. This can happen if there is an existing "arduino" object in the workspace. Make sure to clear the previous arduino objects before calling the “arduino” function again, or simulating a model on the Arduino. To clear an arduino object "my_arduino":
>> clear my_arduino
Additionally check that other MATLAB instances are not connected to the Arduino.
You can try reinstalling MATLAB and the Simulink Arduino support package. Before reinstalling, make sure to first remove the existing support package, because it might be the case that your previous installation was interrupted by activating Add-On explorer multiple times during the install, which ended with a bad install.
There might also be an issue with the Arduino drivers, as Arduino drivers are not the same for all Arduino boards. You can refer to the following link to see discussions about this potential problem.
You may also consider trying the following steps to see if they help to resolve the issue.
Locate the p-file 'arduinoARMDownload.p' and delete it from its folder. [after saving a backup copy of the 'arduinoARMDownload.m' and 'arduinoARMDownload.p' files at another folder location]
Execute the following commands in the MATLAB Command Window:
clear classes; clear pcode; rehash toolboxcache;
Try connecting to the Arduino board again.
You may also want to refer to the following link, as it provides detailed steps to troubleshoot the exact error you are encountering.
You can try manually resetting the board by long pressing the reset button on the hardware and then deploying the model to see if it helps. If this doesn’t help, then you may need to reflash the firmware/bootloader on the board with an AVR programmer. There are plenty of tutorials online about that.
If this does not resolve the error, please contact MathWorks Technical Support at:
Hope this helps.


Más información sobre Setup and Configuration en Help Center y File Exchange.





Community Treasure Hunt

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

Start Hunting!

Translated by