Setup Bluetooth on your ubuntu 18.04 in raspberry pi 3 b+
17 Oct 2018setup bluetooth for raspberry pi3 b+
1. kernel and drivers
in this case, please set the following kernel CONFIG to “*”, let the kernel preload some feaures:
then rebuild the kernel image and drivers and updates them to boot, rootfs partitions likes:
cd <kernel>
make menuconfig <== add the CONFIGs
make clean
make -j8
cp arch/arm64/boot/Image <boot>/kernel8.img
init hci interface
#!/bin/bash
HCIATTACH=/usr/bin/hciattach
UART=/dev/ttyAMA0
SERIAL=`grep Serial /proc/cpuinfo | cut -c19-`
B1=`echo $SERIAL | cut -c3-4`
B2=`echo $SERIAL | cut -c5-6`
B3=`echo $SERIAL | cut -c7-8`
BDADDR=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))`
echo $BDADDR:$SERIAL
if [ "$(cat /proc/device-tree/aliases/uart0)" == "$(cat /proc/device-tree/aliases/serial1)" ]; then
if [ "$(wc -c /proc/device-tree/soc/gpio@7e200000/uart0_pins/brcm\,pins | cut -f 1 -d ' ')" = "16" ] ; then
$HCIATTACH $UART bcm43xx 3000000 flow - $BDADDR
else
$HCIATTACH $UART bcm43xx 921600 noflow - $BDADDR
fi
else
$HCIATTACH $UART bcm43xx 460800 noflow - $BDADDR
fi