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

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

hi man,
i was facing this error but when i connected the pi to another rooter everything works fine hope that can solve your problem too
I have now tried ”everything” - I think - to be able to run the Mathworks examples, but obviously I am doing something wrong. This is what I have done so far:
Ruled out the possibility of a hardware fault:
  1. Tried two different Matlab host computers. Win 10 and Linux.
  2. Connection with the Rpi. Tried with Wifi and direct Ethernet connection.
  3. Used a Rpi 3B as well as a 3B+ (used four different SD-cards).
I have installed the following Matlab support packages (for Matlab 2019a):
  1. Deep Learning Toolbox Model for SqueezeNet Network
  2. Matlab Coder interface for Deep Learning Libraries
  3. Embedded Coder
  4. DSP Systems Toolbox Support Package for ARM Cortex-A Processors
  5. Simulink Support Package for Raspberry Pi Hardware
  6. Matlab Support Package for Raspberry Pi Hardware
  7. Statistics and Machine Learning Toolbox
  8. Simulink
  9. Signal Processing Toolbox
  10. Matlab Coder
  11. DSP System Toolbox
  12. Deep Learning Toolbox
  13. Control System Toolbox
  14. Communications Toolbox
  15. Embedded Coder Support Package for Xilinx Zynq Platform
  16. Embedded Coder Interface to QEMU Emulator
The Rpi SD card ”burned” with the Matlab furnished image file through the Support Package for Rpi.
Followed the ”MATLAB Coder: How do I build the ARM Compute Library for Deep Learning C++ code generation and deployment?” instructions exactly to install the ARM Compute Library 18.05 on the Rpi. Have changed the name of the ”build” directory to ”lib” in the ComputeLibrary folder.
I have set the environmental variables on the Rpi according to the instructions in ”MATLAB Coder: How do I setup the environment variables on ARM targets to point to the ARM Compute Library?”. That is:
ARM_COMPUTELIB=~/ComputeLibrary
PATH=${PATH}:~/ComputeLibrary
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:~/ComputeLibrary/lib
The environmental variables on the host computer changed in Matlab along the guidelines in ”Prerequisites for Deep Learning with MATLAB Coder” (however adopted to the environmental variables on the Rpi):
setenv(’ARM_COMPUTELIB’, ’~/ComputeLibrary’)
setenv(’LD_LIBRARY_PATH’, ’~/ComputeLibrary/lib’)
OPENCV installed on the host computer. OPENCV_DIR environment variable set to 'C:\Users\Olt\opencv\build'.
However, when trying to follow one of the initial examples for Deep Learning on the Rpi in Matlab, the ”Code Generation for Deep Learning on Raspberry Pi”, I get the following error message:
****
”% 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 -v”
****
The error occurs, as can be seen above, when executing the codegen command.
An additional bit of information is that I have no problem to generate an executable with Matlab Coder on the Rpi when running examples without Deep Learning.
I am now guessing that Matlab Coder somehow don’t find the Arm Compute Library, but why that is so, I don’t know.
I am grateful if someone has any thoughts to share in this matter.
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
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
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Ahmed Bouzidi
Ahmed Bouzidi 2019년 12월 19일
i'm facing this problem too pls any help

댓글 수: 1

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.

댓글을 달려면 로그인하십시오.

질문:

2019년 12월 15일

댓글:

2020년 2월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by