Packages
nerves_system_bbb
0.20.0
2.30.0
2.29.5
2.29.4
2.29.3
2.29.2
2.29.1
2.29.0
2.28.0
2.27.3
2.27.2
2.27.1
2.27.0
2.26.1
2.26.0
2.25.1
2.25.0
2.24.0
2.23.0
2.22.1
2.22.0
2.21.0
2.20.2
2.20.1
2.20.0
2.19.1
2.19.0
2.18.2
2.18.1
2.18.0
2.17.2
2.17.1
2.17.0
2.16.2
2.16.1
2.16.0
2.15.3
2.15.2
2.15.1
2.15.0
retired
2.14.0
2.13.4
2.13.3
2.13.2
2.13.1
2.13.0
2.12.3
2.12.2
2.12.1
2.12.0
2.11.2
2.11.1
2.11.0
2.10.1
2.10.0
2.9.0
2.8.3
2.8.2
2.8.1
2.8.0
2.7.2
2.7.1
2.7.0
2.6.2
2.6.1
2.6.0
2.5.2
2.5.1
2.5.0
2.4.2
2.4.1
2.4.0
2.3.2
2.3.1
2.3.0
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.0
2.0.0-rc.0
1.4.0
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.0
1.0.0-rc.1
1.0.0-rc.0
0.20.0
0.18.0
0.17.1
0.17.0
0.16.1
0.16.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
0.8.0
0.7.1
0.7.0
0.6.2
0.6.1
0.6.0
0.5.0
Nerves System - BeagleBone Black, BeagleBone Green, PocketBeagle and more
Current section
Files
Jump to
Current section
Files
nerves_system_bbb
README.md
README.md
# Generic BeagleBone Support[](https://circleci.com/gh/nerves-project/nerves_system_bbb)[](https://hex.pm/packages/nerves_system_bbb)This is the base Nerves System configuration for the [BeagleBone Black](http://beagleboard.org/black),[BeagleBone Green](http://beagleboard.org/green), [BeagleBone Green Wireless](https://beagleboard.org/green-wireless/),and [PocketBeagle](https://beagleboard.org/pocket).<br><sup>[Image credit](#fritzing)</sup>| Feature | Description || -------------------- | ------------------------------- || CPU | 1 GHz ARM Cortex-A8 || Memory | 512 MB DRAM || Storage | 4 GB eMMC Flash and MicroSD || Linux kernel | 4.4.91 w/ BBB patches || IEx terminal | ttyGS0 via the USB || GPIO, I2C, SPI | Yes - Elixir ALE || ADC | Yes || PWM | Yes, but no Elixir support || UART | ttyS0 + more via device tree overlay || Camera | None || Ethernet | Yes || WiFi | Beaglebone Green Wireless (wl18xx driver). Other requires USB WiFi dongle/driver |## Preparing your BeagleBoneIf your BeagleBone has eMMC (the PocketBeagle doesn't), it will be configured totry the eMMC first when looking for software on boot. If you haven'treprogrammed it, it will boot to Debian even if a MicroSD card is inserted withgood software. To boot from the MicroSD card, hold down the USER button andapply power.When starting with Nerves, you will find that booting from a MicroSD card isconvenient since you can easily recover from broken software images. Holdingdown the USER button will get old. To force the BeagleBone to boot from theMicroSD card, simply corrupt the image on the eMMC memory. Don't worry, theBeagleBone website has instructions for restoring Debian.From Debian:```debian@beaglebone:~$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=100100+0 records in100+0 records out104857600 bytes (105 MB) copied, 5.72098 s, 18.3 MB/sdebian@beaglebone:~$ sudo reboot```When it reboots, it will boot from the MicroSD slot. If a MicroSD card hasn'tbeen inserted or if there are errors reading it, you will see the letter `C`printed repeatedly on the console port.## Console accessThe console is configured to output to `ttyGS0` by default. This is outputthrough a USB cable connected to the BeagleBone's OTG USB port. It will show upon the connected computer as a virtual serial port.It is also possible to configure the IEx prompt through the 6 pin header on theBeagleBone that's labeled J1. A 3.3V FTDI cable is needed to access the output.To use this output, override the default `erlinit.config` and specify that theoutput should go to `ttyS0`.The HDMI output has been disabled via device tree to free up pins on the GPIOheader. If you would like console access via HDMI, you will need to enable HDMIsupport in the Linux kernel, remove the HDMI disable argument in the ubootscript providing kernel arguments, and change `erlinit.conf` to output to`tty1`.## Linux versionsThe BeagleBone Black has many options for Linux that vary by kernel version andpatch set. Nerves tracks those maintained by Robert Nelson athttps://eewiki.net/display/linuxonarm/BeagleBone+Black. His patch sets have`-rt` and `-ti`/`-bone` options. The `-rt` for real-time actually refers to`CONFIG_PREEMPT` and a couple other real-time options being configured in theLinux kernel. Nerves uses those options as well. Nerves follows the `-ti` patchset. See `nerves_system_br/boards/bbb` for the actual patches.Be aware that if you have been using Linux kernel 3.8 on the BeagleBone, thatthere have been device tree overlay and PRU updates. File paths have changed forinserting device tree overlays.## Device tree overlaysMost pins on the BBB's headers are configurable via the device tree.Configuration can be done at runtime via the [UniversalI/O](https://github.com/cdsteinkuehler/beaglebone-universal-io) device treeoverlays. These overlays are included in the kernel configuration for Nerves soyou do not need to compile that project. Additionally, the `config-pin` scriptis available in `/usr/bin` on the target. It has minor modifications to run onNerves.### Universal I/OThe universal I/O overlays can be loaded manually or by using the `config-pin`shell script:```iex(demo@nerves-0099)> :os.cmd('config-pin overlay cape-universaln')'Loading cape-universaln overlay\n'iex(demo@nerves-0099)> :os.cmd('config-pin -i P9_16') |> IO.putsPin name: P9_16Function if no cape loaded: gpioFunction if cape loaded: default gpio gpio_pu gpio_pd pwmFunction information: gpio1_19 default gpio1_19 gpio1_19 gpio1_19 ehrpwm1BCape: cape-universala cape-universal cape-universalnKernel GPIO id: 51PRU GPIO id: 83:okiex(demo@nerves-0099)> :os.cmd('config-pin P9_16 pwm')```### ADCsThe following example shows how to read values from the 7 ADC inputs in Elixir.```iex(demo@nerves-0099)> File.write("/sys/devices/platform/bone_capemgr/slots","BB-ADC"):okiex(demo@nerves-0099)> ls "/sys/bus/iio/devices/iio:device0"buffer dev in_voltage0_raw in_voltage1_rawin_voltage2_raw in_voltage3_raw in_voltage4_raw in_voltage5_rawin_voltage6_raw name of_node powerscan_elements subsystem ueventiex(demo@nerves-0099)> File.read("/sys/bus/iio/devices/iio:device0/in_voltage0_raw"){:ok, "3891\n"}iex(demo@nerves-0099)> File.read("/sys/bus/iio/devices/iio:device0/in_voltage0_raw"){:ok, "3890\n"}iex(demo@nerves-0099)> File.read("/sys/bus/iio/devices/iio:device0/in_voltage0_raw"){:ok, "3891\n"}```### SPIThe following examples shows how to get SPI0 functional in Elixir.Load the overlay, configure the pins, and load the device drivers:> Note: The order of the above stops is important. The overlay must be loaded and the pins configured before writing "BB-SPIDEV0".```consoleiex(demo@nerves-0099)1> :os.cmd('config-pin overlay cape-universaln')'Loading cape-universaln overlay\n'iex(demo@nerves-0099)2> [17,18,21,22] |> Enum.each(&(:os.cmd('config-pin -a P9_#{&1} spi'))):okiex(demo@nerves-0099)3> File.write("/sys/devices/platform/bone_capemgr/slots","BB-SPIDEV0"){:error, :eexist}```Verify that the device drivers are loaded and read spi0 transfers:```consoleiex(demo@nerves-0099)4> ls "/dev" ... spidev1.0 spidev1.1 spidev2.0 spidev2.1 ...iex(demo@nerves-0099)5> File.read "/sys/bus/spi/devices/spi1.0/statistics/transfers"{:ok, "0"}```Verify that the pins are configured:```consoleiex(demo@nerves-0099)6> [17,18,21,22] |> Enum.map(&(:os.cmd('config-pin -q P9_#{&1} spi')))['P9_17 Mode: spi\n', 'P9_18 Mode: spi\n', 'P9_21 Mode: spi\n', 'P9_22 Mode: spi\n']```If you have included [ElixirAle](https://github.com/fhunleth/elixir_ale) as a dependency, you can start it now and test a transfer:> The example below should work without any additional hardware connected to the BBB. If you have SPI hardware connected to the BBB, your returned binary might be different.```consoleiex(demo@nerves-0099)7> Spi.start_link "spidev1.0", [], name: :spi0{:ok, #PID<0.181.0>}iex(demo@nerves-0099)8> Spi.transfer :spi0, <<1,2,3,4>><<255, 255, 255, 255>>```> Note: If you get back all 0's, then you have likely have not configured the overlay pins correctly.## Supported USB WiFi devicesThe base image includes drivers and firmware for the TI WiLink8 (`wl18xx`), Ralink RT53xx(`rt2800usb` driver) and RealTek RTL8712U (`r8712u` driver) devices. All WiFidrivers are compiled as modules. Currently, Nerves doesn't autoload the drivers,so you'll need to load them at the beginning of your application. For example,run `:os.cmd('modprobe wl18xx')` if you're using a BeagleBone Green Wireless.We are still working out which subset of all possible WiFi dongles tosupport in our images. At some point, we may have the option to supportall dongles and selectively install modules at packaging time, but untilthen, these drivers and their associated firmware blobs add significantlyto Nerves release images.If you are unsure what driver your WiFi dongle requires, run Raspbian and configure WiFifor your device. At a shell prompt, run `lsmod` to see which drivers are loaded.Running `dmesg` may also give a clue. When using `dmesg`, reinsert the USBdongle to generate new log messages if you don't see them.## Beaglebone Green WiFiInitial support for the BBGW's onboard wireless module is available. To try it out,run (assuming you have Nerves.InterimWiFi in your image):```:os.cmd('modprobe wl18xx'):os.cmd('modprobe wlcore-sdio')Nerves.InterimWiFi.setup "wlan0", ssid: "xxx", key_mgmt: :"WPA-PSK", psk: "yyy"```Be aware that this Nerves system does not configure the MAC address. The result isthat only one BBGW may exist on the WiFi network at a time.## InstallationIf you're new to Nerves, check out the[nerves_init_gadget](https://github.com/fhunleth/nerves_init_gadget) project forcreating a starter project for the Beaglebone boards. The instructions arebasically the same for the Raspberry Pi Zero or Zero W except you should `exportMIX_TARGET=bbb` so that the appropriate `mix` targets get run. It will get youstarted with the basics like bringing up the virtual Ethernet interface,initializing the application partition, and enabling ssh-based firmware updates.[Image credit](#fritzing): This image is from the [Fritzing](http://fritzing.org/home/) parts library.