MATLAB Answers

Problem communicating with BeagleBone Black using MATLAB

32 views (last 30 days)
Marian Brännvall
Marian Brännvall on 11 Nov 2019
Answered: Judith Martinez etwa 7 Stunden ago
We have a beaglebone black which has been installed by following the 'Getting started'-instructions from beaglebone.org. It is connected to the computer (Windows) via USB and the SSH connection has been check using putty. We have installed the following support packages in MATLAB:
  • Embedded Coder Support Package for BeagleBone Black Hardware
  • MATLAB Support Package for BeagleBone Black Hardware
Here follows some of the commands we've written and the corresponding error messages:
>> bb=beaglebone('192.168.7.2','root','')
Error using beaglebone (line 236)
Cannot establish an SSH connection to the board with device address "192.168.7.2", user name "root", password "".
Check if device address, user name and password are correct.
>> bb=beaglebone('192.168.7.2','debian','temppwd')
Error using beaglebone.internal.sshclient/executeCommand
Error executing command: sudo: no tty present and no askpass program specified
Error in beaglebone/addHostToEtcHosts (line 968)
out = obj.Ssh.executeCommand('sudo cat /etc/hosts');
Error in beaglebone (line 241)
addHostToEtcHosts(obj, '192.168.7.1', 'foo');
>> bb=beaglebone_black('192.168.7.2','debian','temppwd');
>> printPinGroups(bb)
Error using beaglebone_black/printPinGroups (line 491)
Error executing command "sudo cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups". Details:
STDERR: sudo: no tty present and no askpass program specified
STDOUT:
>> bb=beaglebone_black('192.168.7.2','root','');
>> printPinGroups(bb)
Error using beaglebone_black/printPinGroups (line 491)
Connection to SSH server at 192.168.7.2 closed. Clear the hardware
communication object and re-create it to establish connection.
Any ideas of what might be causing these errors?

Answers (2)

Will Coulter
Will Coulter on 4 May 2021 at 3:09
You want to do two things to get around these problems.
MATLAB isn't set up to work with an interactive prompt. The only workaround I've found for this is to give the debian:temppwd (or whatever you use) sudoers rights. You can do this by adding debian to the sudoers list. You an find an example at https://phpraxis.wordpress.com/2016/09/27/enable-sudo-without-password-in-ubuntudebian/
Additionally, you need to list your MATLAB-computer's IP address with a host name of 'foo' ... for example, if your MATLAB-computer is at 192.168.1.36, make sure /etc/hosts on the beaglebone has a line that says "192.168.1.36 foo"

Judith Martinez
Judith Martinez etwa 7 Stunden ago
using command bbb = beaglebone_black ('192.168.7.2', 'debian', 'temppwd') already works;)

Community Treasure Hunt

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

Start Hunting!

Translated by