Info

This question is closed. Reopen it to edit or answer.

matlab arduino toolkit for linux is broken for the can read block

1 view (last 30 days)
Build 1 1
08:26 PM Elapsed: 2 sec
Top Model Build 1
Elapsed: 1 sec
### Starting build procedure for: broken_can_example
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: /home/siegeljb/esp/esp-idf/broken_can_example_ert_rtw
### Build procedure for broken_can_example aborted due to an error.
MATLAB System block 'broken_can_example/CAN Receive' error occurred when invoking 'getOutputDataTypeImpl' method of 'codertarget.arduinobase.internal.arduinoCANReceive'. The error was thrown from '
'/usr/local/MATLAB/R2020a/toolbox/rtw/rtw/tlc_c.p' at line 0
'/usr/local/MATLAB/R2020a/toolbox/coder/simulinkcoder_core/+coder/+internal/ModelBuilder.m' at line 840
'/usr/local/MATLAB/R2020a/toolbox/coder/simulinkcoder_core/+coder/+internal/ModelBuilder.m' at line 173
'/usr/local/MATLAB/R2020a/toolbox/coder/simulinkcoder_core/+coder/+internal/@ModelCodegenMgr/make_rtw.m' at line 8
'/usr/local/MATLAB/R2020a/toolbox/coder/simulinkcoder_core/make_rtw.m' at line 20
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/private/build_target.p' at line 0
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/private/build_target.p' at line 0
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/private/build_standalone_rtw_target.p' at line 0
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/private/slbuild_private.p' at line 0
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/private/slbuild_private.p' at line 0
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/sl.m' at line 15
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/slbuild.m' at line 98
'/usr/local/MATLAB/R2020a/toolbox/simulink/simulink/slprivate.m' at line 11
'/usr/local/MATLAB/R2020a/toolbox/coder/sltoolstrip_base_hw/m/+coder/+internal/+toolstrip/HardwareBoardHandler.m' at line 105
'/usr/local/MATLAB/R2020a/toolbox/target/codertarget/sltoolstrip/m/+codertarget/+sltoolstrip/EmbeddedHardwareBoardContext.m' at line 147
'/usr/local/MATLAB/R2020a/toolbox/target/codertarget/sltoolstrip/m/+codertarget/+sltoolstrip/EmbeddedHardwareBoardContext.m' at line 130
'/usr/local/MATLAB/R2020a/toolbox/coder/sltoolstrip_base_hw/m/+coder/+internal/+toolstrip/HardwareBoardContext.m' at line 330'.
Caused by:
Reported by broken_can_example/CAN Receive: 'getOutputDataTypeImpl' method of the System object 'codertarget.arduinobase.internal.arduinoCANReceive' for 'broken_can_example/CAN Receive' returned invalid data type 'arduinoCANMsg' for output port 1. The return value must be a character vector of: built-in data type, name of embedded.numerictype object, name of Simulink.enumeration class, name of Simulink.Bus object, name of Simulink.NumericType object or name of Simulink.AliasType object.
Component:Simulink | Category:Block diagram error

Answers (1)

Arun Kumar
Arun Kumar on 11 Jun 2020
Hi Jason,
Please execute the following code in MATLAB command line and then try to build the model:
sppkgroot = codertarget.arduinobase.internal.getSpPkgRootDir;
srcFolder = fullfile(sppkgroot,'arduinoutilities');
srcFile = fullfile(sppkgroot,'arduinoutilities','arduinoCANMsg.m');
parentFolder = fullfile(matlabroot, 'toolbox', 'target');
destFolder = fullfile(matlabroot, 'toolbox', 'target', 'arduinoutilities');
destFile = fullfile(destFolder, 'arduinoCANMsg.m');
if ~exist(destFolder,'dir')
[success, ~, ~] = mkdir(parentFolder, 'arduinoutilities');
if ~success
error(message('arduino:build:CANMsgFolderCopyError',sppkgroot,parentFolder));
end
end
if ~exist(destFile,'file')
[success,~,~] = copyfile(srcFile, destFolder, 'f');
if ~success
error(message('arduino:build:CANMsgFileCopyError',srcFolder, destFolder));
end
addpath(destFolder);
else
addpath(destFolder);
end
This should solve the problem.
In case of any error, please run MATLAB as administrator and try again.
If you still run into any issues, please contact Mathworks Technical Support.
Hope this helps!
  1 Comment
Jason Siegel
Jason Siegel on 11 Jun 2020
I couldnt run matlab as root due to the license tied to a specific user, but adding write permission on the directory/usr/local/MATLAB/R2020a/toolbox solved the issue.
Thankyou

This question is closed.

Products

Community Treasure Hunt

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

Start Hunting!