Can not connect raspberry pi 4 to matlab

조회 수: 36 (최근 30일)
N/A
N/A 2020년 5월 6일
답변: sameer rafee 2023년 2월 11일
I have a raspberry pi 4 model B 1GB RAM that I am trying to connect to matlab R2020a for processor in the loop simulation.
I downloaded the matlab support package for raspberry pi and followed the instructions multiple times carefully, but every time it fails to discover raspberry pi hardware and doesn't give any error messages except "could not detect raspberry pi hardware in allotted time". Even the "test connection" button fails.
I tried different network connections and different power supply and different SD card and redownloaded the raspbian image to make sure it is not corrupted, but always failed.
note: I was using raspbian image R20.1.0 as suggested by the support package instructions.
Any help would be appreciated.
  댓글 수: 4
Prasanth Sunkara
Prasanth Sunkara 2020년 5월 8일
Thank you for replying soon with the debugging information.
Here are my suggestions.
1) Good to know that the raspberry pi booted normally with MathWorks image when you connected a monitor. How is raspberry pi connected to the network at your home? Is the pi connected to your home wifi? Or did you do you use a USB to ethernet cable and connected the pi to your pc? Also I am curious to see what "Network setting" you have choosen in the setup wizard.
2) I see you are calling raspi obj as below:
r= raspi(raspberrypi-sfsdfsd,pi,raspberry); % this is incorrect way
% those values must be of character array type. Try the below instead.
r=raspi('your raspberrypi host name','pi','raspberry'); % correct way
Also, ensure that you pi is in the same network as your PC.
Check out the link below as well.
Thanks,
Prasanth
N/A
N/A 2020년 5월 13일
Hello Prasanth
Sorry for the delayed reply. I setup a new PC with fresh install of Windows 10, Matlab/Simulink, MinGW, .NET Framework, and a monitor to always check that RPI boots and be able to interacte with it.
I was able to successfully connect RPI to Simulink when connecting to a wireless network or manually entering network settings (Fig 1).
1) However, I always fail to connect when choosing to connect directly to host computer (Fig 2). RPI doesn't speak ip adress in this mode, and wasn't able to determine its ip adress by typing "ifconfig" in linux terminal (Fig 3). if I just carry on and finish the setup process and try to deploy a simple example It fails connecting to SSH server (Fig 4-5). And if I create a RPI object and openSHELL() and enable it, I get a different error (Fig 6). Am I missing something?
2) I could settle for connecting by manually entering network settings as I would still be using an ethernet cable as I prefere. However, if I close Matlab and shut off RPI and come back again, I might sometimes be successful in deploying the model and somtimes not (Fig 7). Is there a proper way to reestablish the connection between Matlab or Simulink and RPI?
Thank you very much for the help, I really appreciate it.

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

답변 (6개)

sihan du
sihan du 2020년 5월 24일
Hello Mustafa
I have the same question with you,and I don't know how to solve it.Any help would be appreciated.Thank you.
  댓글 수: 2
N/A
N/A 2020년 5월 24일
I wasn't able to fully resolve my problem. Still some types of connections work such as through home network or by entering network settings manually, while other connections such as directly to host computer don't work. What I did was used a different host computer with fresh install of windows, drivers, updates, MATLAB. Try at least to make sure your windows, drivers, and MATLAB are upto date, and reinstall the support package. Try connecting through a home network if you would like to use wifi connectivity and make sure the router doesn't have too many other devices connected to it. Also you could try to enter network settings manually if you would like to connect the RPI directly via ethernet, just set the host name you desire and let it assign IP adress automatically, that worked for me. Last but not least make sure your RPI is compatible with your MATLAB version. I hope that is of help, and best of luck.
sihan du
sihan du 2020년 5월 26일
I 'm sorry to reply to you in a few days.I've tried every one of these four methods in the past few days,but each failed in the end. At the end of each attempt,the hara ware could not be connected. My friend and I made the same attempt. My friend succeeded, but I failed. Maybe I should change a new computer. Thank you very muchufor your help. Ifi can solve this problem, I wil discuss my solution with you.Thank you again for your help.

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


Chew Wen Da
Chew Wen Da 2021년 5월 31일
편집: Chew Wen Da 2021년 5월 31일
I was having the same issue too while using version R2020a. After updating the version to R2021a, I can finally reach my RPI. By the way, the firmware also updated to version (mathworks_raspbian_DL_R21.1.0), previously in R2020a is (mathworks_raspbian_DL_R20.1.0). These are from the download link given in the support window.This post helped me a lot, thanks!
Unfortunately after the IP is detected, my laptop just cannot establish the connection to the board and keep showing either these 2 lines of error. Furthermore, its taking 3 to 4 mins to show too. Please help!
Thanks in advance.
  댓글 수: 1
Chew Wen Da
Chew Wen Da 2021년 6월 3일
Hi, to update on this matter, the problem has been resolved! I tried to use MATLAB online to connect to my RPI and I follow through the process step by step including reinstallation of the firmware (you can follow the link below). In the end I get to connect and realized that my RPI model is not the same as written on my RPI 4B board, it was a RPI 2B instead. After this, I tried to make connection again with MATLAB R2021a and it works fine!
After all, I think the issue can be resolve by installing the MATLAB firmware from the terminal. You can access to your RPI interface using VNC Viewer. Just input the IP address, ID and password.
Connect to Raspberry Pi Hardware Board in MATLAB Online
https://www.mathworks.com/help/supportpkg/raspberrypiio/ug/connect-to-raspberry-pi-hardware-board-in-matlab-online.html

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


Nicholas Minnie
Nicholas Minnie 2021년 11월 1일
Hi, I had the same issue. I was able to resolve it by using the raspberry pi imager to write the original Raspbian OS to the SD card and using the advanced setting to enable headless setup and configure the network settings. Then using the hardware setup on MATLAB I was able to select "Customize the existing Raspbian OS on my hardware" and the Test connection was sucessful. Just ensure that you know the IP adress of both your Raspberry Pi and Network.
Hope this helps.

位默
位默 2023년 2월 11일
Hi dear, I need you to help me, I have encountered the same problem as your right, I can't find the package for Raspberry Pi 4 Model B in MATLAB,I used a Raspberry Pi 3 Model B+ but it fails:
Could not detect the Raspberry Pi hardware in allotted time. Try using "Test Connection" button.
Any help would be appreciated.

sameer rafee
sameer rafee 2023년 2월 11일
Hi dear, I need you to help me, I have encountered the same problem as your right, I can't find the package for Raspberry Pi 4 Model B in MATLAB,I used a Raspberry Pi 3 Model B+ but it fails:
Could not detect the Raspberry Pi hardware in allotted time. Try using "Test Connection" button.
Any help would be appreciated.

sameer rafee
sameer rafee 2023년 2월 11일
Hi dear, I need you to help me, I have encountered the same problem as your right, I can't find the package for Raspberry Pi 4 Model B in MATLAB,I used a Raspberry Pi 3 Model B+ but it fails:
Could not detect the Raspberry Pi hardware in allotted time. Try using "Test Connection" button.
Any help would be appreciated.

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Raspberry Pi Hardware에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by