MATLAB Answers

Unable to connect to 'Raspberry Pi' target hardware to check for NEON instruction set support

13 views (last 30 days)
Torbjörn Olsson
Torbjörn Olsson on 15 Dec 2019
Commented: Torbjörn Olsson on 4 Feb 2020 at 16:29
I am unsuccessful to generate code for my Raspberry 3B single card computer. I am using Matlab 2019a and Matlab coder. I don't know if needed in this case, but I also have Embedded coder toolbox installed. The error occurs when executing 'codegen' command, or if I use 'Generate' in the Matlab Coder app. (That is, only when I set the Raspberry HW board to do the compilation. It compiles nicely using the Host Computer to do the compilation with the GNU GCC Raspberry Pi toolchain.)
I receive the following error message: "Unable to connect to 'Raspberry Pi' target hardware to check for NEON instruction set support. To connect to target hardware, parameters such as username, password and device address must be specified correctly.
Use help codegen for more information on using this command."
However, I have correct username, password and device address for the Rpi, as well as properly set environmental variables on the Raspberry (tripple checked). The issue occurs when trying to generate code out of my own matlab function as well as when I try to run the 'codegen' command in Mathworks example "Code Generation for Deep Learning on Raspberry Pi".
I have reinstalled Matlab as well as reinstalled the Matlab Raspbian image on the Raspberry, but the issue still remains.
Installed Support packages which I believe are the ones I need for this task (along the ones mentioned above):
Embedded Coder Support Package for ARM Cortex-A Processors
DSP System Toolbox Support Package for ARM Cortex-A Processors
MATLAB Coder Interface for Deep Learning Libraries
MATLAB Support Package for Raspberry Pi Hardware
I have googled this issue, but have still not found a solution that helps me, so I would be very grateful for any tips how to overcome this issue.
Thank You!

  5 Comments

