john77 wrote:without the line - pi3-miniuart-bt - UART prints gibberish.
Not sure why you are experiencing this.
So far any work I've done with the serial ports has been on an original Pi and a Pi 3B, so I have just tried this out on a Pi 4B4G running an up to date Raspbian Buster to see what happens.
To test, I use the following Python3 script:
Code: Select all
# -*- coding: utf-8 -*-
# Will also work on Python2.
# Serial port testing on a RaspberryPi
from __future__ import print_function
test_string = "Testing 1 2 3 4".encode('utf-8')
#test_string = b"Testing 1 2 3 4" ### Will also work
port_list = ["/dev/serial0"]
for port in port_list:
serialPort = serial.Serial(port, 115200, timeout = 2)
serialPort.flushInput() # Syntax may change in new version of python3-serial
print("Opened port", port, "for testing:")
bytes_sent = serialPort.write(test_string)
print ("Sent", bytes_sent, "bytes")
loopback = serialPort.read(bytes_sent)
if loopback == test_string:
print ("Received", len(loopback), "valid bytes, Serial port", port, "working \n")
print ("Received incorrect data", loopback, "over Serial port", port, "loopback\n")
print ("Failed at", port, "\n")
# That's it!
Next, I added the following line to the bottom of the original '/boot/config.txt' file.
I power down The Pi, and connect GPIO physical pins 8 and 10 together to form a serial port loopback.
After powering up again, I run the Python script above, and the port pass the test. In this configuration the Serial Port is using '/dev/ttyS0', and Bluetooth (and WiFi) appear unaffected. The Bluetooth icon is present on the top of the GUI, but I have no Bluetooth device to test it's function.
Next, I add the following 3 lines to the end of '/boot/config.txt':
Code: Select all
The Python loopback test script still works, although this time it's going through '/dev/ttyAMA0', and I still have my Bluetooth icon on my GUI. Bluetooth is now using '/dev/ttyS0'.
Try the loopback test and see how you get on.
Sometimes if you are seeing gibberish on a serial port, it helps to reduce the baud to 9600 for troubleshooting.
I have noticed that the Pi runs 5 to 7 degrees hotter at idle with the increased 'core_freq_min' value, one reason not to change the Bluetooth configuration if at all possible.
Hope this helps,