Enable BT by default?

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.


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 :wink:.

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 serial-getty@ttyAMA0 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.

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?

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