Troubleshooting - BeagleBone For Dummies (2015)

BeagleBone For Dummies (2015)

Appendix A

Troubleshooting

One frustrating thing about electronics and computation is that quite often, things don’t work as they should. You find yourself angrily asking “Why?!”, and you may even blame the BeagleBone for not doing what you asked it to.

Then you find the source of the issue, and you bring your palm to your face when you realize how simple the mistake was. You may even apologize to your computer for having unjustly accused it of causing the problem.

This appendix describes some common issues and explains how to solve them, and it provides a few tips and tricks on how to tackle problems that aren’t included in these pages. We hope there won’t be many!

Common Sources of Errors

This section presents a few typical mistakes that even the most experienced programmers and electronics enthusiasts often experience.

Issue:

The BeagleBone doesn’t power on. Its built-in light-emitting diodes (LEDs) aren’t lighting up.

Possible causes:

· Not enough power or faulty USB cable/USB port. This may happen if you have too many peripherals connected to the BeagleBone and you’re feeding it through a USB cable.

· You have a short circuit somewhere in your external wiring. A short circuit causes the board to shut down to prevent any further damage — but a short circuit always does some harm.

Solutions:

· Disconnect some peripherals; try a different USB cable or a different USB port. If these remedies fail, connect an external DC power source that can provide more current than a USB cable can.

· The problem might also be in your external DC power source, so if you have another one, try it.

· Double-check your circuit to ensure that everything’s wired up correctly. If your board went off immediately after establishing a connection, dismantle that connection, and wire it correctly. If not, grab a multimeter, and check the continuity. If there’s a short circuit, you hear the “beep” of a connection where it shouldn’t be.

You can read all about how to use a multimeter at www.dummies.com/extras/beaglebone.

· If none of the aforementioned solutions works, do a full power cycle. Press your BeagleBone’s power button for about 10 seconds. It should shut down and start over. This process isn’t the same as rebooting.

If all these attempts fail, perhaps contacting BeagleBoard.org support is the way to go. The board may be damaged, and you may have to fill out an RMA (Return Merchandise Application) form. This page should help you: http://beagleboard.org/support.

Issue:

The BeagleBone is on, but you aren’t able to log in via Secure Shell (SSH).

Possible causes:

· Faulty USB/Ethernet cable.

· Your USB cable is power-only; it doesn’t feature pins for data transmission. In this case, the user LEDs of your BeagleBone light up as normal.

· The default IP to connect through Ethernet has changed, so you can’t log in by typing beaglebone.

Solutions:

· To address the first two causes, attempt to establish the connection by using other cables. Try to connect your Mini USB cable to other devices to see whether it can establish a communication.

· If you can’t connect through an Ethernet cable, find the BeagleBone’s IP address and type it in the terminal window or PuTTY.

There are several ways to list all the IP addresses in the network that your computer is connected to:

· For Windows, you can install the Advanced IP Scanner (www.advanced-ip-scanner.com). All you have to do is click the Scan button.

· For Linux and Mac OS, you need to install nmap by using the command sudo apt-get install nmap. Then find your own IP address in your network by typing ifconfig in the terminal window. Below eth0, look for inet addr. You should see a number with four fields separated by dots. The first three fields are the same for all devices connected in the same network. Thus, if your IP address is something like 192.168.1.12, all other IP addresses have the format 192.168.1.X. To find all IP addresses in that format, type nmap 192.168.1.0/24 in the terminal window. This command shows you all addresses on the network from 192.168.1.0 to 192.168.1.255. One of those addresses is the BeagleBone’s, and that’s the IP you need to provide to connect to it.

Issue:

The BeagleBone crashed.

Solutions:

· Relax; it probably didn’t crash. It’s just too busy at the moment. Be patient, and let it finish its tasks.

· If you’re controlling the BeagleBone remotely, try pressing Ctrl+C to terminate the currently running process. If you’re running the Desktop environment, terminate a few programs. Otherwise, wait for a while.

· If your patience has run out, perhaps it really did crash. Reboot the BeagleBone by pressing the reboot button. It’s a button close to the Ethernet dongle labeled RESET.

Things Not to Do

This section covers some things that you should avoid doing often, as they can be hazardous to your board:

· Short-circuiting your board: Short circuits are the bane of all electronic devices. Even though the BeagleBone features protection against short circuits — it immediately shuts down — some harm is always done. A short circuit happens whenever a voltage supply is connected directly to ground without anything in between. Be careful about doing the following things:

· Connecting a 3.3V or 5V wire to a ground (GND) wire: This one seems like something you wouldn’t do, but it can happen if you’re distracted and mix up your wires. Color coding helps you prevent this problem.

· Misplacing a component: Plugging a resistor into the wrong hole may be all it takes to have a 3.3V or 5V wire and GND with nothing in between, causing a short circuit.

· Forgetting about pull-up resistors: A button doesn’t count as a component to place between a voltage source and ground. When you press a button and no pull-up resistor is present on your circuit, a short circuit happens.

