Is there a risk in turning off the BBB by just unplugging the usb cable? Is there a recommended way to turn it off?
Turning off the BBB
Unless you are writing to disk, it is very unlikely that unplugging the BBB will cause any troubles. Still, it is not recommended.
There are multiple ways of turning off Bela:
- if you are using the IDE, go to the settings tab and at the bottom you will see the shutdown board button
- if you are using the scripts, a dedicated script is available.
- if you are already ssh'd into the board, just type
$ halt
at the CLI
- the button on the Bela cape should safely turn off the board if you hold press it for a couple of seconds. This is the recommended way when operating the board in stand-alone mode
Nice! Thank you for the swift reply!
One more note for future reference: the button on the cape is tied to P9 pin 27. So if, for example, you wanted to put Bela in a device with an external power-off button, you could connect a pushbutton between P9.27 and ground. Hold it for at least 2 seconds and it will initiate a graceful shutdown of the board.
Careful with your wiring, though, because the neighbouring pins are sensitive digital signals to the audio codec, which might not like being shorted to ground.
- Edited
I put all of this in the wiki.
To get the latest info about this topic, go to https://github.com/BelaPlatform/Bela/wiki/Powering-off-the-board
Is there a way to disable the power off button? I was going crazy because I have an H-bridge that uses pin P9_27 and I couldn't figure out why my BBB was turning off every time I wanted my motors to turn left.
- Edited
Right, this is missing in the docs.
When the button is pressed for a small interval, the currently running program is stopped. This can be disabled by enabling the command line argument --disable-cape-button-monitoring
. You will have to go to your project settings in the IDE, and add --disable-cape-button-monitoring
to the field "User command line arguments".
When the button is pressed for more than 2 seconds, a graceful shutdown is triggered. This can be disabled by removing / renaming / emptying/ commenting out the content of the file /root/Bela_capeButtonHold.sh
. So the quick way is
$ rm /root/Bela_capeButtonHold.sh
But if you plan to do restore the functionality later, you may prefer to comment out with a #
the two lines in the file, instead.
These should do it for now, I will look into putting this into the docs properly.
giuliomoro and I will look into integrating this into the IDE a bit more smoothly...
Awesome. Thanks much!
Hi there, i know this is an old thread... just wanted to know if the button on the bela mini
is also tied to P9.27 - and I don't really get it - is it the pin right next to D5?
Thanks in advance
Alright. Just took a look at the bela mini layout - Am I right assuming that the button
is tied to P2.34 (marked with green/red label "shutdown") ?
row-she if the button on the bela mini
is also tied to P9.27 -
Clearly not, as there is no P9 on Bela mini!
row-she is tied to P2.34 (marked with green/red label "shutdown") ?
Yes, this is the same pin on the chip as P9.27 on the BeagleBone: GPIO 115 (GPIO3[19]).
The pin next to D5 is P2_12, which is the system power button: this would trigger an unconditional shutdown, while the function of The Bela Button can be customized.
- Edited
Wow, thanks for the quick reply! So connecting pin34 (P2.34) on the bela mini via button to ground would
have exactly the same functionality as the on-board button, right? (sorry to ask, just wanted to make shure...)
also sorry... hope I'm not going too off topic here... if I wanted to do the same to the on-board LED (connect an
external LED), would I simply connect the anode(+) to P1.2 and the cathode(-) to P1.4 ?
row-she ! So connecting pin34 (P2.34) on the bela mini via button to ground would
have exactly the same functionality as the on-board button, right?
Here's the schematic: use a 100ohm resistor to connect it to ground
You
row-she .. if I wanted to do the same to the on-board LED (connect an
external LED), would I simply connect the anode(+) to P1.2 and the cathode(-) to P1.4 ?
You would be competing the GPIOs being set as an output, so you may end up putting excessive stress on them. I'd suggest you set them to inputs instead. You would have to change in PRU.cpp
line 322
gpio_set_dir(belaMiniLedBlue, OUTPUT_PIN);
and line 410
underrunLed.open(belaMiniLedRed, OUTPUT);
to use INPUT_PIN
and INPUT
, respectively.
Either way, make sure the voltage you supply at the pin is never above 3.3V.
Last, why do you need to control these LEDs from an external piece of hardware? The are fully programmable via software.
giuliomoro Here's the schematic: use a 100ohm resistor to connect it to ground
great -> thanks!
giuliomoro Last, why do you need to control these LEDs from an external piece of hardware? The are fully programmable via software.
I'm sorry, maybe I should have explained better... I don't want to control the onboard-led from the outside
but outsource ("clone") it TO the outside (the outside of my housing) so I have an indicator whats going on even
when the bela is covered by the housing - so I was wondering if I could connect an external LED to bela that
is doing exactly the same as the onboard one by using the same pins the onboard-LED does...
(use both LEDs in parallel) ?
- Edited
Oh yes then you should be able to connect an extra LED in parallel. Hopefully there will be enough current for both. If there is not, you could always:
a) remove the on-board LED or the resistors going to it (at your own risk!)
b) remap your external LEDs to some other pins (https://github.com/BelaPlatform/Bela/wiki/Using-arbitrary-GPIO-pins)
Ok. cool thanks. Guess I would have to connect the anode of an external LED via resistor (like 560R) to
P1.2 (/P1.4) and the cathode to ground (according to the schematic...). Is there any way to edit the script so that the blue state-LED (that is on P1.2 right?) on the BM won't blink but is just on constantly while a project is running?
- Edited
You will have to disable it adding a custom command line option --disable-led
(see here for how to do it from the IDE, or here if you are using the scripts), and then manage it manually following the instructions here.
Ultimately, as I seem to understand you do not need the on-board LED and you do not want the external LED to preserve its default behaviour, it may be just easier for you to use one of Bela's regular digital outputs instead?
- Edited
thank you for the instructions, giuliomoro
giuliomoro Ultimately, as I seem to understand you do not need the on-board LED and you do not want the external LED to preserve its default behaviour, it may be just easier for you to use one of Bela's regular digital outputs instead?
of course you're right - it's just, I'm trying to save digital IO (or also analog O) where possible, but maybe that
would be the most elegant option - also this way i could create custom behaviour more easily...
we'll see - now I have all the possibilties - thanks
- Edited
Is there a way to switch it off in Pure Data? Maybe invoking the console commands [shell]? Using Pepper makes it not so easy to switch it off. Was thinking of setting it by pressing one of the buttons long enough. What kind of explicit orders are invoked when switching off gracefully?