- Programming the BeagleBone
- Yogesh Chavan
- 1899字
- 2021-07-23 14:36:45
Setting up BeagleBone
Embedded boards lack rich programming environment like x86 Desktop PC. Often they are connected to x86 Desktop for programming. Before starting programming, we need to connect BeagleBone to PC and set up the working environment. Let us see different ways to connect to BeagleBone and how to start Cloud9 programming IDE and the useful bone101 page. If you connect the BeagleBone via any one the following ways successfully, you can skip others. You will need a little Linux commands knowledge here. If any of these connection steps do not work, try the steps given in Troubleshooting
section. The most common problem is the power supply. USB 2.0 is designed to supply max 500mA current, which is fine if you are not attaching peripherals to BeagleBone. But if you are connecting Ethernet, HDMI or USB devices, you should use a 5V 2A power adapter with 5.5mm DC barrel jack to power up BeagleBone. You can get it at https://www.sparkfun.com/products/12889. On BeagleBone Green, you will have to use a 5V 2A Micro USB power adapter. You can get it at: https://www.sparkfun.com/products/12890.
By default, you can login as username debian
and password temppwd
on default Debian images for BeagleBone. This user has sudo access to all the commands in the current Debian image. The board has to be secured before starting to use it. Once logged in, you should change the password of debian
user using the command passwd
. You can also login as root
with no password when asked. You should login as a root user and change the root password too using the same command.
Direct connection to monitor and keyboard
BeagleBone Black comes with a Micro HDMI port. You can connect it to HDMI monitor/TV/display using Micro HDMI-HDMI cable. You can attach USB keyboard and mouse to USB port directly or using USB hub. There is no need of a host laptop/desktop PC for this connectivity. After GUI login, you can get shell access by opening terminal emulator like lxterminal
. You can browse local files on BeagleBone. You can open the browser and visit http://beaglebone.local
to see the bone101 page and http://beaglebone.local:3000
to open Cloud9 IDE. There are HDMI
/DVI
/VGA
/LCD
add-on cape boards that fit on the BeagleBone and help you to achieve similar connectivity.
Ethernet over USB
For this connection, you need to connect the BeagleBone to the host laptop/desktop PC using a USB to MiniUSB cable (Micro USB in case of BeagleBone Green). This is a popular way of accessing BeagleBone and programming on Cloud9 IDE. BeagleBone treats its MiniUSB port as a virtual Ethernet port using a special driver. With the help of this driver, one can attach an IP address to MiniUSB port and access it like the Ethernet. By default, it has the static address 192.168.7.2
. In order to communicate with it, you need to have usbnet/RNDIS
driver installed on a connected PC. It comes preinstalled in most of the Linux systems. In that case, you will get a new Ethernet entry in output of command ifconfig
. On a Windows system, you need to install RNDIS
drivers manually. BeagleBone has a RNDIS
driver installable in its fat storage. Please refer to the Installing Debian image on SD card section, to open the Getting Started
webpage. This page has a local link to an executable file that installs RNDIS
and other drivers. Click on the correct driver link on the Getting Started
page according to your PC OS. You can also install the driver manually from the Drivers
folder in BeagleBone's fat storage.
After installing the RNDIS2
driver, you will see the new network card interface in network settings. It should get IP address 192.168.7.1
via dhcp
. If not, manually give the IP address to new network interface on your PC—192.168.7.1
. You can open the bone101 page by putting http://192.168.7.2
in the browser address bar and Cloud9 IDE with http://192.168.7.2:3000/
.You can get shell access on BeagleBone by running command ssh root@192.168.7.2
in the Linux
/Mac
terminal. On Windows systems, you will need terminal emulator like putty for this. You need to connect BeagleBone to the router via an Ethernet or USB-Wi-Fi in order to get Internet access. You can use a VNC connection to get BeagleBone GUI access. It is covered in a later section.
Troubleshooting
- Use Firefox/Chrome only for connection. Internet Explorer is not supported.
- Sometimes, BeagleBone's usb0 (Ethernet over USB) interface does not get turned on automatically. It can be turned on by doing shell access to BeagleBone and executing the command:
sudo ifconfig usb0 up.
- Refer to the table at end of this topic to learn different ways you can get shell access. After getting shell access to BeagleBone, you can use utilities like
ifconfig
,ping
anddmesg
to debug further. - If you were not able to install the
RNDIS
driver from the BeagleBone flash storage, you can install drivers from http://beagleboard.org/static/Drivers.
Ethernet port or USB Wi-Fi adapter
BeagleBone comes with an Ethernet port. You can connect a laptop/desktop PC and BeagleBone via a Ethernet cable directly or preferably via a router. By default, the Ethernet port of BeagleBone is configured to get automatic IP address via dhcp. There should be a dhcp server configured in your network to get the IP address assigned to the BeagleBone Ethernet port. Ethernet port connection with the Internet-connected router gives your BeagleBone access to the Internet. Then you can install/upgrade packages on the Internet. Many programs in this book rely on Internet connection to the BeagleBone. This is the most preferred way of connection as far as this book is concerned.
Another option is to connect the USB Wi-Fi adapter to BeagleBone and then connect your PC to BeagleBone via its IP address. You need to install the correct kernel firmware package according to your Wi-Fi adapter chipset using the command apt-get
. Once configured, this connection works the same as the Ethernet connection.
If you connect it via Ethernet or a USB-Wi-Fi adapter, you can browse http://<<Beaglebone's ip address>>
for the bone101 page and http://<<Beaglebone's ip address>>:3000
for Cloud9 IDE. BeagleBone Ethernet gets its IP address via DHCP. You can find out the IP address of BeagleBone from the router web login. You can also get shell access and run the command ifconfig to find out the IP address of the BeagleBone. Different methods to get BeagleBone shell access are given in the table at the end of this topic. So, if the BeagleBone IP address is found to be 192.168.1.2
, then the bone101 page will be accessible at http://192.168.1.2
. You can also ssh
to root@<<Beaglebone's ip address>>
to get shell access via Ethernet. You can do VNC connection to get BeagleBone GUI access, which is covered in the next section.
Troubleshooting
- Troubleshooting Ethernet/USB-Wi-Fi steps follows the same steps as Ethernet over USB troubleshooting. But for the Ethernet port, the IP addressing scheme will be different than
192.168.7.x
. - In case of a problem with a USB-Wi-Fi adapter, make a serial or Ethernet over USB connection to BeagleBone to get shell access and check whether it is getting detected by the command
dmesg
. If it is detected correctly, you can configure it usingiwconfig
andifconfig
.
VNC
You can also connect via VNC (Virtual Network Computing). It is a remote desktop connection. You need to connect via the Ethernet over USB or Ethernet or USB-Wi-Fi method first to do a VNC connection. Debian for BeagleBone comes with tightvncserver preinstalled. To set up VNC get shell access to BeagleBone and run the command vncserver
on it as a Debian user. Download VNC client software on PC and connect to server beaglebone:1
. You will get a similar GUI like you get on an HDMI connection. You will be able to get shell access via the lxterminal
terminal emulator, browse the bone101 page at http://beaglebone.local
and browse cloud9 IDE at http://beaglebone.local:3000
. As BeagleBone White and BeagleBone Green do not have an HDMI port, this option is useful if you want GUI access.
Troubleshooting
- The
vncserver
display does not always run on:1
. Commandvncserver
prints the name of the display it is running on. Note it down and use it when connecting from the VNC viewer. - Sometimes the IP address works instead of the name. Specify
<beaglebone ip address>:1
as the server display. - The VNC session might not use the
lxde
window manager. Currently Debian uses openbox window manager for the VNC session of thedebian
user. It shows the desktop with no icon or panel. You get shell and browser access by right-clicking on the desktop.
Serial Connection
Serial connection gives you a booting log and then a SSH-like command line interface. Please note that you cannot access Cloud9 or bone101 page or GUI using serial connection. BeagleBone provides two types of serial access. One is using a pseudo USB-serial driver on a USB port. You get a SSH-like shell access by this method. As a USB-serial driver starts working after kernel booting, you do not get boot logs by this method. BeagleBone Black on MiniUSB port and BeagleBone Green on Micro USB port provide this type of serial access. When you connect by these methods, BeagleBone appears as serial device on the connected PC. On Windows, it appears as serial COM port in the device manager. Note down the COM port number in the device manager and connect to that port via putty or hyperterminal specifying baud rate 115200.
On the Linux system, check kernel messages of the PC using the command dmesg
to find out the name of the device it got detected as. It gets detected as /dev/ttyUSB0
by default. You can use this command to connect it serially:
sudo screen /dev/ttyUSB0 115200
When you are done, press Ctrl + A then K to exit the screen.
Another type of serial connection possible on BeagleBone is via using a hardware chip that is responsible for making a serial connection. As an external chip is doing the work, this method gives boot time logs as well as shell access when booting is done. This connection is the only way to get logs when BeagleBone is failing to boot properly. It is useful to configure Ethernet, and debug problems. BeagleBone White has FTDI USB-to-serial conversion chip onboard. It gives serial access over a MiniUSB port. For BeagleBone Black and BeagleBone Green, the onboard USB-serial chip is absent. But there are serial header pins available onboard. You need a special USB-serial TTL cable to attach to these header pins. Any FTDI or PL2303 or cp210x chip based USB TTL cable can be used here. The FTDI cable from Adafruit is popular which can be found at https://www.adafruit.com/products/70. You will have to install drivers corresponding to the chip used in the cable. Drivers for these chips come preinstalled in most of the Linux systems and the serial port gets detected as /dev/ttUSB0
by default. You can connect using the screen
command we covered in previous paragraph. Windows drivers for FTDI or PL2303 of CP210x are available on vendor websites. Once you install the driver, you will be able to locate the COM port in the device manager and connect via the hyperterminal or putty:

