Ahh so that’s where they are, ok, I’d agree that is a better place but experience says nothing is that “obvious” round these parts, but thank you for the link.
This comment and code snippet added 2 years ago shows the current position
# Review should this be: dtoverlay=pi3-miniuart-bt?
sudo sed -i -n '/dtoverlay=pi3-disable-bt/!p;$a dtoverlay=pi3-disable-bt' /boot/config.txt
using dtoverlay=pi3-disable-bt
does what is says on the tin!
using dtoverlay=pi3-miniuart-bt
would be a small step in the right direction as it would enable the BT albeit using the lesser serial port.
The correct approach would be to do nothing, leave it as it was, delete that whole block. It would mean changing the addres used in emonhub.conf to serial0
but that should be done regardless as the GPIO serial port (serial0) is always used regardless of model Pi, regardless of whether BT is onboard/used, regardless of how the serial ports are configured and regardless of which overlay is used(or not).
All that is needed is “enable_uart=1” added to the end of the config.txt to ensure the ttyAMA0 port is enabled depite the console being disabled (by removing “console=serial0,115200” from cmdline.txt of course). The prescience of “enable_uart=1” in config.txt disables the “turbo boosting” functions of the MCU which was the cause of the inconsistent serial baud rates on ttyS0 when the Pi3 was first launched, as it was linked to a variable clock speed. That has not been an issue for years now, we do not need any clock speed adjustments, serial port swaps, BT disabling etc.
Ahh! @dlongson, a penny just dropped, as well as enabling the serial port, you would have also needed to enable the hciuart service to use the on-board BT (if you hadn’t already) as it appears to be belt and braces disabled in these lines (again not needed if this was reviewed)
# We also need to stop the Bluetooth modem trying to use UART
sudo systemctl disable hciuart
issuing a
sudo systemctl enable --now hciuart
command will both enable and start the service in one move, providing the ports are sorted.