18 Jan 2023

Coordinated Holiday Lights - box 4

The forth box features the BeagleBone Black (bbb), the IoT Relay (I might as well use them since I already have them), and also has hard-wired ethernet. The bbb features TI's AM335x Sitara SoC which is based on a single-core, 32-bit, ARM, Cortex-A8. This device will control the lights on the eastern driveway gate.

Parts:

Unlike the RPi (or other RPi-like boards), the bbb is quite clear in its documentation that it can not be powered via its expansion pins. Therefore this build uses the 5V transformer that came with the board and plugs into the bbb's mini-B USB connector.

The bbb has both a soldered-on eMMC flash, and takes an SDcard. By default, if the firmware detects a valid image on the eMMC, its preference is to boot from that device over the SDcard. I want to always have my system boot from SDcard. Therefore on first boot I hold down the BOOT button in order to get it to boot from the SDcard and not the eMMC. Once running I then erased the eMMC flash. Without a valid image in eMMC the bbb's firmware will elect instead to boot from the SDcard.

On the one hand it's nice that so many SBCs have standardized around a common header. On the other hand it would have been nicer if the industry had standardized around a header that provided access to more of the buses and pins that projects could use. Of course in my case I only need access to 1 GPIO pin, therefore the standard "RPi 40-pin header" is more than adequate. However some projects can find the 40 pins of the RPi header limiting. If you find yourself in that sort of situation, you'll appreciate the bbb's staggering 92 pins:


Similar to the RPi, the bbb's kernel is well-loved, therefore the kernel knows a lot about its GPIOs:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
root@beaglebone:~# gpioinfo 
gpiochip0 - 32 lines:
        line   0: "[ethernet]"       unused   input  active-high 
        line   1: "[ethernet]"       unused   input  active-high 
        line   2: "P9_22 [spi0_sclk]" unused input active-high 
        line   3: "P9_21 [spi0_d0]" unused input active-high 
        line   4: "P9_18 [spi0_d1]" unused input active-high 
        line   5: "P9_17 [spi0_cs0]" unused input active-high 
        line   6:  "[sd card]"         "cd"   input   active-low [used]
        line   7: "P9_42A [ecappwm0]" unused input active-high 
        line   8: "P8_35 [hdmi]" unused input active-high 
        line   9: "P8_33 [hdmi]" unused input active-high 
        line  10: "P8_31 [hdmi]" unused input active-high 
        line  11: "P8_32 [hdmi]" unused input active-high 
        line  12: "P9_20 [i2c2_sda]" unused input active-high 
        line  13: "P9_19 [i2c2_scl]" unused input active-high 
        line  14: "P9_26 [uart1_rxd]" unused input active-high 
        line  15: "P9_24 [uart1_txd]" unused input active-high 
        line  16: "[ethernet]"       unused   input  active-high 
        line  17: "[ethernet]"       unused   input  active-high 
        line  18:      "[usb]"       unused   input  active-high 
        line  19:     "[hdmi]"       unused   input  active-high 
        line  20:     "P9_41B"       unused   input  active-high 
        line  21: "[ethernet]"       unused   input  active-high 
        line  22: "P8_19 [ehrpwm2a]" unused input active-high 
        line  23: "P8_13 [ehrpwm2b]" unused input active-high 
        line  24:       "[NC]"       unused   input  active-high 
        line  25:       "[NC]"       unused   input  active-high 
        line  26:      "P8_14"       unused   input  active-high 
        line  27:      "P8_17"       unused   input  active-high 
        line  28: "[ethernet]"       unused   input  active-high 
        line  29: "[ethernet]"       unused   input  active-high 
        line  30: "P9_11 [uart4_rxd]" unused input active-high 
        line  31: "P9_13 [uart4_txd]" unused input active-high
gpiochip1 - 32 lines:
        line   0: "P8_25 [emmc]" unused input active-high 
        line   1:     "[emmc]"       unused   input  active-high 
        line   2: "P8_5 [emmc]" unused input active-high 
        line   3: "P8_6 [emmc]" unused input active-high 
        line   4: "P8_23 [emmc]" unused input active-high 
        line   5: "P8_22 [emmc]" unused input active-high 
        line   6: "P8_3 [emmc]" unused input active-high 
        line   7: "P8_4 [emmc]" unused input active-high 
        line   8:       "[NC]"       unused   input  active-high 
        line   9:       "[NC]"       unused   input  active-high 
        line  10:       "[NC]"       unused   input  active-high 
        line  11:       "[NC]"       unused   input  active-high 
        line  12:      "P8_12"       unused   input  active-high 
        line  13:      "P8_11"       unused   input  active-high 
        line  14:      "P8_16"       unused   input  active-high 
        line  15:      "P8_15"       unused   input  active-high 
        line  16:     "P9_15A"       unused   input  active-high 
        line  17:      "P9_23"       unused   input  active-high 
        line  18: "P9_14 [ehrpwm1a]" unused input active-high 
        line  19: "P9_16 [ehrpwm1b]" unused input active-high 
        line  20:     "[emmc]"       unused   input  active-high 
        line  21: "[usr0 led]" "beaglebone:green:heartbeat" output active-high [used]
        line  22: "[usr1 led]" "beaglebone:green:mmc0" output active-high [used]
        line  23: "[usr2 led]" "beaglebone:green:usr2" output active-high [used]
        line  24: "[usr3 led]" "beaglebone:green:usr3" output active-high [used]
        line  25:     "[hdmi]"  "interrupt"   input  active-high [used]
        line  26:      "[usb]"       unused   input  active-high 
        line  27: "[hdmi audio]" "enable" output active-high [used]
        line  28:      "P9_12"       unused   input  active-high 
        line  29:      "P8_26"       unused   input  active-high 
        line  30: "P8_21 [emmc]" unused input active-high 
        line  31: "P8_20 [emmc]" unused input active-high 