Besides all these options, Cloud9 IDE has one tab inside it, which gives you a root shell. So, if you have Cloud9 access, there is no need to connect via terminal emulator or SSH to get BeagleBone shell access. Here is a helpful link on BeagleBone wiki about connecting BeagleBone http://elinux.org/Beagleboard:Terminal_Shells.
- JavaScript+DHTML語(yǔ)法與范例詳解詞典
- PHP網(wǎng)絡(luò)編程學(xué)習(xí)筆記
- Podman實(shí)戰(zhàn)
- 差分進(jìn)化算法及其高維多目標(biāo)優(yōu)化應(yīng)用
- Haxe Game Development Essentials
- C語(yǔ)言程序設(shè)計(jì)
- Mastering JavaScript Design Patterns(Second Edition)
- Java程序設(shè)計(jì)案例教程
- 遠(yuǎn)方:兩位持續(xù)創(chuàng)業(yè)者的點(diǎn)滴思考
- 深度學(xué)習(xí)程序設(shè)計(jì)實(shí)戰(zhàn)
- 零基礎(chǔ)C#學(xué)習(xí)筆記
- HTML5移動(dòng)前端開(kāi)發(fā)基礎(chǔ)與實(shí)戰(zhàn)(微課版)
- Data Manipulation with R(Second Edition)
- 原型設(shè)計(jì):打造成功產(chǎn)品的實(shí)用方法及實(shí)踐
- Python滲透測(cè)試編程技術(shù):方法與實(shí)踐(第2版)