BeagleBone Black

Contents: [Dobrica Pavlinušić's random unstructured stuff]
• Dobrica Pavlinušić's random unstructured stuff (info) 
• Dobrica Pavlinušić's random unstructured stuff (serial) 
• Dobrica Pavlinušić's random unstructured stuff (update board) 
• Dobrica Pavlinušić's random unstructured stuff (flash update to emmc) 
• Dobrica Pavlinušić's random unstructured stuff (usb network) 
• Dobrica Pavlinušić's random unstructured stuff (PRU) 

https://elinux.org/Beagleboard:BeagleBoneBlack 
info
root@beaglebone:~# uname -a
Linux beaglebone 3.8.13 #1 SMP Wed Sep 4 09:09:32 CEST 2013 armv7l GNU/Linux
root@beaglebone:~# cat /proc/cpuinfo 
processor       : 0
model name      : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 297.40
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc08
CPU revision    : 2

Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000
root@beaglebone:~# cat /etc/issue
Angstrom v2012.12 - Kernel \r

serial
Board Cable
 Pin 1 (GND) Black (GND)
 Pin 4 (RX) Green (TX)
 Pin 5 (TX) White (RX)
update board
dpavlin@nuc:/tmp$ xzcat bone-debian-9.3-iot-armhf-2018-01-28-4gb.img.xz | sudo dd of=/dev/sdc bs=1M

Insert SD card, press S2 USER/BOOT button to boot from SD card
https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC 
root@beaglebone:~# uname -a
Linux beaglebone 4.9.78-ti-r94 #1 SMP PREEMPT Fri Jan 26 21:26:24 UTC 2018 armv7l GNU/Linux
root@beaglebone:~# cat /etc/issue
Debian GNU/Linux 9 \n \l

BeagleBoard.org Debian Image 2018-01-28

flash update to emmc
https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC 
usb network
root@nuc:/home/dpavlin# ip link

8: enxd05fb8d1023b: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether d0:5f:b8:d1:02:3b brd ff:ff:ff:ff:ff:ff
9: enxd05fb8d1023e: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether d0:5f:b8:d1:02:3e brd ff:ff:ff:ff:ff:ff

root@beaglebone:~# ip addr
5: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d0:5f:b8:d1:02:3c brd ff:ff:ff:ff:ff:ff
    inet 192.168.7.2/30 brd 192.168.7.3 scope global usb0
       valid_lft forever preferred_lft forever
    inet6 fe80::d25f:b8ff:fed1:23c/64 scope link 
       valid_lft forever preferred_lft forever
6: usb1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d0:5f:b8:d1:02:3f brd ff:ff:ff:ff:ff:ff
    inet 192.168.6.2/30 brd 192.168.6.3 scope global usb1
       valid_lft forever preferred_lft forever
    inet6 fe80::d25f:b8ff:fed1:23f/64 scope link 
       valid_lft forever preferred_lft forever

# matchs IP addresses to find out which interface on bbb is which on nuc (mac on nuc is one less than bbb), so

root@nuc:/home/dpavlin# ifconfig enxd05fb8d1023b 192.168.7.1
root@nuc:/home/dpavlin# ping -c 1 192.168.7.2
PING 192.168.7.2 (192.168.7.2) 56(84) bytes of data.
64 bytes from 192.168.7.2: icmp_seq=1 ttl=64 time=0.817 ms

--- 192.168.7.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.817/0.817/0.817/0.000 ms

# nat bbb

root@nuc:/home/dpavlin# iptables -t nat -A POSTROUTING -s 192.168.7.0/30 -o eth0 -j MASQUERADE

dpavlin@nuc:~$ ssh debian@192.168.7.2
debian@192.168.7.2's password: 
Linux beaglebone 4.9.78-ti-r94 #1 SMP PREEMPT Fri Jan 26 21:26:24 UTC 2018 armv7l

root@beaglebone:/home/debian# ip route add default via 192.168.7.1
root@beaglebone:/home/debian# ip route add default via 192.168.7.1
root@beaglebone:/home/debian# cat /etc/resolv.conf 
nameserver 8.8.8.8
root@beaglebone:/home/debian# ping -c 1 www.google.com
PING www.google.com (172.217.21.100) 56(84) bytes of data.
64 bytes from fra07s32-in-f100.1e100.net (172.217.21.100): icmp_seq=1 ttl=51 time=30.4 ms

--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 30.460/30.460/30.460/0.000 ms

PRU
http://ianrrees.github.io/2016/11/20/getting‑started‑with‑beaglebone‑pru‑programming‑the‑new‑way.html