Enable BT by default?

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
FezVrasta
Posts: 2
Joined: Thu Aug 22, 2019 6:35 pm

Enable BT by default?

Post by FezVrasta » Thu Aug 22, 2019 6:39 pm

Hi, I was wondering how can I enable the bluetooth by default editing some setting in dietpi.txt or config.txt maybe?

Also, I'd like to have a way to automatically get DietPi configured with ttyS0 and ttyAMA0 console [Off] but the ttyAMA0 (full UART) device [On]. Do you know what's the right setting for this?

I'm asking because I'd like to backup the config files so that when I need to reinstall DietPi I don't need to mess with the manual commands again.

I'm referring to a RaspBerry Pi 4 installation, if it matters.

Thanks!

User avatar
MichaIng
Legend
Posts: 1638
Joined: Sat Nov 18, 2017 5:21 pm

Re: Enable BT by default?

Post by MichaIng » Thu Aug 22, 2019 10:09 pm

Currently you can't enable Bluetooth on first boot automatically. It requires some packages to be installed, probably something we can add with v6.27, so that this will be done on first run dietpi-software installs (which can be automated).

Bluetooth by default uses/blocks the full UART (ttyAMA0), so only mini UART (ttyS0) is available for serial console, which is enabled by default.
But there is a setting to switch that, so that Bluetooth uses mini UART and ttyAMA0 is available for console, although there are not much reasons to weaken Bluetooth and mini UART is enough for a console?
However if you want to do so:
dtoverlay miniuart-bt
And to make it boot persistent:
G_CONFIG_INJECT 'dtoverlay=miniuart-bt' 'dtoverlay=miniuart-bt' /DietPi/config.txt
If you are not on latest firmware version (kernel 4.19.66), then it is rpi3-miniuart-bt instead. It has been renamed with last firmware update since RPi4 of course supports it as well ;).

Note that currently dietpi-config expects Bluetooth to use ttyAMA0, thus denies to enable a serial console on that device, if Bluetooth is enabled and the other way round. So you need to change this manually: systemctl enable --now [email protected] and if required adjust cmdline.txt to send boot messages to that console: console=/dev/ttyAMA0,115200
Also hciuart.service (for Bluetooth) needs to be changed to use ttyS0, if I am not mistaken. /dev/serial0 can be used as well which is always the "primary" serial device, so the one available for console, depending on miniuart-bt being set or not.

FezVrasta
Posts: 2
Joined: Thu Aug 22, 2019 6:35 pm

Re: Enable BT by default?

Post by FezVrasta » Fri Aug 23, 2019 1:18 pm

Thank you! Right now I keep AMA0 for BT and S0 for my RaspBee (ZigBee module), are you saying that doing so my ZigBee has a weaker signal than how it would be if it used AMA0?

User avatar
MichaIng
Legend
Posts: 1638
Joined: Sat Nov 18, 2017 5:21 pm

Re: Enable BT by default?

Post by MichaIng » Fri Aug 23, 2019 2:46 pm

@FezVrasta
Jep, I guess so, although never made related tests. For details read the official RPi UART docs: https://www.raspberrypi.org/documentati ... on/uart.md

Post Reply