· Having random unconnected wires floating around: When you walk past a black cat and break a mirror on a Friday the 13th, you may have the bad luck of two unattended wires causing a short circuit. It might seem like a long shot, but it can happen. It has happened. Make sure to keep your floating wires in check (or avoid having them at all).

· Feeding the BeagleBone’s digital pins with more than 3.3V and the Analog-to-Digital-Converters (ADCs) with more than 1.8V: Often, for several applications, you will have 5V and 3.3V wires on your breadboard. You need to pay extra attention in order to never connect any of the 5V wires to the BeagleBone. Also, you have to keep in mind that the ADCs can only stand voltages up to 1.8V, so you have to ensure that the output voltage from the sensors you use don’t surpass this value. Naturally, you have to be careful to not connect any of the 5V or 3.3V wires to any of the ADCs as well.

· Turning power off abruptly: The BeagleBone is a computer. Usually, you don’t turn off a computer by pressing the power button or removing the battery or plug. The reason: The computer may be damaged when it loses power unexpectedly. In the specific case of the BeagleBone, abrupt power loss may corrupt the embedded MultiMediaCard (eMMC) memory, which isn’t fun.

· Powering off while installing or updating software: Never turn off the BeagleBone when it’s installing software or updates. You’ll be left with half-processed operations that may lead to complications.

Miscellaneous

This section covers some useful things you can do on your BeagleBone to have a smoother experience with it.

Expanding the file system on your microSD card

Initially, when you’re booting your operating system from your microSD card, you won’t get all the space that the card provides — probably not even close. The reason is that you’re still using an image of the operating system, so you still have to expand the file system to get all the space your microSD card claims to give you.

To do so, fire up a terminal window, and follow these steps:

1. Log in as the superuser by typing sudo su.

2. Check available volumes with the following command:

ls -l /dev/mmcb*
brw-rw---T 1 root floppy 179, 0 Jan 1 2000 /dev/mmcblk0
brw-rw---T 1 root floppy 179, 1 May 15 02:20 /dev/mmcblk0p1
brw-rw---T 1 root floppy 179, 2 Jan 1 2000 /dev/mmcblk0p2
brw-rw---T 1 root floppy 179, 8 Jan 1 2000 /dev/mmcblk1
brw-rw---T 1 root floppy 179, 16 Jan 1 2000 /dev/mmcblk1boot0
brw-rw---T 1 root floppy 179, 24 Jan 1 2000 /dev/mmcblk1boot1
brw-rw---T 1 root floppy 179, 9 Jan 1 2000 /dev/mmcblk1p1
brw-rw---T 1 root floppy 179, 10 Jan 1 2000 /dev/mmcblk1p2

3. Find your microSD card in the list, and examine its partitioning with the following command:

fdisk /dev/mmcblk0

Most of the time, that number should be 0.

4. Type p.

You see various details about the size partitions on your SD card. For our 16 GB card, for example, we see the following:

Disk /dev/mmcblk0: 16.0 GB, 16013852672 bytes
4 heads, 16 sectors/track, 488704 cylinders, total 31277056 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 2048 198655 98304 e W95 FAT16 (LBA)
/dev/mmcblk0p2 198656 3481599 1641472 83 Linux

5. Delete partition 2 by typing d and then typing 2.

You delete partition 2 to create a new one that enables you to use all the space left in your SD card.

6. Create a new partition by typing n for new, p for primary, and 2 for partition 2.

7. Press Enter or Return two times.

8. Type p again to see the new /dev/mmcblk0p2, with a lot more available space.

9. To commit to the changes you made, type w.

If you’re afraid that you messed up and want to start over, simply press Ctrl+Z.

10. Reboot your BeagleBone with the reboot command.

The partitions are created, but you still need to expand the file system.

11. Log in as the superuser again by typing sudo su and then type df.

The df command shows the available space in your file system:

Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 1582864 1499484 1308 100% /
udev 10240 0 10240 0% /dev
tmpfs 101700 640 101060 1% /run
/dev/mmcblk0p2 1582864 1499484 1308 100% /
(_)

12. Run the following command to expand the file system:

resize2fs /dev/mmcblk0p2

13. Type df again to see the fruits of your labor.

This command shows that you now have much more space available in the file system:

Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 15270256 1501100 13133688 11% /
udev 10240 0 10240 0% /dev
tmpfs 101700 644 101056 1% /run
/dev/mmcblk0p2 15270256 1501100 13133688 11% /
(...)

Accessing external storage devices when using the Linux Shell

Whenever you plug an external storage device, such as a USB key, into your BeagleBone, you can easily access it through the Linux Shell. Well, Access isn’t as easy as it would be in a desktop environment, but it’s no big deal.

Simply change to the /media directory and list it as shown in the following snippet. Remember to be logged in as root.

sudo su
cd /media
ls

Your external storage device should be listed. You can access the device and use it as though it were a regular directory. You’re free to browse its files, copying, opening, and editing them as you like.

You may need to change the permissions by using the chmod command. This command is discussed in Chapter 4