This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Ble automation on linux

Hi,

I have a ble device that uses nRF52 chip. I would like to know if it is possible to do ble automation on that device.

Here is my setup:

OS: Ubuntu 20.04 LTS

Bluetooth receiver: Running this on DELL XPS-13-9370 laptop which has a wifi chip that has both wifi and bluetooth capability (KillerTm Wi-Fi 6 AX1650 (2 x 2) and Bluetooth 5.1)

Bluetooth stack: Bluez 5.53 that came with Ubuntu system. Website:http://www.bluez.org/

Programming Language: in Kotlin with the help of possibly this library to connect to bluetooth device: https://github.com/hypfvieh/bluez-dbus

Here is what I am having issue with, basically not being able to keep connection alive

Logs:

Extracted from btmon.

> HCI Event: Disconnect Complete (0x05) plen 4             #88 [hci0] 43.895587
        Status: Success (0x00)
        Handle: 3
        Reason: Remote User Terminated Connection (0x13)

 

Extracted from journalctl. What is reason 3?

src/adapter.c:dev_disconnected() Device XX:XX:XX:XX:XX:XX disconnected, reason 3

Any ideas on how to move further is greatly appreciated.

Thanks

  • Hello, 

    I am not familiar with the Bluez stack, but from your btmon HCI event it seems that the connection is terminated by the remote user, i.e your nRF52 device. What program is your nRF52 device running? Could it be that it terminates the connection because of a non-compatible connection configuration with the central device?
    What kind of device is the nRF52 device, are you working with a nRF52 development kit or a custom module?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • Hi,

    Sorry, I just noticed your response. I guess I didn't turn on reply notification.

    Anyways, it is a custom module. I am attaching a log that I got from nrfConnect for Desktop which I used nRF52840 USB Dongle to scan my BLE device. I got basically the same result

    2020-08-26T19:53:09.879Z DEBUG GAP_EVT_DISCONNECTED time:2020-08-26T19:53:09.877Z connHandle:0 reason:19 reasonName:remoteUserTerminatedConnection
    2020-08-26T19:53:09.881Z INFO Disconnected from device XX:XX:XX:XX:XX:XX, reason: BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION

    Thanks,

    Anh

    2020-08-26T18_34_35.615Z-log.txt

  • Hello,

    abunai said:
    Sorry, I just noticed your response. I guess I didn't turn on reply notification.

    No problem at all.

    abunai said:
    Anyways, it is a custom module. I am attaching a log that I got from nrfConnect for Desktop which I used nRF52840 USB Dongle to scan my BLE device. I got basically the same result

    Thank you for including the log.
    It seems indeed that your remote device terminates the connection.
    Furthermore, it seems in your log that you are attempting to read some characteristics with different handles, and you keep requesting handle 15, but there does not exist any such characteristic.
    The log message associated with this is : "Cannot handle HVX event. No characteristic value with handle 15 found."
    And this happens repeatedly before the remote user disconnects.

    Could you check what your program is attempting and failing to read here? And, what your custom module is programmed to do when receiving repeated invalid requests?

    Best regards,
    Karl

Related