gpiochip2 - 32 lines:
        line   0:     "P9_15B"       unused   input  active-high 
        line   1:      "P8_18"       unused   input  active-high 
        line   2:       "P8_7"       unused   input  active-high 
        line   3:       "P8_8"       unused   input  active-high 
        line   4:      "P8_10"       unused   input  active-high 
        line   5:       "P8_9"       unused   input  active-high 
        line   6: "P8_45 [hdmi]" unused input active-high 
        line   7: "P8_46 [hdmi]" unused input active-high 
        line   8: "P8_43 [hdmi]" unused input active-high 
        line   9: "P8_44 [hdmi]" unused input active-high 
        line  10: "P8_41 [hdmi]" unused input active-high 
        line  11: "P8_42 [hdmi]" unused input active-high 
        line  12: "P8_39 [hdmi]" unused input active-high 
        line  13: "P8_40 [hdmi]" unused input active-high 
        line  14: "P8_37 [hdmi]" unused input active-high 
        line  15: "P8_38 [hdmi]" unused input active-high 
        line  16: "P8_36 [hdmi]" unused input active-high 
        line  17: "P8_34 [hdmi]" unused input active-high 
        line  18: "[ethernet]"       unused   input  active-high 
        line  19: "[ethernet]"       unused   input  active-high 
        line  20: "[ethernet]"       unused   input  active-high 
        line  21: "[ethernet]"       unused   input  active-high 
        line  22: "P8_27 [hdmi]" unused input active-high 
        line  23: "P8_29 [hdmi]" unused input active-high 
        line  24: "P8_28 [hdmi]" unused input active-high 
        line  25: "P8_30 [hdmi]" unused input active-high 
        line  26:     "[emmc]"       unused   input  active-high 
        line  27:     "[emmc]"       unused   input  active-high 
        line  28:     "[emmc]"       unused   input  active-high 
        line  29:     "[emmc]"       unused   input  active-high 
        line  30:     "[emmc]"       unused   input  active-high 
        line  31:     "[emmc]"       unused   input  active-high
gpiochip3 - 32 lines:
        line   0: "[ethernet]"       unused   input  active-high 
        line   1: "[ethernet]"       unused   input  active-high 
        line   2: "[ethernet]"       unused   input  active-high 
        line   3: "[ethernet]"       unused   input  active-high 
        line   4: "[ethernet]"       unused   input  active-high 
        line   5:     "[i2c0]"       unused   input  active-high 
        line   6:     "[i2c0]"       unused   input  active-high 
        line   7:      "[emu]"       unused   input  active-high 
        line   8:      "[emu]"       unused   input  active-high 
        line   9: "[ethernet]"       unused   input  active-high 
        line  10: "[ethernet]"       unused   input  active-high 
        line  11:       "[NC]"       unused   input  active-high 
        line  12:       "[NC]"       unused   input  active-high 
        line  13:      "[usb]"       unused   input  active-high 
        line  14: "P9_31 [spi1_sclk]" unused input active-high 
        line  15: "P9_29 [spi1_d0]" unused input active-high 
        line  16: "P9_30 [spi1_d1]" unused input active-high 
        line  17: "P9_28 [spi1_cs0]" unused input active-high 
        line  18: "P9_42B [ecappwm0]" unused input active-high 
        line  19:      "P9_27"       unused   input  active-high 
        line  20:     "P9_41A"       unused   input  active-high 
        line  21:      "P9_25"       unused   input  active-high 
        line  22:       "[NC]"       unused   input  active-high 
        line  23:       "[NC]"       unused   input  active-high 
        line  24:       "[NC]"       unused   input  active-high 
        line  25:       "[NC]"       unused   input  active-high 
        line  26:       "[NC]"       unused   input  active-high 
        line  27:       "[NC]"       unused   input  active-high 
        line  28:       "[NC]"       unused   input  active-high 
        line  29:       "[NC]"       unused   input  active-high 
        line  30:       "[NC]"       unused   input  active-high 
        line  31:       "[NC]"       unused   input  active-high

Arbitrarily, I've decided that I'm going to use GPIO_45. GPIO_45 is located on connector P8, pin 11. Looking through the information provided above we see that P8_11 is found at gpiochip1, line 13. No datasheets, schematics, or reference manuals required! Wiring up a prototype, we can perform the following quick test:

1
root@raspberrypi3-64:~# gpioset gpiochip1 13=1

Wait a minute! The load didn't turn on, why aren't the lights on after running the above command?

At first I assumed I had done something wrong: bad wiring or maybe bad GPIO? I checked all the wiring; looks okay. Then I tried a different GPIO; same result. Maybe try a GPIO on the P9 connnector; still doesn't work. One of the times I ran the gpioset program I did hear the relay click, although the lights didn't turn on, which led me to believe I had found the correct GPIO/pin association. After a bit of searching around I came across the --mode=wait option of gpioset.

As long as the gpioset program is running, it will control the GPIO line, but when it terminates, it releases the line. Coincidentally, on all the other SBCs I've used so far, after gpioset terminates, the line stays where it had been set. As a result the lights are turned on and stay on. On the bbb, however, after the gpioset program terminates the GPIO line doesn't continue on in the state in which it was set, rather it returns to its previous "OFF" state. Since code is fast and relays are slow, most times the relay doesn't even click over (never mind the lights coming on) before the relay is de-activated. Therefore when testing gpio lines with gpioset, it would be best to test with the following and then terminate the program with Ctrl-C:

1
root@raspberrypi3-64:~# gpioset --mode=wait gpiochip1 13=1


fritzing:



finished box:



before install:



after install:




No comments:

Post a Comment