MATLAB Answers

0

problem with arduino uno

on building the model i`m getting errors
*The call to arduino_make_rtw_hook, during the after_make hook generated the following error:
The Arduino serial port must be set and you must have installed the device drivers for your Arduino hardware.
1. Install the drivers and connect the Arduino hardware.
2. Identify the virtual serial (COM) port. You can do this through the Windows Device Manager, or by running arduino.Prefs.setComPort
3. Set the correct COM port using arduino.Prefs.setComPort
The build process will terminate as a result.*
the command message shows
### Starting Arduino build procedure for model: demo_arduino_blink ### ### Arduino environment settings: ### ### ARDUINO_ROOT: C:\ARDUIN~1\ARDUIN~1 ### MCU: atmega328p ### F_CPU: 16000000 ### ### Generating code into build folder: e:\matlab\demo_arduino_blink_arduino ### Invoking Target Language Compiler on demo_arduino_blink.rtw ### Using System Target File: c:\ArduinoTarget\arduino\arduino.tlc ### Loading TLC function libraries ..... ### Initial pass through model to cache user defined code .. ### Caching model source code ..................... ### Writing header file demo_arduino_blink.h ### Writing header file demo_arduino_blink_types.h . ### Writing header file rtwtypes.h ### Writing source file demo_arduino_blink.c . ### Writing header file demo_arduino_blink_private.h ### Writing source file demo_arduino_blink_data.c . ### Writing source file ert_main.c ### TLC code generation complete. . ### Processing Template Makefile: c:\ArduinoTarget\arduino\arduino.tmf ### demo_arduino_blink.mk which is generated from c:\ArduinoTarget\arduino\arduino.tmf is up to date ### Building demo_arduino_blink: .\demo_arduino_blink.bat
e:\matlab\demo_arduino_blink_arduino>set MATLAB=C:\Program Files\MATLAB\R2011a
e:\matlab\demo_arduino_blink_arduino>"C:\Program Files\MATLAB\R2011a\bin\win32\gmake" -f demo_arduino_blink.mk GENERATE_REPORT=0 GENERATE_ASAP2=0 C:/ARDUIN~1/ARDUIN~1/hardware/tools/avr/bin//avr-gcc -c -mmcu=atmega328p -I. -DF_CPU=16000000 -Os -Wall -Wstrict-prototypes -std=gnu99 -I. -I.. -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2011a/extern/include -IC:/PROGRA~1/MATLAB/R2011a/simulink/include -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/src/ext_mode/common -Ie:/matlab/demo_arduino_blink_arduino -Ie:/matlab -Ic:/ArduinoTarget/demos -IC:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino -Ic:/ArduinoTarget/blocks -IC:/ARDUIN~1/ARDUIN~1/hardware/arduino/cores/arduino demo_arduino_blink_data.c -o demo_arduino_blink_data.o In file included from C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/WProgram.h:10, from demo_arduino_blink.h:23, from demo_arduino_blink_data.c:17: C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/wiring.h:42:1: warning: "true" redefined In file included from demo_arduino_blink.h:22, from demo_arduino_blink_data.c:17: rtwtypes.h:147:1: warning: this is the location of the previous definition In file included from C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/WProgram.h:10, from demo_arduino_blink.h:23, from demo_arduino_blink_data.c:17: C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/wiring.h:43:1: warning: "false" redefined In file included from demo_arduino_blink.h:22, from demo_arduino_blink_data.c:17: rtwtypes.h:143:1: warning: this is the location of the previous definition C:/ARDUIN~1/ARDUIN~1/hardware/tools/avr/bin//avr-gcc -c -mmcu=atmega328p -I. -DF_CPU=16000000 -Os -Wall -Wstrict-prototypes -std=gnu99 -I. -I.. -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2011a/extern/include -IC:/PROGRA~1/MATLAB/R2011a/simulink/include -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/src/ext_mode/common -Ie:/matlab/demo_arduino_blink_arduino -Ie:/matlab -Ic:/ArduinoTarget/demos -IC:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino -Ic:/ArduinoTarget/blocks -IC:/ARDUIN~1/ARDUIN~1/hardware/arduino/cores/arduino demo_arduino_blink.c -o demo_arduino_blink.o In file included from C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/WProgram.h:10, from demo_arduino_blink.h:23, from demo_arduino_blink.c:17: C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/wiring.h:42:1: warning: "true" redefined In file included from demo_arduino_blink.h:22, from demo_arduino_blink.c:17: rtwtypes.h:147:1: warning: this is the location of the previous definition In file included from C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/WProgram.h:10, from demo_arduino_blink.h:23, from demo_arduino_blink.c:17: C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/wiring.h:43:1: warning: "false" redefined In file included from demo_arduino_blink.h:22, from demo_arduino_blink.c:17: rtwtypes.h:143:1: warning: this is the location of the previous definition C:/ARDUIN~1/ARDUIN~1/hardware/tools/avr/bin//avr-gcc -c -mmcu=atmega328p -I. -DF_CPU=16000000 -Os -Wall -Wstrict-prototypes -std=gnu99 -I. -I.. -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2011a/extern/include -IC:/PROGRA~1/MATLAB/R2011a/simulink/include -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2011a/rtw/c/src/ext_mode/common -Ie:/matlab/demo_arduino_blink_arduino -Ie:/matlab -Ic:/ArduinoTarget/demos -IC:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino -Ic:/ArduinoTarget/blocks -IC:/ARDUIN~1/ARDUIN~1/hardware/arduino/cores/arduino ert_main.c -o ert_main.o In file included from C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/WProgram.h:10, from demo_arduino_blink.h:23, from ert_main.c:17: C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/wiring.h:42:1: warning: "true" redefined In file included from demo_arduino_blink.h:22, from ert_main.c:17: rtwtypes.h:147:1: warning: this is the location of the previous definition In file included from C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/WProgram.h:10, from demo_arduino_blink.h:23, from ert_main.c:17: C:/arduino-0023/arduino-0023/hardware/arduino/cores/arduino/wiring.h:43:1: warning: "false" redefined In file included from demo_arduino_blink.h:22, from ert_main.c:17: rtwtypes.h:143:1: warning: this is the location of the previous definition "### BUILD_MODE real_time" C:/ARDUIN~1/ARDUIN~1/hardware/tools/avr/bin//avr-gcc demo_arduino_blink_data.o io_wrappers.o demo_arduino_blink.o ert_main.o HardwareSerial.o Print.o Tone.o WMath.o WString.o WInterrupts.o pins_arduino.o wiring.o wiring_analog.o wiring_digital.o wiring_pulse.o wiring_shift.o -mmcu=atmega328p -DF_CPU=16000000 -Os -Wall -Wstrict-prototypes -std=gnu99 -lm -Wl,-Map,mapFile.map,--cref -o demo_arduino_blink.elf "### Generated demo_arduino_blink.elf" "### BUILD_MODE real_time" C:/ARDUIN~1/ARDUIN~1/hardware/tools/avr/bin//avr-objcopy -O ihex -R .eeprom demo_arduino_blink.elf demo_arduino_blink.hex "### Generated demo_arduino_blink.hex" "### Created demo_arduino_blink.hex successfully (or it was already up to date)" ### Build procedure for model: 'demo_arduino_blink' aborted due to an error.
thank you in advance

  0 Comments

Sign in to comment.

2 Answers

Answer by Rolfe Dlugy-Hegwer on 7 May 2014
 Accepted Answer

I strongly recommend performing the following steps:
  1. Installing the drivers and connecting the Arduino hardware.
  2. Identifing the virtual serial (COM) port. You can do this through the Windows Device Manager, or by running arduino.Prefs.setComPort
  3. Setting the correct COM port using arduino.Prefs.setComPort
You can also search the MATLAB/Simulink documentation for "Troubleshoot Running Models on Arduino Hardware".

  0 Comments

Sign in to comment.



thank you for your solution.
i just installed the drivers, and now it is working very fine..

  0 Comments

Sign in to comment.



Translated by