Closed soldag closed 4 years ago
Can you run "sudo btmon" in a separate terminal or "sudo btmon > logfile.txt" to capture all hci messages? When the issue occurs, restart flicd and stop the logging and then post the log file.
Thanks for the quick response! Log file is kind of huge as it's hard to determine the exact time the issue occurs (without pressing the button constantly :grimacing:) - sorry for that. It's even too big for github, so I uploaded it here: https://transfernow.net/ddl/flic
Are you running some other program that uses Bluetooth? I see it sends stuff over HCI that isn't related to flicd.
No, flicd is the only process that uses bluetooth. But I noticed that the discovery option of the flic component in home-assistant was enabled. I disabled it and now it seems to be stable again.
I will observe the behavior and reopen the issue, if I should face issues again.
Can we reopen this issue. I have had this problem for months now. To day I installed a fresh new Raspbian Buster on a Raspberry Pi 3 but the problem still exists.
Hi. I just learned some days ago that Raspberry Pi 3 has quite flaky UART communication to the Bluetooth chip. It doesn't use any flow control and neither any CRC mechanisms to verify that the packet content didn't get corrupt. See https://github.com/raspberrypi/linux/issues/2264.
A solution that works for me is to reduce the baud rate from 921600 kbit/s to 230400 kbit/s. What you should do is to modify the file /usr/bin/btuart and change the following line:
$HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
to
$HCIATTACH /dev/serial1 bcm43xx 230400 noflow - $BDADDR
Then reboot. Now check that the correct baud rate (230400) is set by executing ps aux | grep hciattach
.
Thank you. I have modified the file now. I will come back with the result.
It is stable now and is working perfekt.
Here is a one line command you can use:
sudo sed -i 's/921600/230400/g' /usr/bin/btuart
Lets spread the word!
Recently, I encounter some issues with the flicd server, which I use in my home-assistant setup. After some time, the connection to the buttons is always getting lost. In this state, when clicking any of the paired buttons, they blink red two times. After restarting flicd, everything works well again for some hours. The log always looks like this:
Sometimes, the server even crashes with the error message
Invalid ACL packet size
.