Beaglebone

From Steak Wiki
Jump to navigationJump to search

The beaglebone is similar to the RPI, but more powerful for microcontroller applications. There are more accessible GPIO and peripherals.


PocketBeagle

Connected via usb. Opens up cloud9 IDE, and gives you a web server connected arduino like interface to program the AM355x CPU.

Connecting to Beagle from host via usb

ip link 
ip link set en2923492024 up (whatever the interface was renamed to - see dmesg)
dhclient en2923492024  OR  ifconfig en2923492024 192.168.6.1 netmask 255.255.255.0
ssh debian@192.168.6.2 (or 7.2)

See troubleshooting note about ipv4 not working below.

Here's a script I use on my beaglebone to connect to a beagleboard (similar when connected via usb)(this contains some of the steps mentioned below regarding internet sharing)

Contents of /root/usb19216871.sh

#!/bin/bash ip link set usb0 up ifconfig usb0 192.168.7.1 netmask 255.255.255.0 # less /opt/scripts/networking/doc-debian-setup.md iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --append FORWARD --in-interface usb0 -j ACCEPT sysctl net.ipv4.ip_forward=1

GNU\Linux Sharing internet with Pocketbeagle over USB

Had some trouble with this today. This guide: https://elementztechblog.wordpress.com/2014/12/22/sharing-internet-using-network-over-usb-in-beaglebone-black/ does NOT work. These guides are also no good: https://unix.stackexchange.com/questions/520528/sharing-internet-using-network-over-usb-in-raspberry-zero-based-on-beaglebone These steps are partially covered in the official beagle directory here: /opt/scripts/network/doc-debian-setup.md


You don't need to setup a bridge. It might work that way, but its not required. What works is the following:

  • (pocketbeagle) Add route w/host ip
  • (host) enable packet forwarding
  • (host) NAT forwarding
  • (pocketbeagle) DNS - resolv.conf

On beagle

Have Pocketbeagle Route to Host

# route add default gw 192.168.6.1

Or 192.168.7.1, see # route

On Host

Enable packet forwarding on Host

Check the current packet forwarding settings:

# sysctl -a | grep forward

You will note that options exist for controlling forwarding per default, per interface, as well as separate options for IPv4/IPv6 per interface.

Enter this command to temporarily enable packet forwarding at runtime:

# sysctl net.ipv4.ip_forward=1

Edit /etc/sysctl.d/30-ipforward.conf to make the previous change persistent after a reboot for all interfaces:

/etc/sysctl.d/30-ipforward.conf

net.ipv4.ip_forward=1

Afterwards it is advisable to double-check forwarding is enabled as required after a reboot. Enable NAT on Host With iptables

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT

Iface names can vary depending on distro. What's important is that you are trying to with iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT, is forward input from the pocketbeagle NIC (in this case usb0, but it can be eth1 or en289929442 or something), to the main iface on the host. Here eth0. To recap:

eth0: whatever host main iface

usb0: whatever beagle usb gadget iface

ref: https://wiki.archlinux.org/index.php/Internet_Sharing

route on host: usually not required, but in case it is:

ip route add 192.168.7.0/24 dev eth0

todo: example with normal route cmd

Fix DNS on beagle

At this point, you will have ip routing (i.e. ping to lan from beagle by ip will work), but DNS isn't setup yet. To get DNS working put your preferred name server in /etc/resolv.conf

nameserver 192.168.1.1

Note: If you are testing an existing ping, when you change the iptables settings, you must stop / start a new ping to see the changes take effect. Note: It's nameserver ###.###.###.###, not just the #.

Question: Why isn't /etc/resolv.conf called /etc/nameserver ? How about a symbolic link? Is that too obvious?

IPv4 usb Interface Not Working

Had ipv4 not working for pocketbeagle today. Same image, same computer... Throw it out the window.

dhclient of usb interface on host gave only ipv6 address. ssh was able to connect via beagle's ipv6 address (ipv6%interface, e.g. ssh debian@fe80%usb1)

the two virtual usb ethernet interfaces that show up in host are always 192.168.7 or 192.168.6 range. Try one, if you can't ping the beagle at 192.168.6.2 (it's always 2) then try the 7 range. (on host)

ifconfig en238240224 192.168.6.1
ping 192.168.6.2

Sysvinit on pocketbeagle

(Via Devuan): Breaks ssh usb access. Only use if you have a wifi/ethernet adapter connected and ip info set in /etc/network/interfaces, or UART connected.

May have to edit inittab to add (correct) serial. See beagleboard section.

Alpine on pocketbeagle