Show 2 older comments
Prasanth Sunkara
Prasanth Sunkara on 24 Jan 2020
Hi Torbjörn,
I see that you are trying to follow this example.
In order to investigate this could you please share the output of the below MATLAB commands while following the exact sequence of steps mentioned in the example page.
hw = coder.hardware('Raspberry Pi')
cfg.Hardware = hw
Thanks,
Prasanth
Torbjörn Olsson
Torbjörn Olsson on 24 Jan 2020
Hi Prasanth,
Thanks for lookin into this! The output from Matlab is as follows:
>> CodeGenerationForDeepLearningOnRaspberryPiExample
% Copyright 2018 The MathWorks, Inc.
function out = squeezenet_raspi_predict(in)
%#codegen
% A persistent object mynet is used to load the DAGNetwork object.
% At the first call to this function, the persistent object is constructed and
% set up. When the function is called subsequent times, the same object is reused
% to call predict on inputs, avoiding reconstructing and reloading the
% network object.
persistent net;
opencv_linkflags = '`pkg-config --cflags --libs opencv`';
coder.updateBuildInfo('addLinkFlags',opencv_linkflags);
if isempty(net)
net = coder.loadDeepLearningNetwork('squeezenet', 'squeezenet');
end
out = net.predict(in);
end
Unable to connect to 'Raspberry Pi' target hardware to check for NEON instruction set support. To connect
to target hardware, parameters such as username, password and device address must be specified correctly.
Use help codegen for more information on using this command.
Error using codegen
Error in CodeGenerationForDeepLearningOnRaspberryPiExample (line 88)
codegen -config cfg squeezenet_raspi_predict -args {ones(227, 227, 3,'single')} -report
>> hw = coder.hardware('Raspberry Pi')
hw =
Hardware with properties:
Name: 'Raspberry Pi'
CPUClockRate: 1000
DeviceAddress: '192.168.0.149'
Username: 'pi'
BuildDir: '~/remoteBuildDir'
Password: 'raspberry'
>> cfg.Hardware = hw
cfg =
Description: 'class EmbeddedCodeConfig: C code generation Embedded Coder configuration objects.'
Name: 'EmbeddedCodeConfig'
-------------------------------- Report -------------------------------
EnableTraceability: true
GenerateCodeMetricsReport: false
GenerateCodeReplacementReport: false
GenerateReport: false
HighlightPotentialDataTypeIssues: false
LaunchReport: false
ReportInfoVarName: ''
ReportPotentialDifferences: true
------------------------------- Debugging -----------------------------
RuntimeChecks: false
---------------------------- Code Generation --------------------------
BuildConfiguration: 'Faster Runs'
CodeExecutionProfiling: false
CustomToolchainOptions: [1x22 cell]
DataTypeReplacement: 'CBuiltIn'
FilePartitionMethod: 'MapMFileToCFile'
GenCodeOnly: false
GenerateExampleMain: 'GenerateCodeOnly'
GenerateMakefile: true
HighlightPotentialRowMajorIssues: true
MultiInstanceCode: false
OutputType: 'EXE'
PassStructByReference: true
PostCodeGenCommand: ''
PreserveArrayDimensions: false
RowMajor: false
SILDebugging: false
SILPILCheckConstantInputs: true
TargetLang: 'C++'
Toolchain: 'GNU GCC Raspberry Pi'
VerificationMode: 'None'
------------------------ Language And Semantics -----------------------
CodeReplacementLibrary: 'None'
CompileTimeRecursionLimit: 50
ConstantFoldingTimeout: 40000
DynamicMemoryAllocation: 'Threshold'
DynamicMemoryAllocationThreshold: 65536
EnableAutoExtrinsicCalls: true
EnableRuntimeRecursion: true
EnableVariableSizing: true
GenerateNonFiniteFilesIfUsed: true
InitFltsAndDblsToZero: true
PreserveVariableNames: 'None'
PurelyIntegerCode: false
SILPILSyncGlobalData: true
SaturateOnIntegerOverflow: true
SupportNonFinite: true
TargetLangStandard: 'C++03 (ISO)'
---------------- Function Inlining and Stack Allocation ---------------
InlineStackLimit: 4000
InlineThreshold: 10
InlineThresholdMax: 200
StackUsageMax: 200000
----------------------------- Optimizations ---------------------------
ConvertIfToSwitch: false
EnableMemcpy: true
EnableOpenMP: true
EnableStrengthReduction: false
LoopUnrollThreshold: 5
MemcpyThreshold: 64
------------------------------- Comments ------------------------------
GenerateComments: true
MATLABFcnDesc: true
MATLABSourceComments: false
Verbose: false
------------------------------ Custom Code ----------------------------
CustomHeaderCode: ''
CustomInclude: ''
CustomInitializer: ''
CustomLibrary: ''
CustomSource: 'main_squeezenet_raspi.cpp'
CustomSourceCode: ''
CustomTerminator: ''
ReservedNameArray: ''
-------------------------- Third Party Library ------------------------
CustomBLASCallback: ''
CustomFFTCallback: ''
CustomLAPACKCallback: ''
------------------------------ Code Style -----------------------------
CastingMode: 'Nominal'
CodeTemplate: []
ColumnLimit: 80
CommentStyle: 'Auto'
CustomSymbolStrEMXArray: 'emxArray_$M$N'
CustomSymbolStrEMXArrayFcn: 'emx$M$N'
CustomSymbolStrFcn: '$M$N'
CustomSymbolStrField: '$M$N'
CustomSymbolStrGlobalVar: '$M$N'
CustomSymbolStrMacro: '$M$N'
CustomSymbolStrTmpVar: '$M$N'
CustomSymbolStrType: '$M$N'
EnableCustomReplacementTypes: false
EnableSignedLeftShifts: true
EnableSignedRightShifts: true
GenerateDefaultInSwitch: false
IncludeTerminateFcn: true
IndentSize: 2
IndentStyle: 'K&R'
MaxIdLength: 31
ParenthesesLevel: 'Nominal'
PreserveExternInFcnDecls: true
ReplacementTypes: [1x1 coder.ReplacementTypes]
------------------------------- Hardware ------------------------------
Hardware: [1x1 coder.Hardware]
HardwareImplementation: [1x1 coder.HardwareImplementation]
Edit Configuration Object
>>
Thanks,
Torbjörn
Torbjörn Olsson
Torbjörn Olsson on 4 Feb 2020 at 16:29
Another clue is that I can generate an executable for a "Hello World" matlab function where Matlab Coder App generate C++ code and an executable directly on the Rpi. However, when I activate the Arm Compute Library settings in the Matlab Coder "More settings" tab for this Matlab Coder project (Arm Compute Library is not needed for this simple example, it is just invoked for testing), I receive the same error as above:
"Unable to connect to 'Raspberry Pi' target hardware to check for NEON instruction set support. To connect to
target hardware, parameters such as username, password and device address must be specified correctly.
Use help codegen for more information on using this command."
Hopefully someone smarter than I can figure out what I am doing wrong.
Thanks,
Torbjörn

Sign in to comment.

Answers (1)

Ahmed Bouzidi
Ahmed Bouzidi on 19 Dec 2019
i'm facing this problem too pls any help

  1 Comment

Torbjörn Olsson
Torbjörn Olsson on 23 Dec 2019
Hello Ahmed,
Thank you for the information. I am glad you found a solution. It didn't work for me though. I tried with a direct Ethernet connection to totally circumvent the router, but with no luck.
I am right now trying to do without the Matlab Rpi Hardware Support package for Raspberry Pi which I suspect (current hypothesis) is the root to my problems, and I have thus (so far) been able to generate code for a static library with Arm Compute Lib on the Rpi with the code generated by Matlab on the host and then locally compiling it on the Rpi with Visual Studio.
I hope this will be a way to eventually generate an executable, but it is a bit awkward as compared to using a Hardware Support Package. I will buy a Rpi 3B+ (instead of the Rpi 3B) and hopefully it will be more compatible with Mathworks software.

Sign in to comment.

Sign in to answer this question.