MATLAB Answers

cannot connect arduino by simulink

2 ビュー (過去 30 日間)
Chanho Lee
Chanho Lee 2020 年 8 月 10 日
編集済み: Prabhan Purwar 2020 年 8 月 25 日
Hi, I'm trying to build arduino code by Simulink, but when I press build, deploy & start button, following error pops up.
Had no trouble with connecting arduino with Matlab though.
Will be so grateful if anyone could help me:(
"### Generating static library."
"C:/Program Files/MATLAB/R2020a/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcomm.mk all
gmake[1]: Entering directory `C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1'
"C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -MF"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/SPI.dep" -MT"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/SPI.o" -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/SPI/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/utility -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src/ -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/variants/mega -o "C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/SPI.o" "C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/SPI/src/SPI.cpp"
"C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -MF"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Wire.dep" -MT"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Wire.o" -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/SPI/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/utility -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src/ -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/variants/mega -o "C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Wire.o" "C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/Wire.cpp"
"C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -MF"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/twi.dep" -MT"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/twi.o" -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/SPI/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/utility -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src/ -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/variants/mega -o "C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/twi.o" "C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/utility/twi.c"
"C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -MF"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Servo.dep" -MT"C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Servo.o" -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/SPI/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/utility -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src/ -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/variants/mega -o "C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Servo.o" "C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src/avr/Servo.cpp"
C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/SPI/src/SPI.cpp:201:1: fatal error: opening dependency file C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/SPI.dep: No such file or directory
}
^
compilation terminated.
gmake[1]: *** [C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/SPI.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/Wire.cpp:330:25: fatal error: opening dependency file C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Wire.dep: No such file or directory
TwoWire Wire = TwoWire();
^
compilation terminated.
C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/libraries/Wire/src/utility/twi.c:560:1: fatal error: opening dependency file C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/twi.dep: No such file or directory
}
^
compilation terminated.
gmake[1]: *** [C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Wire.o] Error 1
gmake[1]: *** [C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/twi.o] Error 1
C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src/avr/Servo.cpp:315:1: fatal error: opening dependency file C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Servo.dep: No such file or directory
}
^
compilation terminated.
gmake[1]: *** [C:/Users//DOCUME~1/MATLAB/R2020a/ARDUIN~1/ARDUIN~1/FASTER~1/Servo.o] Error 1
gmake[1]: Leaving directory `C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1'
gmake: *** [all] Error 2
The make command returned an error of 2
Error(s) encountered while building "Motor":
### Failed to generate all binary outputs.

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

Prabhan Purwar
Prabhan Purwar 2020 年 8 月 25 日
編集済み: Prabhan Purwar 2020 年 8 月 25 日
Hey,
There could be multiple reasons why this error might occur. Following are the most probable reasons:
  1. It is possible that you may not have run the configuration setup for the Arduino Simulink support package. Setting up Arduino Matlab support package will let the Arduino connect in the command window, but not in the Simulink environment.
  2. Another reason why this error might occur is that you might have more than one Arduino object. You can only have one Arduino object at a time in Simulink and MATLAB. To solve this, clear the Arduino object from MATLAB, if any, before trying to access the board in Simulink. ** Only for Linux **
  3. If points 1 and 2 do not resolve the issue, try running MATLAB as root and also check the permissions to access the hardware board through USB.
  4. This error also arises due to incorrect version of MinGW for that Matlab version in case of building example with Simulink coder.
Hope it helps!!

  0 件のコメント

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by