2021-08-24 11:03 AM
Hello ,
Is the BlueZ supported or added in the Distribution or developer or starter image?
I tried running bluetoothd -v to get the version of the bluetoothd (and hence the Bluez which has this demon built) but I got this :
root@stm32mp1:~# bluetoothd -v
-sh: bluetoothd: not found
I then tried building the Distribution package which has this meta-connectivity layer where there is BlueZ is in add on Recipes ( https://wiki.st.com/stm32mpu/wiki/STM32MP15_OpenSTLinux_release_note)
bluez5meta-st/meta-st-openstlinux/recipes-connectivity/bluez5/bluez5_%.bbappend
Do I have to add this layer? or will it be built by bitbake st-image-weston
?
Using bitbake st-image-weston and fishing the image gives the same result.
Please tell the steps to build and use BlueZ and all the utilities it provides (bluetoothd,meshctl)
Thanks in advance !
Regards,
D
Solved! Go to Solution.
2021-08-31 01:16 AM
Hi @darla14
first, you need to check if your BT environment is correctly probed: https://wiki.st.com/stm32mpu/wiki/Bluetooth_overview#How_to_trace_and_debug_the_framework
From my side, after setting the BT parameters (https://wiki.st.com/stm32mpu/wiki/How_to_set_up_a_Bluetooth_connection) and following this wiki page https://wiki.st.com/stm32mpu/wiki/How_to_scan_Bluetooth_devices, I successfully paired my board STM32MPU157C-DK2 running OpenSTLinux 3.0 with my phone.
For BTLE, take a look at the wiki page https://wiki.st.com/stm32mpu/wiki/How_to_scan_BLE_devices#BLE_device_connection_step-by-step
Finally, the error message you referred to is normal as the BT daemon is already running through the systemd service:
$ systemctl status bluetooth
[0;1;32m*[[0m bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: [[0;1;32mactive (running)[[0m since Tue 2021-08-31 08:09:42 UTC; 2min 35s ago
Docs: man:bluetoothd(8)
Main PID: 571 (bluetoothd)
Status: "Running"
Memory: 2.0M
CGroup: /system.slice/bluetooth.service
`-571 /usr/libexec/bluetooth/bluetoothd
Aug 31 08:09:41 stm32mp1 systemd[1]: Starting Bluetooth service...
Aug 31 08:09:42 stm32mp1 systemd[1]: Started Bluetooth service.
Best regards,
--JM
2021-08-24 11:46 PM
Hi @darla14
Bluetooth is fully supported and the bluetoothd program is installed by default in OpenSTLinux image but it is not available in your PATH environment:
root@stm32mp1:~# ps -aux | grep blue
root 572 0.0 0.6 4792 2920 ? Ss 06:31 0:00 /usr/libexec/bluetooth/bluetoothd
root 1100 0.0 0.2 2024 1112 ttySTM0 S+ 06:37 0:00 grep blue
So, the command you mentioned runs fine:
root@stm32mp1:~# /usr/libexec/bluetooth/bluetoothd -v
5.55
About the availability of the meshctl utility, please refer to the following link : https://community.st.com/s/question/0D50X0000BTdF20SQF/stm32mp157cdk2-bluetooth-mesh .
Best regards,
--JM
Edit: add link to build meshctl
2021-08-25 10:39 AM
Thanks for your reply. Do you know where I can find the compiled binary for
https://github.com/bluez/bluez/blob/master/test/example-gatt-server ??
or
https://github.com/bluez/bluez/blob/master/tools/gatt-service.c
Regards,
D
2021-08-25 11:41 PM
Hi @darla14
The two binaries are available from the package bluez5-testtools from our OpenSTLinux repository. You can install it with the command:
$ apt-get install bluez5-testtools
The compiled binaries are then in the directory /usr/lib/bluez/test
Best regards,
--JM
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'.
2021-08-26 10:57 AM
Thanks for the prompt reply .
Ok this works , after i did apt-get update as well before running
apt-get install bluez5-testtools
root@stm32mp1:/usr/lib/bluez/test# ./example-gatt-server
./example-gatt-server:394: PyGIDeprecationWarning: GObject.timeout_add is deprecated; use GLib.timeout_add instead
GObject.timeout_add(5000, self.drain_battery)
./example-gatt-server:651: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
mainloop = GObject.MainLoop()
Registering GATT application...
GetManagedObjects
GATT application registered
But on the lightblue App (iPhone) , i cant see the device.What device name should I get?
Also is there way to build this using makefile if I want to customise it? How?
Since it depends on dbus and glib and bluez requires ./confgue kind of scripts to build which I am not sure is feasible for cross compiling the bluez/test-*
Regards,
D
2021-08-27 12:08 AM
Hi @darla14
I am glad you resolve your initial problems!
About the bluetooth usage, I recommand the following wiki : https://wiki.st.com/stm32mpu/wiki/Bluetooth_overview and its derivative pages.
For the development of applications, this wiki page https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Developer_Package may help you.
Best regards,
--JM
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'.
2021-08-30 11:08 AM
Hello @Jean-Marc B ,
Thanks for the reply,
I am able to cross compile the utilities and run it on stm32mp1 but strangely I think I may have to enable something else .Is the bluetooth low energy enabled by default?If not what commands is needed to turn it on.
As a test I ran bluetoothctl and then scan on and I got this ,I rebooted as well :
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.NotReady
list command shows the default the MAC address :
[bluetooth]# list
Controller 43:43:A1:12:1F:AC stm32mp1 [default]
Also :
/usr/libexec/bluetooth# ./bluetoothd
D-Bus setup failed: Name already in use
Can you please tell whats wrong here?
Regards,
2021-08-31 01:16 AM
Hi @darla14
first, you need to check if your BT environment is correctly probed: https://wiki.st.com/stm32mpu/wiki/Bluetooth_overview#How_to_trace_and_debug_the_framework
From my side, after setting the BT parameters (https://wiki.st.com/stm32mpu/wiki/How_to_set_up_a_Bluetooth_connection) and following this wiki page https://wiki.st.com/stm32mpu/wiki/How_to_scan_Bluetooth_devices, I successfully paired my board STM32MPU157C-DK2 running OpenSTLinux 3.0 with my phone.
For BTLE, take a look at the wiki page https://wiki.st.com/stm32mpu/wiki/How_to_scan_BLE_devices#BLE_device_connection_step-by-step
Finally, the error message you referred to is normal as the BT daemon is already running through the systemd service:
$ systemctl status bluetooth
[0;1;32m*[[0m bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: [[0;1;32mactive (running)[[0m since Tue 2021-08-31 08:09:42 UTC; 2min 35s ago
Docs: man:bluetoothd(8)
Main PID: 571 (bluetoothd)
Status: "Running"
Memory: 2.0M
CGroup: /system.slice/bluetooth.service
`-571 /usr/libexec/bluetooth/bluetoothd
Aug 31 08:09:41 stm32mp1 systemd[1]: Starting Bluetooth service...
Aug 31 08:09:42 stm32mp1 systemd[1]: Started Bluetooth service.
Best regards,
--JM
2021-08-31 10:02 AM
Thanks , it helped.I will test further !
Regards
2021-09-06 12:09 AM
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'