WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Pi3B+ with PiCore 13 Bluetooth Issues  (Read 3883 times)

Offline carrot

  • Newbie
  • *
  • Posts: 27
Pi3B+ with PiCore 13 Bluetooth Issues
« on: September 08, 2021, 04:19:13 PM »
I have a Pi3B+ setup with PiCore 13 working well with the exception of Bluetooth, which I want to setup for connecting a keyboard. I have read through and followed the posts on this forum for setting things up and have had success in turning on, searching and pairing the keyboard with an authentication key. My problem is that when I issue the connect command in bluetoothctl I get the message that the device is connected then a few seconds later I get an error 'org.bluez.Error.NotAvailable' and then the connection messages again saying its not connected. I have also tried to pair my iPhone thinking maybe its a keyboard issue, but this resulted in the same problem, it would pair but not connect with the same error. I have also tried blueman and the various scripts to use different rates (921600 and 300000) when running hciattach, and loading/not loading hci_uart module. I also have tried starting bluetooth via bluetoothd rather than init.d/bluez to watch for errors, but none of the messages gave any indication as to what the problem was.

Has anyone got any ideas on something else I can try to get bluetooth working?

thanks

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #1 on: September 08, 2021, 07:35:51 PM »
Without knowing exactly what scripts you are using, it’s hard to say.  The order the scripts run, is important.   

What is in dmesg?   And does the firmware load properly?

Offline carrot

  • Newbie
  • *
  • Posts: 27
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #2 on: September 08, 2021, 08:45:44 PM »
sorry for the lack of info Paul. From what I can tell the firmware does load properly, and I can run the hciattach command to flash the firmware.  The attached file is part of my setup script for loading and powering on bluetooth. After I couldn't connect the keyboard I added the manual trigger to skip the "auto setup" and print them to the screen instead so I could "manually" follow them.

[attachment deleted by admin]

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #3 on: September 08, 2021, 08:50:13 PM »
Hi carrot
The file you attached is empty.

Offline carrot

  • Newbie
  • *
  • Posts: 27
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #4 on: September 08, 2021, 09:07:07 PM »
sorry, hopefully this one is better

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #5 on: September 09, 2021, 05:42:16 AM »
Looks ok.  Here is a more complete script to setup hci.  https://github.com/RPi-Distro/pi-bluetooth/blob/master/usr/bin/btuart

I mostly pair audio devices using a noinputnooutput agent, but keyboards likely need a different agent.

When you are pairing, what agent are you using?   Also, what version of bluez is used?   5.55 should be the current in the repo.

Offline carrot

  • Newbie
  • *
  • Posts: 27
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #6 on: September 13, 2021, 10:30:04 PM »
thanks Paul. I had tried that script but had issues with /dev/serial1 not existing. I have revised my script to include the MAC address and change the rate per the link but no improvements.

the version of Bluez is 5.55 per the repo. I have even tried re-downloading it to make sure that is the correct one.

to be honest I didn't understand the agent piece and so was just trying with the default agent that was loaded. after reading a little more I have now tried KeyboardOnly, KeyboardDisplay, and DisplayOnly, all of which have given the same result. I can pair and enter the key from the keyboard, but then it disconnects with the Bluez error form my previous post.
I have attached a screenshot to try and show this part of the process.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #7 on: September 13, 2021, 10:57:42 PM »
Hi carrot
Did you start  dbus ?

Offline carrot

  • Newbie
  • *
  • Posts: 27
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #8 on: September 14, 2021, 01:37:39 AM »
Yes via /usr/local/etc/init.d/dbus

Once I start bluez I do get a msg stating dbus-daemon has stopped.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #9 on: September 14, 2021, 02:19:00 AM »
Sometimes that happens - you can double-check if dbus is still running with:
Code: [Select]
$ ps aux | grep dbus

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #10 on: September 14, 2021, 05:31:24 AM »
Hi carrot
... I do get a msg stating dbus-daemon has stopped.
I'm guessing that may be the source of the  "ServicesResolved:  No"  and  "org.bluez.Error.NotAvailable"  error messages
in your attachment.

Offline carrot

  • Newbie
  • *
  • Posts: 27
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #11 on: September 14, 2021, 07:10:45 PM »
thanks Juanito and Rich. I have double checked and dbus is definitely still running before I try to connect to the keyboard.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #12 on: September 14, 2021, 07:57:08 PM »
Hi carrot
Is it still running after you try to connect to the keyboard?

Offline carrot

  • Newbie
  • *
  • Posts: 27
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #13 on: September 15, 2021, 05:32:38 PM »
yes it is Rich

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: Pi3B+ with PiCore 13 Bluetooth Issues
« Reply #14 on: September 16, 2021, 01:24:19 PM »
So pairing and authentication appear to be working. The error is relegated to a profile or service not enabled by default in bluez.  It may require a change in one of the configuration files, or it may require extra software running.  Is this just a keyboard, or does it have some other types of controls on it?

Anyway, after Pairing, type

trust 34:88:5D:41:9C:42

also please copy and paste the results of

info 34:88:5D:41:9C:42