MATLAB Answers

0

Arduino Due with Simulink error

Asked by Scott Kimber on 29 Oct 2015
Latest activity Edited by MathWorks Simulink Team on 16 Nov 2015
I am trying to connect an Arduino Due to Simulink to run it in external mode. I am unable to successfully deploy to hardware.
I'm testing it with a blinking light model: A pulse generator connected to a digital output pin. This is the error message:
### Starting build procedure for model: due_blink
Code Generation 1
Elapsed: 8 sec
### Generating code into build folder: C:\Users\Dana\Documents\MATLAB\due_blink_ert_rtw
### Invoking Target Language Compiler on due_blink.rtw
### Using System Target File: C:\Program Files\MATLAB\R2015b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing header file due_blink.h
### Writing header file due_blink_types.h
.
### Writing header file rtwtypes.h
### Writing source file due_blink.c
### Writing header file due_blink_private.h
### Writing source file due_blink_data.c
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino ARM v1.6.1 | gmake (64-bit Windows)
### 'C:\Users\Dana\Documents\MATLAB\due_blink_ert_rtw\due_blink.mk' is up to date
### Building 'due_blink': C:\PROGRA~1\MATLAB\R2015b\bin\win64\gmake -f due_blink.mk all
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gcc -Os -c -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -DARDUINO=161 -MD -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER='"Unknown"' -DUSB_PRODUCT='"Arduino Due"' -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_DUE_ -DMODEL=due_blink -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=9 -DMW_TIMERCOUNT=131250 -DMW_SAM_CLOCKID=TC_CMR_TCCLKS_TIMER_CLOCK3 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=due_blink -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/include -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/blocks/sfcn/include -IC:/Users/Dana/Documents/MATLAB/due_blink_ert_rtw -IC:/Users/Dana/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/libsam -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/CMSIS/CMSIS/Include -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/CMSIS/Device/ATMEL -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/cores/arduino -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/variants/arduino_due_x -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -o "due_blink.o" "due_blink.c"
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gcc -Os -c -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -DARDUINO=161 -MD -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER='"Unknown"' -DUSB_PRODUCT='"Arduino Due"' -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_DUE_ -DMODEL=due_blink -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=9 -DMW_TIMERCOUNT=131250 -DMW_SAM_CLOCKID=TC_CMR_TCCLKS_TIMER_CLOCK3 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=due_blink -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/include -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/blocks/sfcn/include -IC:/Users/Dana/Documents/MATLAB/due_blink_ert_rtw -IC:/Users/Dana/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/libsam -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/CMSIS/CMSIS/Include -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/CMSIS/Device/ATMEL -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/cores/arduino -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/variants/arduino_due_x -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -o "due_blink_data.o" "due_blink_data.c"
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-g++ -fno-threadsafe-statics -fno-rtti -fno-exceptions -Os -c -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -DARDUINO=161 -MD -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER='"Unknown"' -DUSB_PRODUCT='"Arduino Due"' -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_DUE_ -DMODEL=due_blink -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=9 -DMW_TIMERCOUNT=131250 -DMW_SAM_CLOCKID=TC_CMR_TCCLKS_TIMER_CLOCK3 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=due_blink -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/include -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/blocks/sfcn/include -IC:/Users/Dana/Documents/MATLAB/due_blink_ert_rtw -IC:/Users/Dana/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/libsam -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/CMSIS/CMSIS/Include -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/system/CMSIS/Device/ATMEL -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/cores/arduino -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/variants/arduino_due_x -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -o "USBCore.o" "C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp"
<command-line>:0:13: error: initializer fails to determine size of 'STRING_PRODUCT'
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp:69:34: note: in expansion of macro 'USB_PRODUCT'
const uint8_t STRING_PRODUCT[] = USB_PRODUCT;
^
<command-line>:0:13: error: array must be initialized with a brace-enclosed initializer
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp:69:34: note: in expansion of macro 'USB_PRODUCT'
const uint8_t STRING_PRODUCT[] = USB_PRODUCT;
^
gmake: *** [USBCore.o] Error 1
### Build procedure for model: 'due_blink' aborted due to an error.
Error(s) encountered while building "due_blink":
### Failed to generate all binary outputs.
Component: Simulink | Category: Model error
I have the Arduino Due board selected in the settings, with the correct COM port. When running the same model with an Arduino Uno, it works perfectly.
I can connect to the board in the Matlab command window and manually change the pins to HIGH or LOW, so it must be a problem with Simulink.
Any help would be appreciated.

  0 Comments

Sign in to comment.

1 Answer

Answer by MathWorks Simulink Team on 16 Nov 2015
Edited by MathWorks Simulink Team on 16 Nov 2015

This issue has been fixed in October Support package release published on 22nd Oct 2015. Please update the Simulink Arduino Support package to 15.2.1 version and then try deploying the model.
Previous version: 15.2.0
New Version: 15.2.1

  0 Comments

Sign in to comment.