diff --git a/examples/beaglebone_button.go b/examples/beaglebone_button.go index 910874e2..1553a233 100644 --- a/examples/beaglebone_button.go +++ b/examples/beaglebone_button.go @@ -14,7 +14,7 @@ import ( func main() { beagleboneAdaptor := beaglebone.NewAdaptor() - button := gpio.NewButtonDriver(beagleboneAdaptor, "P8_9") + button := gpio.NewButtonDriver(beagleboneAdaptor, "P8_09") work := func() { button.On(gpio.ButtonPush, func(data interface{}) { diff --git a/examples/beaglebone_direct_pin.go b/examples/beaglebone_direct_pin.go index 4352615f..12deaaf8 100644 --- a/examples/beaglebone_direct_pin.go +++ b/examples/beaglebone_direct_pin.go @@ -15,7 +15,7 @@ import ( func main() { beagleboneAdaptor := beaglebone.NewAdaptor() led := gpio.NewDirectPinDriver(beagleboneAdaptor, "P8_10") - button := gpio.NewDirectPinDriver(beagleboneAdaptor, "P8_9") + button := gpio.NewDirectPinDriver(beagleboneAdaptor, "P8_09") work := func() { gobot.Every(500*time.Millisecond, func() { diff --git a/examples/beaglebone_makey_button.go b/examples/beaglebone_makey_button.go index fe018f60..6c86d207 100644 --- a/examples/beaglebone_makey_button.go +++ b/examples/beaglebone_makey_button.go @@ -14,7 +14,7 @@ import ( func main() { beagleboneAdaptor := beaglebone.NewAdaptor() - button := gpio.NewMakeyButtonDriver(beagleboneAdaptor, "P8_9") + button := gpio.NewMakeyButtonDriver(beagleboneAdaptor, "P8_09") work := func() { button.On(gpio.ButtonPush, func(data interface{}) { diff --git a/platforms/beaglebone/README.md b/platforms/beaglebone/README.md index 78f5a432..d5aa4c38 100644 --- a/platforms/beaglebone/README.md +++ b/platforms/beaglebone/README.md @@ -73,7 +73,7 @@ import ( func main() { beagleboneAdaptor := beaglebone.NewPocketBeagleAdaptor() - led := gpio.NewLedDriver(beagleboneAdaptor, "P1_2") + led := gpio.NewLedDriver(beagleboneAdaptor, "P1_02") work := func() { gobot.Every(1*time.Second, func() { @@ -114,7 +114,7 @@ You must also configure hardware settings as described below. ### Updating your board to the latest OS -We recommend updating your BeagleBone to the latest Debian OS. It is very easy to do this using the Etcher (https://etcher.io/) utility program. +We recommend using your BeagleBone with the latest Debian OS. It is very easy to do this using the Etcher (https://etcher.io/) utility program. First, download the latest BeagleBone OS from http://beagleboard.org/latest-images @@ -134,29 +134,16 @@ http://beagleboard.org/getting-started ### Configure hardware settings -In order to enable the various hardware devices on your BeagleBone or PocketBeagle, you need to configure a special file named `/boot/uEnv.txt`. +Thanks to the BeagleBone team, the new "U-Boot Overlays" system for enabling hardware and the "cape-universal", the latest Debian OS should "just work" with any GPIO, PWM, I2C, or SPI pins. -This file controls all of the different hardware options used at startup time, so you can enable or disable features based on your specific needs. You only need to do this once, and then the settings will apply each time you start up your BeagleBone. +If you want to dig in and learn more about this check out: -First connect to the BeagleBone using ssh: +https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays -``` -ssh debian@192.168.7.2 -``` +### Upgrading from an older version -Once you are connected to the BeagleBone, edit the /boot/uEnv.txt file like this: +Please note that if you are upgrading a board that has already run from an older version of Debian OS, you might need to clear out your older eMMC bootloader, otherwise the new U-Boot Overlays in the newer U-Boot may not get enabled. If so, login using SSH and run the following command on your BeagleBone board: -``` -sudo nano /boot/uEnv.txt -``` + sudo dd if=/dev/zero of=/dev/mmcblk1 count=1 seek=1 bs=128k -To enable GPIO, PWM, I2C, and SPI, modify the `##Example v4.1.x` section to add a line to enable the cape manager: - -``` -##Example v4.1.x -cape_enable=bone_capemgr.enable_partno=cape-universaln,BB-ADC -``` - -Save the file, then reboot your BeagleBone. - -You will now be able to run your Gobot programs to control the various hardware. +Thanks to [@RobertCNelson](https://github.com/RobertCNelson) for the tip on the above. diff --git a/platforms/beaglebone/beaglebone_adaptor_test.go b/platforms/beaglebone/beaglebone_adaptor_test.go index 71707203..848a2428 100644 --- a/platforms/beaglebone/beaglebone_adaptor_test.go +++ b/platforms/beaglebone/beaglebone_adaptor_test.go @@ -52,7 +52,7 @@ func TestBeagleboneAdaptor(t *testing.T) { fs := sysfs.NewMockFilesystem([]string{ "/dev/i2c-2", "/sys/devices/platform/bone_capemgr", - "/sys/devices/platform/ocp/ocp:P8_7_pinmux/state", + "/sys/devices/platform/ocp/ocp:P8_07_pinmux/state", "/sys/devices/platform/ocp/ocp:P9_11_pinmux/state", "/sys/devices/platform/ocp/ocp:P9_12_pinmux/state", "/sys/devices/platform/ocp/ocp:P9_22_pinmux/state", @@ -154,12 +154,12 @@ func TestBeagleboneAdaptor(t *testing.T) { gobottest.Assert(t, err, errors.New("Not a valid pin")) fs.Files["/sys/class/gpio/gpio66/value"].Contents = "1" - i, err = a.DigitalRead("P8_7") + i, err = a.DigitalRead("P8_07") gobottest.Assert(t, i, 1) gobottest.Assert(t, err, nil) fs.WithReadError = true - _, err = a.DigitalRead("P8_7") + _, err = a.DigitalRead("P8_07") gobottest.Assert(t, err, errors.New("read error")) fs.WithReadError = false @@ -214,7 +214,6 @@ func TestBeagleboneAnalogReadFileError(t *testing.T) { func TestBeagleboneDigitalPinDirectionFileError(t *testing.T) { fs := sysfs.NewMockFilesystem([]string{ - "/sys/devices/platform/bone_capemgr/slots", "/sys/class/gpio/export", "/sys/class/gpio/gpio60/value", "/sys/devices/platform/ocp/ocp:P9_12_pinmux/state", @@ -232,7 +231,6 @@ func TestBeagleboneDigitalPinDirectionFileError(t *testing.T) { func TestBeagleboneDigitalPinFinalizeFileError(t *testing.T) { fs := sysfs.NewMockFilesystem([]string{ - "/sys/devices/platform/bone_capemgr/slots", "/sys/class/gpio/export", "/sys/class/gpio/gpio60/value", "/sys/class/gpio/gpio60/direction", diff --git a/platforms/beaglebone/black_pins.go b/platforms/beaglebone/black_pins.go index 8c9c4a8c..948d4908 100644 --- a/platforms/beaglebone/black_pins.go +++ b/platforms/beaglebone/black_pins.go @@ -1,11 +1,11 @@ package beaglebone var bbbPinMap = map[string]int{ - // P8_1 - P8_2 GND - // P8_3 - P8_6 EMCC - "P8_7": 66, - "P8_8": 67, - "P8_9": 69, + // P8_01 - P8_2 GND + // P8_03 - P8_6 EMCC + "P8_07": 66, + "P8_08": 67, + "P8_09": 69, "P8_10": 68, "P8_11": 45, "P8_12": 44, diff --git a/platforms/beaglebone/pocketbeagle_pins.go b/platforms/beaglebone/pocketbeagle_pins.go index 6a96d719..5bd0e19b 100644 --- a/platforms/beaglebone/pocketbeagle_pins.go +++ b/platforms/beaglebone/pocketbeagle_pins.go @@ -1,15 +1,15 @@ package beaglebone var pocketBeaglePinMap = map[string]int{ - // P1_1 - VIN - "P1_2": 87, - // P1_3 - USB1-V_EN - "P1_4": 89, - // P1_5 - USB1-VBUS - "P1_6": 5, - // P1_7 - USB1-VIN - "P1_8": 2, - // P1_9 - USB1-DN + // P1_01 - VIN + "P1_02": 87, + // P1_03 - USB1-V_EN + "P1_04": 89, + // P1_05 - USB1-VBUS + "P1_06": 5, + // P1_07 - USB1-VIN + "P1_08": 2, + // P1_09 - USB1-DN "P1_10": 3, // P1_11 - USB1-DP "P1_12": 4, @@ -38,15 +38,15 @@ var pocketBeaglePinMap = map[string]int{ "P1_35": 88, "P1_36": 110, - "P2_1": 50, - "P2_2": 59, - "P2_3": 23, - "P2_4": 58, - "P2_5": 30, - "P2_6": 57, - "P2_7": 31, - "P2_8": 60, - "P2_9": 15, + "P2_01": 50, + "P2_02": 59, + "P2_03": 23, + "P2_04": 58, + "P2_05": 30, + "P2_06": 57, + "P2_07": 31, + "P2_08": 60, + "P2_09": 15, "P2_10": 52, "P2_11": 14, // P2_12 - PWR-BTN