This script doesn't compile on Debian (Devuan) Stretch (kernel phase. uboot compiles). GCC appears to be the wrong version. GCC 5 has been removed from Debian stretch repos. https://github.com/BrianSidebotham/alpine-on-bbb

Change Partition Size on SD

https://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD

Gamepup

First, see the official cape instructions (they are short): https://github.com/beagleboard/pocketbeagle/wiki/GamePup-cape

TTY | login screen on LCD

I migrated to devuan and added a tty to the inittab. The console can be rotated.

/sys/class/graphics/fbcon# echo 1 > rotate

See also: How_to_do_things_with_the_beaglebone

Buttons

Work out of the box by default.

Beaglebone Black

Monitoring temperature w/a beagle and LMT84 / LM35

Always Boot from SD Card

"...move R68 to R93 if you want to make the board boot from SD by default."

ref: https://stackoverflow.com/questions/33030802/fix-the-boot-order-emmc-on-a-beagle-bone-black

A latching switch would be nice. Onboard flash is built in obsolescence.

Instructions

Put some leaded solder on both sides of R68 (bottom of board, the silkscreen is misplaced, but just count down the line). Use hot air to remove R68, being careful not to use too much air flow which will knock the resistor off your bench, onto the floor. The resistor is a 100K, in case you lose it.

After removing the resistor, use an iron to put small dobs of leaded solder on pad R93 (top side of board). Use hot air to heat the board until the solder is fluid, then place the 100K R onto R93, heating as necessary while being careful not to blow the resistor away.

Beagleboard

RS232 connected to docking station Serial In. Beagleboard works best with a dedicated 5V supply. When connecting via RS232, keep the grounds close.

The beagleboard is the original. It has more connectors / peripherals, however lacks ethernet.

Resources for beagleboard:

RS232 Serial is garbled and unreadable

Yes, I said RS232. This is not TTL levels. You need -12 and +12V, so use a RS232 port.

I resolved an issue of garbled serial by using an external 5V 3A PSU, and also by locating the laptop PSU adjacent to the BB PSU on mains via a power strip. Laptop USB did not work, nor did a 1A 0-12V adjustable PSU, as they were not close enough on the mains (different outlets)

I also had a poorly made thinkpad dock that required a 'hard' shutdown in order for rs232 to restart, after gnu screen was closed/reopened.

OS for original Beagleboard

Angstrom loads on the old uboot without problem. Debian Buster Console (link: https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Buster_Console_Snapshot_for_BeagleBoard-xM tested: bbxm-debian-10.4-console-xm-armhf-2020-05-18-1gb.img.xz) also loads, though requires holding user button upon boot (forces boot from mmc) due to uboot being ancient on the nand.

  • Other OS: openwrt

Angstrom: Tweaks to make

It boots up in systemd X11 session, which is using 60MB of RAM. First thing to do is disable X11. This uses an older systemd syntax, so it is something like

systemctl -h systemctl list-unit-files systemctl disable graphical.target systemctl enable multi-user.target

This will lower it to 30MB of RAM.

Debian Buster Console

Don't mess with Angstrom, use this instead. Link is buried and hard to find, but see: https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Buster_Console_Snapshot_for_BeagleBoard-xM

Upgrading old UBoot for new Debian Images

WIP

Migrate to Devuan / Sysvinit

Requires modprobe g_ether (usb gagdet for ethernet) to /etc/modules Requires adding serial to /etc/inittab Make it easier by using usb to ethernet adapter (or wifi). e.g. Beagleboard_inittab_and_modules See Beaglebone#Note_on_connman

always boot usb0

When migrating to devuan you need modprobe g_ether in /etc/modules or modprobe.conf (forget which).

in /etc/rc.local add

ip link set usb0 up

in /etc/network/interfaces add

auto usb0
iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.0
    gateway 192.168.7.1

note that the official bbb images have a netmask of 255.255.255.252 for these usb interfaces, but I will ignore that. They also use scripts e.g. /opt/scripts/boot/autoconfigure_usb0.sh which are messier than above.

S-video output

The SVideo output is Luminance/Sync (Y) and Chroma(C). You can turn this into composite, and then output to a CRT.

Adjust the font size of the local svideo tty with dpkg-reconfigure console-font. Review the different fonts as they have different max sizes. Some are easier to read than others.

Note on connman

During a sysvinit/devuan install, I uninstalled connman on my pocketbeagle in an effort to diagnose routing issues (because I had an usb to ethernet adapter, my routes were not working for usb rndis gadget to host). I thought I was locked out and would have to install from .deb but in fact connman is not required for the interfaces to be brought up. I disconnected the usb-ethernet adapter, added a route on the host to the usb subnet, and was able to login via the usb gadget.

See also

External Links