Skip to main content
Graduate
August 24, 2021
Solved

Support for BlueZ in the STM32MPU distribution package?

  • August 24, 2021
  • 2 replies
  • 2244 views

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

    This topic has been closed for replies.
    Best answer by Jean-Marc B

    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

    2 replies

    ST Employee
    August 25, 2021

    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

    darla14Author
    Graduate
    August 25, 2021

    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

    ST Employee
    August 26, 2021

    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'.

    darla14Author
    Graduate
    August 26, 2021

    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